/* ============================================
   HYDRO SUPPLY & CO. CRM
   Dark luxury aesthetic — Gold/Green accents
   ============================================ */

/* AI button identity — small purple sparkle prefix that visually marks
   any action as AI-driven, paired with the function-specific icon. */
.ai-icon-prefix {
  font-size: 0.72em;
  margin-right: 4px;
  color: #a78bfa;
  opacity: 0.95;
}

/* Paid row treatment for vendor POs and quote/invoice/order tables.
   Subtle green wash + 3px left accent makes settled rows scan as
   "done" at a glance, even when status badges are buried in long lists. */
tr.row-paid {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.04) 60%, transparent 100%);
  position: relative;
}
tr.row-paid > td:first-child {
  border-left: 3px solid #10b981;
}
tr.row-paid:hover {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.07) 60%, transparent 100%);
}

/* ===== LOGIN SCREEN ===== */
/* Login screen — editorial light treatment matching pipelineiqcrm.com.
   Cream paper background, ink card, warm-gold accents. The dashboard
   stays dark for sustained work, but the entry surface (and any other
   public-facing PipelineIQ chrome) reads as one brand with the marketing
   site. */
.login-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: #FAF8F3;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}
.login-card {
  background: #FAF8F3;
  border: 1px solid #E6E2D6;
  border-radius: 14px;
  padding: 48px 40px 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(20, 24, 31, 0.06), 0 2px 8px rgba(20, 24, 31, 0.04);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { font-family: 'Source Serif 4', serif; font-weight: 500; color: #14181F; font-size: 1.6rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.login-header p { color: #6B6F77; font-size: 0.92rem; margin: 0; }
/* Pattée brand mark — same shape as the marketing site logo. */
.piq-mark {
  display: inline-block;
  width: 36px; height: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><polygon points='24,4 40,4 36,28 60,24 60,40 36,36 40,60 24,60 28,36 4,40 4,24 28,28' fill='%2314181F'/><polygon points='32,4 33,8 33,28 34,30 36,31 56,31 60,32 56,33 36,33 34,34 33,36 33,56 32,60 31,56 31,36 30,34 28,33 8,33 4,32 8,31 28,31 30,30 31,28 31,8' fill='%23A88758'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  flex-shrink: 0;
}
.piq-lockup {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 14px;
}
.piq-wordmark {
  font-family: 'Source Serif 4', serif;
  font-weight: 500;
  /* Wordmark-only lockup on the login — sized up to carry the brand on
     its own without a companion mark. */
  font-size: 2.4rem;
  letter-spacing: -0.025em;
  color: #14181F;
  background: none;
  -webkit-text-fill-color: #14181F;
  line-height: 1;
}
.piq-iq { color: #A88758; }
.piq-tagline {
  color: #6B6F77;
  font-size: 0.86rem;
  font-style: normal;
  margin-top: 0;
}
.login-card .form-group { margin-bottom: 18px; }
.login-card .form-group label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #6B6F77;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.login-card .form-input {
  width: 100%;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #E6E2D6;
  border-radius: 8px;
  color: #14181F;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}
.login-card .form-input::placeholder { color: #A4A8B0; }
.login-card .form-input:focus {
  border-color: #A88758;
  outline: none;
  box-shadow: 0 0 0 3px rgba(168, 135, 88, 0.12);
}
.login-card .btn {
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  margin-top: 8px;
  background: #14181F;
  color: #FAF8F3;
  border: 1px solid #14181F;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
.login-card .btn:hover { background: #1F242E; }
.login-card .btn:active { transform: translateY(1px); }
.login-card #togglePassword { color: #6B6F77 !important; }
.login-card #togglePassword:hover { color: #14181F !important; }
.login-card #loginRemember { accent-color: #A88758 !important; }
.login-card label[for="loginRemember"] { color: #6B6F77 !important; }
.login-card #loginError, .login-card #resetError { color: #B43E3E !important; }
.login-card #resetSuccess { color: #2D7A4D !important; }
.login-card #forgotPasswordLink, .login-card #backToLoginLink { color: #A88758 !important; font-weight: 500; }
.login-card #forgotPasswordLink:hover, .login-card #backToLoginLink:hover { text-decoration: underline; }
#googleSignInBtn {
  background: #FFFFFF !important;
  border: 1px solid #E6E2D6 !important;
  color: #14181F !important;
  font-family: 'Inter', sans-serif !important;
}
#googleSignInBtn:hover { background: #F5F1E8 !important; border-color: #A88758 !important; }
#googleSignInSection > div > div { background: #E6E2D6 !important; }
#googleSignInSection > div > span { color: #A4A8B0 !important; }
.login-footer {
  text-align: center;
  font-size: 0.78rem;
  color: #A4A8B0;
  font-style: normal;
  margin-top: 28px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}
.login-legal {
  text-align: center;
  margin-top: 12px;
  font-size: 0.78rem;
}
.login-legal a {
  color: #6B6F77;
  text-decoration: none;
  margin: 0 8px;
  font-family: 'Inter', sans-serif;
}
.login-legal a:hover { color: #14181F; }
.login-legal span { color: #C9C3B5; }
.crm-app { display: flex; }

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

:root {
  /* PipelineIQ brand palette (2026-05-06 editorial-luxe alignment).
     Retired: cyan/violet "AI startup" gradient. Active: ink + warm gold
     matching the pipelineiqcrm.com marketing site. The dashboard stays
     dark for sustained-work readability, but every accent (links, scroll-
     bar, focus, selection) is now warm metal instead of cyan. Tokens
     marked legacy are rebound rather than renamed so 1,000+ existing
     references pick up the new color without find/replace risk. */
  --brand-ink:    #14181F;  /* deep ink — matches marketing site */
  --brand-paper:  #FAF8F3;  /* cream paper — matches marketing site */
  --brand-gold:   #A88758;  /* warm metal — matches marketing site */
  --brand-blue:   #A88758;  /* legacy alias → warm gold */
  --brand-violet: #A88758;  /* legacy alias → warm gold */
  --brand-navy:   #0a0e1a;  /* dashboard background */
  --brand-deep:   #060612;  /* dashboard deep corner */
  --gold:         #A88758;  /* the editorial warm metal */
  --gold-dark:    #8C6F44;  /* darker gold for hover/pressed */
  --gold-light:   #C2A37A;  /* lighter gold for highlights */
  --green-dark: #295100;
  --green-deep: #172d06;
  --green-mid: #244709;
  --green-light: #3d7a0e;
  --orange: #ff8c00;
  --red: #d90000;
  --blue: #3b82f6;
  --purple: #8B5CF6;
  --pink: #ec4899;
  --teal: #10b981;
  /* Backgrounds — shifted from pure black toward navy so they harmonize
     with the brand plate icon without going so dark that contrast suffers. */
  --bg-base:        #0a0e1a;
  --bg-dark:        #0d111e;
  --bg-card:        #131725;
  --bg-card-hover:  #181d2c;
  --bg-input:       #0f1320;
  --bg-sidebar:     #080b14;
  --border:         #1d2233;
  --border-light:   #2a304a;
  --border-focus:   #06B6D4;
  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --white: #ffffff;
  /* Editorial pairing: Source Serif 4 for displays/headings (matches the
     marketing site), Inter for body, JetBrains Mono for eyebrows + numeric
     accents. Sora retained as fallback for any inline `font-family: 'Sora'`
     references that haven't been migrated yet. */
  --font-heading: 'Source Serif 4', 'Sora', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 64px rgba(0,0,0,0.5);
  --bg-secondary: #161b2a;
  --bg-tertiary: #1a1f2e;
  --danger: #ef4444;
  --radius: 12px;
  --transition: 0.2s ease;
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --topbar-height: 64px;
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-secondary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); color: var(--text-primary); font-weight: 600; }
a { color: var(--gold); text-decoration: none; }
img { max-width: 100%; }
::selection { background: rgba(168, 135, 88, 0.32); color: var(--white); }

/* Scrollbar */
/* Scrollbars — brand violet thumb with a cyan→violet hover, slightly
   wider so it's actually visible. Track stays transparent so it doesn't
   intrude. Firefox gets the equivalent via scrollbar-color below. */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(168, 135, 88, 0.32);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 135, 88, 0.62);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 135, 88, 0.42) transparent;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  /* Subtle navy gradient with a thin warm-gold accent rail on the right
     edge — same brand language as the marketing site: ink chrome, gold
     hairline. */
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, #0a0e1f 100%);
  border-right: 1px solid var(--border);
  box-shadow: inset -1px 0 0 0 rgba(168, 135, 88, 0.22);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
}
.sidebar-header {
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: none;
  min-height: 56px;
}
.sidebar-brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Pattée brand mark in the sidebar — inline SVG via background-image so
   the mark stays vector-sharp at any size and the cream cross + gold
   needle star both render against the dark sidebar. */
.piq-logo-mark {
  display: inline-block;
  width: 36px; height: 36px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><polygon points='24,4 40,4 36,28 60,24 60,40 36,36 40,60 24,60 28,36 4,40 4,24 28,28' fill='%23FAF8F3'/><polygon points='32,4 33,8 33,28 34,30 36,31 56,31 60,32 56,33 36,33 34,34 33,36 33,56 32,60 31,56 31,36 30,34 28,33 8,33 4,32 8,31 28,31 30,30 31,28 31,8' fill='%23A88758'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}
.piq-brand-text { display: flex; flex-direction: column; }
/* Wordmark — Source Serif 4 in cream, "IQ" picks up warm gold to match
   the marketing site lockup. */
.piq-name {
  font-family: 'Source Serif 4', serif;
  font-weight: 500;
  /* Wordmark-only sidebar lockup — sized up since there's no companion
     mark to balance against. Theme-aware: cream on dark, ink on light. */
  font-size: 1.5rem;
  letter-spacing: -0.018em;
  white-space: nowrap;
  line-height: 1;
  color: var(--text-primary);
}
.piq-name .piq-iq { color: #A88758; }
/* Legacy override removed in favor of the explicit `.piq-name .piq-iq`
   selector above. Any other locations using `.piq-iq` outside the
   sidebar wordmark inherit gold by default. */
.piq-iq { color: #A88758; }

/* Tenant brand block, sits directly under the PipelineIQ wordmark.
   Sized up from a faded 12px label to a real tenant identity — bigger
   logo, the company name reads as a heading, full opacity. This is the
   one piece of the sidebar that's the customer's identity, not ours. */
.sidebar-company {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-co-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
  padding: 3px;
  opacity: 1;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.sidebar-co-name {
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Hide old classes */
.sidebar-logo { display: none; }
.sidebar-brand { display: none; }
.sidebar-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-toggle:hover { color: var(--gold); background: var(--bg-card); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
/* Active nav: deeper cyan tint + glowing left rail so the current view is
   unmistakable. Replaces the old subtle gold tint that was easy to miss. */
.nav-item.active {
  background: linear-gradient(90deg, rgba(6,182,212,0.22) 0%, rgba(139,92,246,0.10) 100%);
  color: #ffffff;
  box-shadow: inset 3px 0 0 0 var(--brand-blue);
}
.nav-item.active i { color: var(--brand-blue); }
.nav-item i { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.nav-divider { height: 1px; background: var(--border); margin: 12px 8px; }
.nav-label {
  padding: 8px 14px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

/* Collapsed sidebar */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .piq-brand-text,
.sidebar.collapsed .sidebar-company,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-item i { width: auto; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  max-width: calc(100vw - var(--sidebar-width));
  min-height: 100vh;
  transition: margin-left var(--transition);
  overflow-x: hidden;
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); max-width: calc(100vw - var(--sidebar-collapsed)); }

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  /* Brand-rebrand: navy-tinted glass with a 2px cyan→violet→cyan strip
     across the very top edge. Matches the wordmark gradient and signals
     "this is PipelineIQ" the moment you look at the page. */
  background: rgba(10,14,26,0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 2px 0 0 transparent;
  background-image:
    linear-gradient(90deg, var(--brand-blue) 0%, var(--brand-violet) 50%, var(--brand-blue) 100%),
    linear-gradient(180deg, rgba(10,14,26,0.88), rgba(10,14,26,0.88));
  background-repeat: no-repeat;
  background-size: 100% 2px, 100% 100%;
  background-position: top, top;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 90;
}
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
}
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 480px;
}
.topbar-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.topbar-search input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}
.topbar-search input:focus { border-color: var(--gold); }
.search-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 4px;
  max-height: 440px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
.search-results.active { display: block; }
.search-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  flex-wrap: wrap;
}
.search-filter-tab {
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.search-filter-tab:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.search-filter-tab.active { background: rgba(79,140,255,0.15); color: #4f8cff; border-color: rgba(79,140,255,0.3); }
.search-category-header {
  padding: 8px 16px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-card);
  position: sticky;
  top: 0;
}
.search-results:has(.search-filter-tabs) .search-category-header { top: 41px; }
.search-result-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item .result-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  min-width: 56px;
  text-align: center;
}
.result-type-contact { color: #4f8cff; background: rgba(79,140,255,0.1); }
.result-type-company { color: #8b5cf6; background: rgba(139,92,246,0.1); }
.result-type-deal { color: #10b981; background: rgba(16,185,129,0.1); }
.result-type-product { color: #f59e0b; background: rgba(245,158,11,0.1); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  position: relative;
  width: 40px; height: 40px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--gold-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.topbar-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(6,182,212,0.06); }
.topbar-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }

/* Narrow phones — pack the topbar so every icon (notifications, agent,
   logout, BU switcher, quick-add) stays visible. Shrink icon buttons, let
   the search collapse to the remaining width, and allow the action group
   to wrap if the viewport is really small rather than clipping. */
@media (max-width: 720px) {
  /* Let the bar grow vertically when its contents wrap so the second row
     doesn't overflow a fixed sticky-bar height and cover the page below. */
  .topbar { gap: 6px; flex-wrap: wrap; height: auto; min-height: var(--topbar-height); padding: 6px 12px; }
  .topbar-search { min-width: 120px; max-width: 100%; flex: 1 1 100%; order: 5; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .topbar-btn { width: 36px; height: 36px; }
  .topbar-user { padding: 4px 8px; }
  .topbar-user span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #buSwitcher { padding: 4px 8px !important; }
  #buSwitcher span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* AI topbar button: drop the 'AI' word on phones, keep just the sparkle.
     Saves ~30px and reduces the chance of wrapping in the first place. */
  #aiAssistantBtn span { display: none; }
  #aiAssistantBtn { width: 36px; padding: 0; justify-content: center; }
}
@media (max-width: 420px) {
  .topbar-btn { width: 34px; height: 34px; }
  .topbar-user span { max-width: 50px; }
  /* Shrink the floating Help button further on small phones — it lives
     in the same corner as primary CTAs in some views and was crowding them. */
  #contactSupportBtn { width: 38px !important; height: 38px !important; bottom: 14px !important; right: 14px !important; font-size: 14px !important; }
}

/* Business Unit switcher — distinct from generic topbar buttons so the active
   brand context is immediately obvious. Fills with gold when a specific unit
   is active; outlined when on "All Units". */
#buSwitcher {
  width: auto !important;
  background: rgba(6,182,212,0.08);
  border-color: rgba(6,182,212,0.35);
  color: var(--gold);
}
#buSwitcher:hover { background: rgba(6,182,212,0.16); }
#buSwitcher[data-active-bu="1"] {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-color: var(--gold);
  color: #1a1a1a;
}
#buSwitcher[data-active-bu="1"] svg { color: #1a1a1a; }

/* Active-unit context strip — shown below the topbar when a non-"All" unit
   is selected. Makes the current brand context visible at a glance without
   forcing the user to read the small chip label. */
.bu-context-strip {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: linear-gradient(90deg, rgba(6,182,212,0.12), rgba(6,182,212,0.02));
  border-bottom: 1px solid rgba(6,182,212,0.25);
  font-size: 0.82rem;
  color: var(--text);
}
.bu-context-strip.active { display: flex; }
.bu-context-strip .bu-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: var(--gold);
  color: #1a1a1a;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
}
.bu-context-strip .bu-label { color: var(--text-muted); }
.bu-context-strip .bu-clear {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  cursor: pointer;
}
.bu-context-strip .bu-clear:hover { border-color: var(--gold); color: var(--gold); }
.nav-history-btns {
  display: flex;
  gap: 4px;
  margin-right: 8px;
  flex-shrink: 0;
}
.nav-history-btns .topbar-btn {
  width: 34px;
  height: 34px;
  font-size: 0.82rem;
  border-radius: 8px;
}
.badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--red);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  display: none;
}
.badge:not(:empty) { display: block; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  position: relative;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--bg-base);
}
.topbar-user span { font-weight: 500; color: var(--text-primary); font-size: 0.9rem; }

/* Quick Add Menu */
.quick-add-menu {
  position: fixed;
  top: 56px;
  right: 140px;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  display: none;
  z-index: 200;
  box-shadow: var(--shadow-md);
}
.quick-add-menu.active { display: block; }
.quick-add-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}
.quick-add-menu button:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.quick-add-menu button i { width: 18px; color: var(--gold); }

/* ===== VIEWS ===== */
.view {
  display: none;
  padding: 18px 20px;
  animation: fadeIn 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.view-header h1 { font-size: 1.7rem; margin-bottom: 4px; }
.view-subtitle { color: var(--text-muted); font-size: 0.9rem; }
.view-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.9rem; }
.breadcrumb a { color: var(--gold); }
.breadcrumb i { font-size: 0.7rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn i { font-size: 0.85rem; }
/* Primary button: cyan→violet brand gradient, white text. Replaces the
   old gold→orange gradient. Pulled directly from the wordmark stops so
   the action color always matches the brand mark. */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-violet));
  color: #ffffff;
  border: none;
  box-shadow: 0 1px 3px rgba(6,182,212,0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6,182,212,0.45), 0 2px 8px rgba(139,92,246,0.25);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: rgba(217,0,0,0.15); color: #f87171; border: 1px solid rgba(217,0,0,0.3); }
.btn-danger:hover { background: rgba(217,0,0,0.25); }
.btn-delete-subtle { background: transparent; border: none; color: var(--text-muted); padding: 6px 8px; font-size: 0.78rem; min-width: auto; opacity: 0.5; }
.btn-delete-subtle:hover { color: #f87171; opacity: 1; background: rgba(217,0,0,0.1); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-group { display: flex; gap: 8px; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-input, .select-input, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}
.form-input:focus, .select-input:focus, .form-textarea:focus { border-color: var(--gold); }

/* Native date/datetime pickers — dark-mode friendly, calendar icon visible */
.form-input[type="date"],
.form-input[type="datetime-local"],
.form-input[type="time"],
.form-input[type="month"],
.form-input[type="week"] {
  color-scheme: dark;
  cursor: pointer;
  min-height: 38px;
}
.form-input[type="date"]::-webkit-calendar-picker-indicator,
.form-input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.form-input[type="time"]::-webkit-calendar-picker-indicator,
.form-input[type="month"]::-webkit-calendar-picker-indicator,
.form-input[type="week"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) brightness(1.2);
  cursor: pointer;
  opacity: 1;
  padding: 4px;
}
.form-input[type="date"]::-webkit-calendar-picker-indicator:hover { filter: invert(1) sepia(1) saturate(4) hue-rotate(180deg); }
.form-textarea { min-height: 100px; resize: vertical; }
div.form-textarea[contenteditable] { resize: none; line-height: 1.6; }
div.form-textarea[contenteditable][data-empty="true"]:before { content: attr(data-placeholder); color: var(--text-muted, #999); pointer-events: none; }
div.form-textarea[contenteditable] img { max-width: 100%; height: auto; border-radius: 6px; margin: 8px 0; display: block; border: 1px solid var(--border, #e5e7eb); }
.select-input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
select option, .select-input option { background: var(--bg-card); color: var(--text-primary); }
.small-input { width: 80px; display: inline-block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.toolbar-search i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.toolbar-search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}
.toolbar-search input:focus { border-color: var(--gold); }
.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-filters .select-input { width: auto; min-width: 140px; padding: 9px 32px 9px 12px; font-size: 0.85rem; }

/* ===== METRICS — PREMIUM REDESIGN ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.metric-card {
  background: linear-gradient(145deg, #1a1f2e, #141418);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
  opacity: 0.8;
}
/* Metric card top accents — editorial palette: gold for primary metrics,
   sage for positive/health, rust for warnings. Subtle gradient on each
   so the cards still feel layered without screaming color. */
.metric-card[data-metric="contacts"]::before { background: linear-gradient(90deg, #A88758, #C2A37A); }
.metric-card[data-metric="companies"]::before { background: linear-gradient(90deg, #A88758, #C2A37A); }
.metric-card[data-metric="deals"]::before { background: linear-gradient(90deg, #5db588, #82c8a4); }
.metric-card[data-metric="revenue"]::before { background: linear-gradient(90deg, #A88758, #C2A37A); }
.metric-card[data-metric="payables"]::before { background: linear-gradient(90deg, #B43E3E, #D06868); }
.metric-card[data-metric="emails"]::before { background: linear-gradient(90deg, #A88758, #C2A37A); }
.metric-card[data-metric="winrate"]::before { background: linear-gradient(90deg, #5db588, #82c8a4); }
.metric-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.metric-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.metric-info { display: flex; flex-direction: column; gap: 2px; }
.metric-value {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* ===== DASHBOARD (legacy compat) ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.dash-card h3 { font-size: 1rem; margin-bottom: 16px; }
.dash-card.full-width { grid-column: 1 / -1; }

.pipeline-summary { display: flex; flex-direction: column; gap: 10px; }
.pipeline-stage-bar { display: flex; align-items: center; gap: 12px; }
.pipeline-stage-bar .stage-name { font-size: 0.85rem; color: var(--text-secondary); width: 100px; flex-shrink: 0; }
.pipeline-stage-bar .stage-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.pipeline-stage-bar .stage-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--orange)); transition: width 0.5s ease; }
.pipeline-stage-bar .stage-val { font-size: 0.8rem; color: var(--text-muted); width: 60px; text-align: right; }

/* ===== DASHBOARD HEADER & FILTERS ===== */
#view-dashboard { padding: 18px 20px; }
.dash-header-bar { flex-wrap: wrap; gap: 16px; }
.dash-header-bar h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}
.dash-header-bar .view-subtitle {
  color: #6b7280;
  font-size: 0.88rem;
}
.dash-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dash-custom-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-custom-range .form-input-sm {
  padding: 8px 12px;
  font-size: 0.82rem;
  width: 140px;
  background: #161921;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: var(--text-primary);
  transition: border-color 0.2s;
}
.dash-custom-range .form-input-sm:focus { border-color: var(--gold); outline: none; }
.dash-range-sep { color: #4b5563; font-size: 0.8rem; }
.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
  border-radius: 10px;
}
#dashCustomizeBtn {
  background: linear-gradient(135deg, rgba(6,182,212,0.1), rgba(6,182,212,0.05));
  border-color: rgba(6,182,212,0.3);
  color: var(--gold);
}
#dashCustomizeBtn:hover {
  background: linear-gradient(135deg, rgba(6,182,212,0.2), rgba(6,182,212,0.1));
  border-color: var(--gold);
}

/* Metric Trend Indicators */
.metric-trend {
  font-size: 0.73rem;
  font-weight: 600;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
}
.metric-trend.up { color: #34d399; background: rgba(16,185,129,0.12); }
.metric-trend.down { color: #f87171; background: rgba(239,68,68,0.12); }
.metric-trend.neutral { color: #6b7280; background: rgba(107,114,128,0.1); }

/* ===== LARGE SCREEN EXPANSION ===== */
@media (min-width: 1400px) {
  #view-dashboard { padding: 22px 24px; }
  .metrics-grid { gap: 22px; }
  .metric-card { padding: 26px 24px; }
  .metric-value { font-size: 1.85rem; }
  .metric-label { font-size: 0.82rem; }
  .metric-icon { width: 54px; height: 54px; font-size: 1.35rem; }
  .dash-widget-grid { gap: 22px; }
  .dash-widget-header { padding: 20px 26px 16px; }
  .dash-widget-header h3 { font-size: 1rem; }
  .dash-widget-body { padding: 22px 26px 26px; }
}
@media (min-width: 1800px) {
  #view-dashboard { padding: 26px 30px; }
  .metrics-grid { gap: 26px; grid-template-columns: repeat(6, 1fr); }
  .metric-card { padding: 30px 28px; gap: 20px; border-radius: 20px; }
  .metric-icon { width: 58px; height: 58px; font-size: 1.45rem; border-radius: 16px; }
  .metric-value { font-size: 2.1rem; }
  .metric-label { font-size: 0.88rem; }
  .dash-widget-grid { gap: 28px; }
  .dash-widget-header { padding: 22px 30px 18px; }
  .dash-widget-header h3 { font-size: 1.08rem; }
  .dash-widget-body { padding: 26px 30px 30px; }
  .funnel-bar { height: 44px; border-radius: 10px; }
  .funnel-stage-name { font-size: 0.92rem; width: 120px; }
  .deal-closing-item { padding: 16px 18px; border-radius: 14px; }
  .top-account-item { padding: 16px 18px; border-radius: 14px; }
  .leaderboard-item { padding: 14px 16px; }
}
@media (min-width: 2200px) {
  #view-dashboard { padding: 30px 36px; }
  .metrics-grid { gap: 30px; }
  .metric-card { padding: 34px 32px; border-radius: 22px; }
  .metric-icon { width: 66px; height: 66px; font-size: 1.6rem; border-radius: 18px; }
  .metric-value { font-size: 2.4rem; }
  .dash-widget-grid { gap: 32px; }
  .dash-widget { border-radius: 20px; }
  .dash-widget-body { padding: 30px 34px 34px; }
}

/* ===== WIDGET GRID — PREMIUM ===== */
.dash-widget-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.dash-widget {
  background: linear-gradient(160deg, #171b26, #111318);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}
.dash-widget:hover {
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.dash-widget-lg { grid-column: span 8; }
.dash-widget-md { grid-column: span 6; }
.dash-widget-sm { grid-column: span 4; }
.dash-widget-full { grid-column: 1 / -1; }

.dash-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  gap: 12px;
  flex-wrap: wrap;
}
.dash-widget-header h3 {
  font-size: 0.94rem;
  font-weight: 600;
  margin: 0;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.dash-widget-header h3 i {
  font-size: 0.88rem;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
/* Colored icon backgrounds per widget */
#widgetActivityChart .dash-widget-header h3 i { background: rgba(236,72,153,0.15); color: #ec4899; }
#widgetPipelineFunnel .dash-widget-header h3 i { background: rgba(6,182,212,0.15); color: #06B6D4; }
#widgetRevenueTrend .dash-widget-header h3 i { background: rgba(16,185,129,0.15); color: #10b981; }
#widgetDealsClosing .dash-widget-header h3 i { background: rgba(245,158,11,0.15); color: #f59e0b; }
#widgetTopAccounts .dash-widget-header h3 i { background: rgba(139,92,246,0.15); color: #8b5cf6; }
#widgetEmailPerf .dash-widget-header h3 i { background: rgba(59,130,246,0.15); color: #3b82f6; }
#widgetTasks .dash-widget-header h3 i { background: rgba(16,185,129,0.15); color: #10b981; }
#widgetLeaderboard .dash-widget-header h3 i { background: rgba(6,182,212,0.15); color: #06B6D4; }
#widgetActivityDonut .dash-widget-header h3 i { background: rgba(99,102,241,0.15); color: #6366f1; }
#widgetActivityFeed .dash-widget-header h3 i { background: rgba(139,92,246,0.15); color: #8b5cf6; }

.dash-widget-controls { display: flex; align-items: center; gap: 8px; }
.widget-menu-btn {
  background: none;
  border: none;
  color: #4b5563;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}
.widget-menu-btn:hover { color: #9ca3af; background: rgba(255,255,255,0.05); }

.dash-widget-body {
  padding: 18px 22px 22px;
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.dash-widget-body-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== CHIP FILTERS — COLORFUL ===== */
.activity-chart-filters { display: flex; gap: 5px; flex-wrap: wrap; }
.chip-filter {
  padding: 5px 12px;
  font-size: 0.73rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  background: rgba(255,255,255,0.03);
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}
.chip-filter:hover { background: rgba(255,255,255,0.06); color: #d1d5db; border-color: rgba(255,255,255,0.15); }
.chip-filter.active {
  background: rgba(6,182,212,0.12);
  border-color: rgba(6,182,212,0.4);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(6,182,212,0.1);
}
.chip-filter[data-type="email"].active { background: rgba(236,72,153,0.12); border-color: rgba(236,72,153,0.4); color: #f472b6; box-shadow: 0 0 12px rgba(236,72,153,0.1); }
.chip-filter[data-type="call"].active { background: rgba(139,92,246,0.12); border-color: rgba(139,92,246,0.4); color: #a78bfa; box-shadow: 0 0 12px rgba(139,92,246,0.1); }
.chip-filter[data-type="meeting"].active { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.4); color: #60a5fa; box-shadow: 0 0 12px rgba(59,130,246,0.1); }
.chip-filter[data-type="store_visit"].active { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.4); color: #34d399; box-shadow: 0 0 12px rgba(16,185,129,0.1); }
.chip-filter[data-type="facility_visit"].active { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.4); color: #fbbf24; box-shadow: 0 0 12px rgba(245,158,11,0.1); }
.chip-filter i { font-size: 0.7rem; }

/* ===== PIPELINE FUNNEL — PREMIUM ===== */
.funnel-container { display: flex; flex-direction: column; gap: 2px; }
.funnel-stage {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  position: relative;
}
.funnel-bar-wrap { flex: 1; display: flex; justify-content: center; }
.funnel-bar {
  height: 38px;
  border-radius: 8px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.funnel-bar:hover { box-shadow: 0 0 20px rgba(255,255,255,0.08); transform: scaleY(1.05); }
.funnel-bar-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  white-space: nowrap;
}
.funnel-stage-name {
  font-size: 0.84rem;
  color: #9ca3af;
  width: 95px;
  flex-shrink: 0;
  text-align: right;
  font-weight: 500;
}
.funnel-stage-value {
  font-size: 0.84rem;
  color: #6b7280;
  width: 85px;
  flex-shrink: 0;
  font-weight: 600;
}
.funnel-stage-count { font-size: 0.72rem; color: #4b5563; margin-left: 2px; }
.funnel-total {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.88rem;
  color: #9ca3af;
}
.funnel-total strong {
  color: #fbbf24;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  text-shadow: 0 0 20px rgba(6,182,212,0.3);
}

/* ===== DEALS CLOSING — PREMIUM ===== */
.deals-closing-list { display: flex; flex-direction: column; gap: 8px; }
.deal-closing-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.04);
  transition: all 0.2s;
  cursor: pointer;
}
.deal-closing-item:hover {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  transform: translateX(4px);
}
.deal-closing-date {
  font-size: 0.72rem;
  font-weight: 600;
  color: #9ca3af;
  background: rgba(255,255,255,0.05);
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  min-width: 72px;
  text-align: center;
}
.deal-closing-date.overdue {
  color: #f87171;
  background: rgba(239,68,68,0.1);
  box-shadow: 0 0 8px rgba(239,68,68,0.1);
}
.deal-closing-date.today {
  color: #fbbf24;
  background: rgba(6,182,212,0.1);
  box-shadow: 0 0 8px rgba(6,182,212,0.1);
}
.deal-closing-info { flex: 1; min-width: 0; }
.deal-closing-title {
  font-size: 0.88rem;
  color: #e5e7eb;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deal-closing-company {
  font-size: 0.76rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.deal-closing-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #34d399;
  white-space: nowrap;
  font-family: var(--font-heading);
}

/* ===== TOP ACCOUNTS — PREMIUM ===== */
.top-accounts-list { display: flex; flex-direction: column; gap: 6px; }
.top-account-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  background: rgba(255,255,255,0.02);
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}
.top-account-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}
.top-account-rank {
  font-size: 0.82rem;
  font-weight: 800;
  color: #4b5563;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.top-account-item:first-child .top-account-rank { color: #fbbf24; }
.top-account-item:nth-child(2) .top-account-rank { color: #94a3b8; }
.top-account-item:nth-child(3) .top-account-rank { color: #d97706; }
.top-account-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.top-account-info { flex: 1; min-width: 0; }
.top-account-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-account-meta {
  font-size: 0.73rem;
  color: #6b7280;
  margin-top: 2px;
}
.top-account-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fbbf24;
  flex-shrink: 0;
  font-family: var(--font-heading);
}

/* ===== EMAIL PERFORMANCE — PREMIUM ===== */
.email-perf-stats { display: flex; flex-direction: column; gap: 18px; }
.email-perf-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.email-perf-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: #d1d5db;
  font-weight: 500;
  min-width: 80px;
}
.email-perf-label i {
  font-size: 0.82rem;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
}
.email-perf-bar-wrap {
  flex: 1;
  margin: 0 16px;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.email-perf-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.email-perf-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  min-width: 44px;
  text-align: right;
  font-family: var(--font-heading);
}

/* ===== LEADERBOARD — PREMIUM ===== */
.leaderboard-list { display: flex; flex-direction: column; gap: 6px; }
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.leaderboard-item:hover { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
.leaderboard-rank {
  font-size: 1.1rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.leaderboard-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.leaderboard-info { flex: 1; min-width: 0; }
.leaderboard-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: #e5e7eb;
}
.leaderboard-score {
  font-size: 0.73rem;
  color: #6b7280;
  margin-top: 1px;
}
.leaderboard-badge {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(6,182,212,0.1);
  padding: 4px 12px;
  border-radius: 20px;
  font-family: var(--font-heading);
}

/* ===== CUSTOMIZE MODAL — PREMIUM ===== */
.dash-customize-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.dash-customize-content {
  background: linear-gradient(160deg, #1a1f2e, #111318);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 32px;
  max-width: 540px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.dash-customize-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.dash-customize-header h2 {
  font-size: 1.2rem;
  color: #f3f4f6;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-customize-header h2 i { color: var(--gold); }
.btn-close {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: 10px;
  transition: all 0.2s;
}
.btn-close:hover { color: #f3f4f6; background: rgba(255,255,255,0.1); }
.dash-customize-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 24px;
}
.dash-customize-section { margin-bottom: 24px; }
.dash-customize-section h4 {
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* Layout Options */
.layout-options { display: flex; gap: 10px; }
.layout-option {
  flex: 1;
  padding: 14px;
  text-align: center;
  background: rgba(255,255,255,0.03);
  border: 2px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.layout-option:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.05); }
.layout-option.active {
  border-color: rgba(6,182,212,0.5);
  color: #fbbf24;
  background: rgba(6,182,212,0.06);
  box-shadow: 0 0 16px rgba(6,182,212,0.08);
}
.layout-option i { font-size: 1.2rem; }

/* Widget Toggles */
.widget-toggles { display: flex; flex-direction: column; gap: 6px; }
.widget-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.widget-toggle:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.06); }
.widget-toggle-info { display: flex; align-items: center; gap: 12px; }
.widget-toggle-info i { color: var(--gold); font-size: 0.9rem; width: 20px; text-align: center; }
.widget-toggle-name { font-size: 0.88rem; color: #e5e7eb; font-weight: 500; }
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  transition: all 0.25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #6b7280;
  border-radius: 50%;
  transition: all 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, #06B6D4, #f59e0b);
  box-shadow: 0 0 12px rgba(6,182,212,0.3);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #1a1a1a;
}

.dash-customize-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  gap: 12px;
}

/* ===== LAYOUT VARIANTS ===== */
.dash-widget-grid.layout-compact .dash-widget { border-radius: 12px; }
.dash-widget-grid.layout-compact .dash-widget-header { padding: 12px 16px 10px; }
.dash-widget-grid.layout-compact .dash-widget-body { padding: 12px 16px 16px; }
.dash-widget-grid.layout-compact { gap: 14px; }

.dash-widget-grid.layout-focus .dash-widget-lg { grid-column: 1 / -1; }
.dash-widget-grid.layout-focus .dash-widget-md { grid-column: span 6; }
.dash-widget-grid.layout-focus .dash-widget-sm { grid-column: span 6; }

/* ===== RESPONSIVE DASHBOARD ===== */
@media (max-width: 1200px) {
  #view-dashboard { padding: 24px; }
  .dash-widget-lg { grid-column: 1 / -1; }
  .dash-widget-md { grid-column: span 6; }
  .dash-widget-sm { grid-column: span 6; }
}
@media (max-width: 900px) {
  #view-dashboard { padding: 16px; }
  .dash-widget-grid { gap: 14px; }
  .dash-widget-lg,
  .dash-widget-md,
  .dash-widget-sm { grid-column: 1 / -1; }
  .activity-chart-filters { display: none; }
  .dash-filters { width: 100%; }
  .dash-filters .select-input { flex: 1; min-width: 0; }
  .funnel-stage-name { width: 70px; font-size: 0.76rem; }
  .funnel-stage-value { width: 70px; font-size: 0.76rem; }
  .metrics-grid { gap: 12px; }
  .metric-card { padding: 18px 16px; gap: 14px; }
  .metric-value { font-size: 1.35rem; }
  .metric-icon { width: 42px; height: 42px; font-size: 1.05rem; }
}
@media (max-width: 600px) {
  #view-dashboard { padding: 14px 12px; }
  .dash-header-bar { gap: 10px; }
  .dash-header-bar h1 { font-size: 1.25rem; }
  .dash-filters { gap: 8px; }
  .dash-filters .select-input { font-size: 0.78rem; padding: 8px 28px 8px 10px; }
  .dash-custom-range { flex-wrap: wrap; }
  .dash-custom-range .form-input-sm { width: 120px; }
  .dash-widget-grid { gap: 12px; }
  .dash-widget { border-radius: 14px; }
  .dash-widget-header { padding: 14px 16px 10px; }
  .dash-widget-header h3 { font-size: 0.86rem; }
  .dash-widget-header h3 i { width: 24px; height: 24px; font-size: 0.75rem; border-radius: 6px; }
  .dash-widget-body { padding: 14px 16px 18px; }
  .chip-filter { padding: 4px 10px; font-size: 0.7rem; }
  .layout-options { flex-direction: column; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .metric-card { padding: 16px 14px; gap: 12px; border-radius: 14px; }
  .metric-card::before { height: 2px; }
  .metric-icon { width: 38px; height: 38px; font-size: 0.95rem; border-radius: 10px; }
  .metric-value { font-size: 1.2rem; }
  .metric-label { font-size: 0.7rem; letter-spacing: 0.3px; }
  .metric-trend { font-size: 0.66rem; padding: 1px 6px; }
  /* Funnel */
  .funnel-stage { gap: 8px; padding: 6px 0; }
  .funnel-stage-name { width: 60px; font-size: 0.72rem; }
  .funnel-bar { height: 30px; border-radius: 6px; }
  .funnel-bar-label { font-size: 0.7rem; }
  .funnel-stage-value { width: 60px; font-size: 0.72rem; }
  /* Deals/Accounts */
  .deal-closing-item { padding: 10px 12px; gap: 10px; border-radius: 10px; }
  .deal-closing-title { font-size: 0.82rem; }
  .deal-closing-value { font-size: 0.82rem; }
  .deal-closing-date { font-size: 0.68rem; min-width: 62px; padding: 4px 7px; border-radius: 6px; }
  .top-account-item { padding: 10px 12px; gap: 10px; border-radius: 10px; }
  .top-account-avatar { width: 32px; height: 32px; font-size: 0.72rem; border-radius: 10px; }
  .top-account-name { font-size: 0.82rem; }
  .top-account-value { font-size: 0.82rem; }
  /* Leaderboard */
  .leaderboard-item { padding: 8px 10px; gap: 10px; border-radius: 10px; }
  .leaderboard-avatar { width: 30px; height: 30px; font-size: 0.7rem; }
  .leaderboard-name { font-size: 0.82rem; }
  .leaderboard-badge { font-size: 0.78rem; padding: 3px 8px; }
  /* Email perf */
  .email-perf-stat { flex-wrap: wrap; gap: 8px; }
  .email-perf-bar-wrap { margin: 0; min-width: 100%; order: 3; height: 6px; }
  .email-perf-label { font-size: 0.82rem; }
  .email-perf-label i { width: 22px; height: 22px; font-size: 0.72rem; }
  .email-perf-value { font-size: 0.82rem; }
  /* Tasks */
  .task-mini-item { font-size: 0.82rem; }
  /* Modal */
  .dash-customize-content { padding: 22px; border-radius: 16px; }
  .dash-customize-content h2 { font-size: 1.05rem; }
  .widget-toggle { padding: 10px 12px; border-radius: 10px; }
  .dash-customize-footer { flex-direction: column; gap: 10px; }
  .dash-customize-footer .btn { width: 100%; justify-content: center; }
}
@media (max-width: 400px) {
  #view-dashboard { padding: 10px 8px; }
  .metrics-grid { grid-template-columns: 1fr; gap: 8px; }
  .metric-card { flex-direction: row; padding: 14px 12px; border-radius: 12px; }
  .dash-widget-header h3 i { display: none; }
  .dash-filters { flex-direction: column; align-items: stretch; }
  .dash-filters .select-input { width: 100%; }
  #dashCustomizeBtn { width: 100%; justify-content: center; }
}

.task-list-mini { display: flex; flex-direction: column; gap: 8px; }
.task-mini-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.task-mini-item:hover { background: var(--border); }
.task-mini-item .task-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
}
.task-mini-item .task-check.completed { background: var(--teal); border-color: var(--teal); }
.task-mini-item .task-title { flex: 1; font-size: 0.88rem; color: var(--text-primary); }
.task-mini-item .task-due { font-size: 0.75rem; color: var(--text-muted); }
.task-mini-item .task-due.overdue { color: #f87171; }
.task-mini-item .task-mini-actions { display: flex; gap: 4px; margin-left: 8px; opacity: 0; transition: opacity 0.15s; }
.task-mini-item:hover .task-mini-actions { opacity: 1; }
.task-mini-item .task-mini-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 6px; font-size: 0.82rem; border-radius: 4px; }
.task-mini-item .task-mini-actions button:hover { color: #4f8cff; background: var(--bg-tertiary); }
.task-mini-item .task-mini-actions button[title="Delete"]:hover { color: #ef4444; }

.activity-feed { display: flex; flex-direction: column; gap: 0; max-height: 600px; overflow-y: auto; }

/* Activity wrapper with expand/collapse */
.activity-item-wrapper {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  transition: background 0.15s;
}
.activity-item-wrapper:last-child { border-bottom: none; }
.activity-item-wrapper.expandable { cursor: pointer; }
.activity-item-wrapper.expandable:hover { background: rgba(255,255,255,0.02); }
.activity-item-wrapper.expanded { background: rgba(255,255,255,0.02); border-radius: 10px; margin-bottom: 4px; }
.activity-item-wrapper.expandable .activity-expand-arrow {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.activity-item-wrapper.expanded .activity-expand-arrow {
  transform: rotate(180deg);
  color: #06B6D4;
}

/* Expanded content */
.activity-expanded {
  display: none;
  margin: 0 0 14px 44px;
  padding: 0 12px 12px;
  animation: fadeIn 0.2s ease;
}
.activity-item-wrapper.expanded .activity-expanded {
  display: block;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}
.activity-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.activity-content { flex: 1; min-width: 0; }
.activity-text-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.activity-text { font-size: 0.86rem; color: var(--text-secondary); }
.activity-text strong { color: var(--text-primary); }
.activity-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.activity-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.activity-detail-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.act-link { font-size: 0.76rem; font-weight: 500; padding: 2px 8px; border-radius: 6px; text-decoration: none; transition: all 0.15s; white-space: nowrap; }
.act-link i { margin-right: 3px; font-size: 0.65rem; }
.act-link-contact { background: rgba(6,182,212,0.1); color: #06B6D4; }
.act-link-contact:hover { background: rgba(6,182,212,0.2); }
.act-link-company { background: rgba(59,130,246,0.1); color: #60a5fa; }
.act-link-company:hover { background: rgba(59,130,246,0.2); }
.act-link-email { background: rgba(236,72,153,0.1); color: #f472b6; font-size: 0.7rem; }
.act-link-email:hover { background: rgba(236,72,153,0.2); }
.act-link-deal { background: rgba(16,185,129,0.1); color: #34d399; font-size: 0.7rem; }
.act-link-deal:hover { background: rgba(16,185,129,0.2); }
.act-preview { font-size: 0.76rem; color: #9ca3af; max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-meta { font-size: 0.72rem; color: #6b7280; }
.act-meta.overdue { color: #f87171; }
.act-meta i { margin-right: 3px; font-size: 0.65rem; }
.act-tracking-badge { font-size: 0.68rem; color: #10b981; background: rgba(16,185,129,0.1); padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.act-tracking-badge i { margin: 0 2px 0 4px; font-size: 0.6rem; }
.act-tracking-badge i:first-child { margin-left: 0; }
.act-deal-badge { font-size: 0.72rem; font-weight: 600; color: #10b981; background: rgba(16,185,129,0.1); padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.act-body-snippet {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.45;
  margin-top: 5px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.02);
  border-left: 2px solid rgba(255,255,255,0.08);
  border-radius: 0 6px 6px 0;
  max-height: 42px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ===== ACTIVITY EXPANDED: EMAIL CARD ===== */
.activity-email-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.activity-email-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px 10px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}
.activity-email-meta { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; }
.activity-email-meta strong { color: var(--text-muted); font-weight: 500; }
.activity-email-date { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.activity-email-subject {
  padding: 12px 16px 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.activity-email-body {
  padding: 0 16px 14px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}
.activity-email-tracking {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.activity-email-tracking i { margin-right: 4px; }
.activity-email-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}
.activity-email-actions .btn { font-size: 0.78rem; }

/* ===== ACTIVITY EXPANDED: NOTE CARD ===== */
.activity-note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.activity-note-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 10px;
}
.activity-note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.activity-note-date { font-size: 0.75rem; color: var(--text-muted); }
.btn-danger-text { color: var(--danger) !important; }
.btn-danger-text:hover { background: rgba(239,68,68,0.1) !important; }

/* ===== ACTIVITY EXPANDED: TASK CARD ===== */
.activity-task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.activity-task-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.activity-task-checkbox {
  width: 20px; height: 20px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.65rem;
  transition: var(--transition);
}
.activity-task-checkbox:hover { border-color: var(--gold); }
.activity-task-checkbox.completed { background: var(--teal); border-color: var(--teal); color: white; }
.activity-task-title { flex: 1; font-weight: 600; font-size: 0.92rem; color: var(--text-primary); }
.activity-task-title.completed { text-decoration: line-through; opacity: 0.5; }
.activity-task-priority {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}
.activity-task-priority.priority-high { background: rgba(248,113,113,0.15); color: #f87171; }
.activity-task-priority.priority-medium { background: rgba(251,191,36,0.15); color: #fbbf24; }
.activity-task-priority.priority-low { background: rgba(52,211,153,0.15); color: #34d399; }
.activity-task-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 30px;
  line-height: 1.5;
}
.activity-task-meta {
  display: flex;
  gap: 14px;
  padding-left: 30px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.activity-task-meta i { margin-right: 4px; }
.activity-task-meta .overdue { color: #f87171; font-weight: 600; }
.activity-task-done { color: var(--teal); font-weight: 600; }
.activity-task-actions {
  display: flex;
  gap: 8px;
  padding-left: 30px;
}
.activity-task-actions .btn { font-size: 0.78rem; }

/* ===== ACTIVITY EXPANDED: DEAL/QUOTE CARD ===== */
.activity-deal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.activity-deal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.activity-deal-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
}

/* ===== DATA TABLE ===== */
.data-table-wrapper { overflow-x: auto; width: 100%; box-sizing: border-box; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.data-table thead th:hover { color: var(--gold); }
.data-table thead th i { margin-left: 4px; font-size: 0.7rem; }
.data-table thead th input[type="checkbox"] { cursor: pointer; }
.data-table tbody td {
  padding: 12px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.page-btn {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}
.page-btn:hover, .page-btn.active { border-color: var(--gold); color: var(--gold); }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.status-lead { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-prospect { background: rgba(139,92,246,0.15); color: #a78bfa; }
.status-customer { background: rgba(16,185,129,0.15); color: #34d399; }
.status-inactive { background: rgba(107,114,128,0.15); color: #9ca3af; }
.status-draft { background: rgba(107,114,128,0.15); color: #9ca3af; }
.status-sent { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-accepted { background: rgba(16,185,129,0.15); color: #34d399; }
.status-declined { background: rgba(217,0,0,0.15); color: #f87171; }
.status-expired { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-pending { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-processing { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-shipped { background: rgba(139,92,246,0.15); color: #a78bfa; }
.status-delivered { background: rgba(16,185,129,0.15); color: #34d399; }
.status-cancelled { background: rgba(217,0,0,0.15); color: #f87171; }
.status-approved { background: rgba(16,185,129,0.15); color: #34d399; }
.status-paid { background: rgba(16,185,129,0.2); color: #10b981; }
.status-lost { background: rgba(239,68,68,0.18); color: #f87171; font-weight: 700; letter-spacing: 0.3px; }
.status-scheduled { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* Table actions */
.table-actions { display: flex; gap: 6px; }
.table-actions button {
  width: 32px; height: 32px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.table-actions button:hover { border-color: var(--gold); color: var(--gold); }
.table-actions button.delete-btn:hover { border-color: #f87171; color: #f87171; }

/* Contact name in table */
.contact-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.contact-name-cell .mini-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bg-base);
  flex-shrink: 0;
}
.contact-name-cell a {
  color: var(--text-primary);
  font-weight: 500;
}
.contact-name-cell a:hover { color: var(--gold); }

/* ===== COMPANIES GRID ===== */
.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.company-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  cursor: pointer;
}
.company-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.company-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.company-card-avatar {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--green-mid), var(--green-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.company-card h3 { font-size: 1.05rem; margin-bottom: 2px; }
.company-card .industry-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
}
.company-card-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.company-card-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.company-card-meta .meta-item i { width: 16px; color: var(--text-muted); }
.company-card-stats {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.company-card-stats .stat { text-align: center; flex: 1; }
.company-card-stats .stat-val { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.company-card-stats .stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

/* ===== DETAIL VIEWS ===== */
.detail-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.profile-card { text-align: center; }
.profile-avatar, .company-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--bg-base);
  margin: 0 auto 16px;
  overflow: hidden;
  position: relative;
}
.profile-avatar img, .company-avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.company-avatar { border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--green-mid), var(--green-light)); }
.profile-card h2 { font-size: 1.3rem; margin-bottom: 4px; }
.profile-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; }
.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.profile-meta .meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.profile-meta .meta-row i { width: 16px; color: var(--gold); text-align: center; }

/* Tags */
.tags-container { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(6,182,212,0.1);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--gold);
}
.tag .remove-tag {
  cursor: pointer;
  font-size: 0.7rem;
  opacity: 0.6;
  transition: var(--transition);
}
.tag .remove-tag:hover { opacity: 1; }
.tag-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}
.tag-input:focus { border-color: var(--gold); }

/* Detail tabs */
.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-count { display: inline-block; background: var(--gold); color: #000; font-size: 0.65rem; font-weight: 700; padding: 1px 6px; border-radius: 8px; margin-left: 4px; vertical-align: middle; min-width: 16px; text-align: center; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Notes */
.note-composer { margin-bottom: 20px; }
.note-composer textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  min-height: 80px;
  resize: vertical;
  outline: none;
  margin-bottom: 8px;
}
.note-composer textarea:focus { border-color: var(--gold); }
.notes-list { display: flex; flex-direction: column; gap: 12px; }
.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.note-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.note-card-header .note-date { font-size: 0.78rem; color: var(--text-muted); }
.note-card-header .note-actions { display: flex; gap: 6px; }
.note-card-header .note-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition);
}
.note-card-header .note-actions button:hover { color: var(--gold); }
.note-card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; }

/* Documents */
.upload-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  transition: var(--transition);
  margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--gold); background: rgba(6,182,212,0.03); }
.upload-zone i { font-size: 2rem; color: var(--text-muted); margin-bottom: 12px; }
.upload-zone p { color: var(--text-muted); font-size: 0.9rem; }
.upload-link { color: var(--gold); cursor: pointer; }
.upload-link:hover { text-decoration: underline; }

.documents-list, .documents-grid { display: flex; flex-direction: column; gap: 8px; }
.documents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.doc-item:hover { border-color: var(--border-light); }
.doc-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(59,130,246,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-size: 1rem;
  flex-shrink: 0;
}
.doc-info { flex: 1; }
.doc-info .doc-name { font-size: 0.88rem; color: var(--text-primary); font-weight: 500; }
.doc-info .doc-meta { font-size: 0.75rem; color: var(--text-muted); }
.doc-actions { display: flex; gap: 6px; }
.doc-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}
.doc-actions button:hover { color: var(--gold); }

/* ===== PIPELINE BOARD ===== */
.pipeline-board {
  display: grid;
  /* 6 columns now (Lead, Qualified, Proposal, Negotiation, Closed Won, Closed Lost)
     after the Payee stage was retired in favor of Vendor POs. Each column gets
     ~16.6% of the available width instead of the old ~14.3%, filling the full
     monitor without dead trailing space. */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  height: calc(100vh - 180px);
  min-height: 420px;
  padding-bottom: 8px;
}
.pipeline-column {
  min-width: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pipeline-col-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.pipeline-col-header h3 { font-size: 0.85rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-count {
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
.stage-value { font-size: 0.75rem; color: var(--gold); font-weight: 600; }
.pipeline-col-header.won h3 { color: var(--teal); }
.pipeline-col-header.lost h3 { color: #f87171; }

.pipeline-cards {
  flex: 1 1 auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}
.pipeline-cards.drag-over { background: rgba(6,182,212,0.05); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.deal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.deal-card:hover { border-color: var(--gold); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.deal-card.dragging { opacity: 0.5; }
.deal-card h4 { font-size: 0.82rem; margin-bottom: 4px; line-height: 1.25; }
.deal-card .deal-value { font-size: 0.92rem; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.deal-card .deal-meta { font-size: 0.72rem; color: var(--text-muted); }
.deal-card .deal-contact {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== EMAILS ===== */
.email-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}
.email-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  flex: 1;
}
.email-stat i { font-size: 1.4rem; color: var(--gold); }
.email-stat span { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.email-stat label { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }

.email-date-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 4px;
  margin-top: 8px;
}
.email-date-header:first-child { margin-top: 0; }
.email-date-header span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.email-date-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Two-pane Gmail-style layout: list on the left, reading pane on the right.
   Reading pane scrolls independently. On narrow screens, falls back to a
   single column and the right pane is hidden — opening an email uses the
   modal viewer instead. */
/* Grid layout — explicit columns guarantee the reader pane fills all remaining
   width. Flexbox was leaving a gap on wide monitors because the reader pane
   was getting flex-basis from content. Grid with `1fr` for the reader column
   forces it to consume every remaining pixel. */
.email-split { display: grid; grid-template-columns: var(--email-list-width, 38%) 6px 1fr; align-items: stretch; min-height: 600px; width: 100% !important; }
.email-list-pane { min-width: 240px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 130px); overflow-y: auto; padding-right: 8px; }
.email-pane-resizer { align-self: stretch; cursor: col-resize; background: transparent; position: relative; transition: background 0.15s; user-select: none; max-height: calc(100vh - 130px); }
.email-pane-resizer::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border); transform: translateX(-50%); transition: background 0.15s, width 0.15s; }
.email-pane-resizer:hover::before, .email-pane-resizer.dragging::before { width: 3px; background: linear-gradient(180deg, #06B6D4, #8B5CF6); }
.email-pane-resizer.dragging { background: rgba(6,182,212,0.06); }
body.email-resizing { cursor: col-resize !important; user-select: none !important; }
body.email-resizing * { cursor: col-resize !important; user-select: none !important; }
.email-list-pane::-webkit-scrollbar { width: 8px; }
.email-list-pane::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgba(139,92,246,0.45), rgba(139,92,246,0.25)); border-radius: 4px; }
.email-reader-pane { min-width: 0; width: 100%; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; height: calc(100vh - 130px); max-height: calc(100vh - 130px); overflow-y: auto; }
.email-reader-pane::-webkit-scrollbar { width: 10px; }
.email-reader-pane::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgba(139,92,246,0.55), rgba(139,92,246,0.30)); border-radius: 5px; }
.email-reader-pane:hover::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #8B5CF6, #06B6D4); }
.email-reader-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 400px; padding: 40px; color: var(--text-muted); text-align: center; gap: 6px; }
.email-reader-empty i { font-size: 3.5rem; color: var(--purple); opacity: 0.35; margin-bottom: 6px; }
.email-reader-pane .email-viewer { padding: 0; margin: 0; }
.email-reader-pane .ev-nav-bar { position: sticky; top: 0; background: var(--bg-card); z-index: 5; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.email-item.email-selected { border-color: var(--gold) !important; background: linear-gradient(90deg, rgba(6,182,212,0.18), rgba(139,92,246,0.10)) !important; box-shadow: 0 0 0 1px rgba(6,182,212,0.3), 0 4px 14px rgba(6,182,212,0.12); }
.email-item.email-selected .email-subject { color: var(--text-primary) !important; font-weight: 600 !important; }
.email-item.email-selected::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, #06B6D4, #8B5CF6); border-radius: 3px 0 0 3px; }
@media (max-width: 1100px) {
  .email-split { flex-direction: column; }
  .email-list-pane { flex: none; max-width: 100%; max-height: none; overflow-y: visible; }
  .email-reader-pane { display: none; }
}

/* Compact list density — fit ~2x more rows per screen vs the old layout. */
.email-list-full { display: flex; flex-direction: column; gap: 3px; }
.email-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.email-item:hover { border-color: var(--border-light); background: var(--bg-card-hover, rgba(255,255,255,0.02)); }
.email-row-actions { display: flex; gap: 3px; opacity: 0; transition: opacity 0.15s; margin-right: 2px; }
.email-item:hover .email-row-actions { opacity: 1; }
.email-row-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text-secondary); cursor: pointer; font-size: 0.7rem; transition: all 0.15s; }
.email-row-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(6,182,212,0.1); }
.email-read-toggle { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: none; background: transparent; color: var(--text-muted); border-radius: 5px; cursor: pointer; font-size: 0.66rem; transition: all 0.15s; opacity: 0.4; }
.email-read-toggle:hover { background: rgba(255,255,255,0.08); color: var(--gold); opacity: 1; }
.email-item:hover .email-read-toggle { opacity: 0.7; }
.email-item.email-last-viewed { border-color: var(--gold); background: rgba(79,140,255,0.06); box-shadow: 0 0 0 1px rgba(79,140,255,0.2), 0 2px 8px rgba(79,140,255,0.08); position: relative; }
.email-item.email-last-viewed::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); border-radius: 3px 0 0 3px; }
.email-type-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  flex-shrink: 0;
}
.email-type-icon.sent { background: rgba(59,130,246,0.15); color: var(--blue); }
.email-type-icon.received { background: rgba(16,185,129,0.15); color: var(--teal); }
.email-type-icon.replied { background: rgba(139,92,246,0.15); color: var(--purple); }
.email-info { flex: 1; min-width: 0; }
.email-subject { font-size: 0.85rem; color: var(--text-primary); font-weight: 500; margin-bottom: 1px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-preview { font-size: 0.75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.email-contact-name { font-size: 0.82rem; color: var(--gold); }
.email-contact-inline { font-size: 0.82rem; }
.email-contact-inline strong { color: var(--text-primary); font-weight: 600; }
.email-company-tag { display: inline-block; font-size: 0.7rem; color: var(--gold); background: rgba(79,140,255,0.1); padding: 1px 7px; border-radius: 10px; margin: 0 4px; font-weight: 500; vertical-align: middle; }
.btn-add-crm { font-size: 0.72rem; color: var(--gold); background: transparent; border: 1px solid var(--gold); padding: 1px 8px; border-radius: 10px; cursor: pointer; white-space: nowrap; transition: all 0.2s; }
.btn-add-crm:hover { background: var(--gold); color: #000; }
.email-label { display: inline-block; font-size: 0.65rem; padding: 1px 7px; border-radius: 10px; margin-left: 8px; font-weight: 600; letter-spacing: 0.02em; vertical-align: middle; }
.email-label.new { background: var(--blue); color: #fff; animation: newEmailPulse 2s ease-in-out 3; }
@keyframes newEmailPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.email-label.read { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.email-label.draft { background: rgba(6,182,212,0.18); color: var(--gold); }
.email-label.sent { background: rgba(59,130,246,0.12); color: var(--blue); }
.email-label.delivered { background: rgba(34,197,94,0.14); color: #16a34a; }
.email-label.deferred { background: rgba(234,179,8,0.16); color: #a16207; }
.email-label.failed { background: rgba(239,68,68,0.14); color: #dc2626; }
.email-label.replied { background: linear-gradient(135deg, #8B5CF6, #06B6D4); color: #fff; padding: 2px 9px; font-weight: 700; box-shadow: 0 1px 4px rgba(139,92,246,0.35); }
.email-label i { margin-right: 3px; font-size: 0.55rem; }
.email-item.replied { background: rgba(139,92,246,0.06); border-left: 3px solid var(--purple); border-color: rgba(139,92,246,0.25); }
.email-item.replied:hover { border-color: rgba(139,92,246,0.45); background: rgba(139,92,246,0.1); }
.email-item.replied .email-subject { font-weight: 600; }
.email-item.replied .email-date { color: var(--purple); }
/* Received but read — dimmed so unread stands out next to it */
.email-item[class*="email-item"]:not(.unread):not(.replied):not(.sent-not-opened):not(.email-last-viewed) .email-subject { color: var(--text-muted); font-weight: 400; }
.email-item[class*="email-item"]:not(.unread):not(.replied):not(.sent-not-opened):not(.email-last-viewed) .email-type-icon.received { opacity: 0.5; }
.email-item[class*="email-item"]:not(.unread):not(.replied):not(.sent-not-opened):not(.email-last-viewed) .email-preview { opacity: 0.7; }

/* Unread — strong blue highlight, impossible to miss */
.email-item.unread {
  background: linear-gradient(90deg, rgba(79,140,255,0.22) 0%, rgba(79,140,255,0.14) 40%, rgba(79,140,255,0.08) 100%);
  border-left: 5px solid #4f8cff;
  border-color: rgba(79,140,255,0.55);
  box-shadow: 0 0 0 1px rgba(79,140,255,0.25), 0 2px 10px rgba(79,140,255,0.18);
  position: relative;
}
.email-item.unread::before {
  content: '';
  position: absolute;
  left: 14px; top: 50%;
  width: 10px; height: 10px;
  background: #4f8cff;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 8px rgba(79,140,255,0.8);
  animation: unreadDotPulse 2s ease-in-out infinite;
}
.email-item.unread { padding-left: 36px; }
@keyframes unreadDotPulse { 0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); } 50% { opacity: 0.6; transform: translateY(-50%) scale(1.3); } }
.email-item.unread:hover { border-color: rgba(79,140,255,0.75); background: linear-gradient(90deg, rgba(79,140,255,0.3) 0%, rgba(79,140,255,0.2) 40%, rgba(79,140,255,0.12) 100%); }
.email-item.unread .email-subject { font-weight: 800; color: #fff; font-size: 1rem; }
.email-item.unread .email-preview { color: var(--text-primary); opacity: 0.9; }
.email-item.unread .email-date { color: #4f8cff; font-weight: 700; }
.email-item.unread .email-type-icon.received { background: rgba(79,140,255,0.3); color: #4f8cff; box-shadow: 0 0 6px rgba(79,140,255,0.5); }
.email-date { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.email-tab-actions { display: flex; gap: 10px; }
/* Rich Text Editor */
.compose-editor-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-secondary); transition: border-color 0.2s; position: relative; }
.compose-editor-wrap:focus-within { border-color: var(--gold); }
.compose-editor-toolbar { display: flex; flex-direction: column; gap: 0; background: var(--bg-tertiary); border-bottom: 1px solid var(--border); }
.compose-editor-toolbar .toolbar-row { display: flex; align-items: center; gap: 2px; padding: 5px 10px; flex-wrap: wrap; }
.compose-editor-toolbar .toolbar-row-top { border-bottom: 1px solid rgba(255,255,255,0.04); }
.compose-editor-toolbar .toolbar-group { display: flex; align-items: center; gap: 1px; }
.compose-editor-toolbar .toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex-shrink: 0; }
.compose-editor-toolbar button { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: none; background: transparent; color: var(--text-secondary); border-radius: 5px; cursor: pointer; font-size: 0.8rem; transition: all 0.15s; position: relative; }
.compose-editor-toolbar button:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.compose-editor-toolbar button:active { background: rgba(255,255,255,0.15); }
.compose-editor-toolbar select { background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border); border-radius: 5px; padding: 4px 8px; font-size: 0.78rem; cursor: pointer; outline: none; height: 30px; }
.compose-editor-toolbar select:hover { border-color: var(--text-muted); color: var(--text-primary); }
.compose-editor-toolbar input[type="color"] { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 5px; cursor: pointer; background: transparent; padding: 1px; }
.toolbar-color-btn { position: relative; display: inline-flex; }
.toolbar-color-btn .color-indicator { display: block; width: 14px; height: 3px; border-radius: 1px; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); }
.compose-editor { min-height: 420px; padding: 14px 16px; font-size: 0.9rem; color: var(--text-primary); line-height: 1.7; outline: none; background: var(--bg-secondary); }
.compose-editor * { background-color: transparent !important; }
.compose-editor table, .compose-editor td, .compose-editor tr, .compose-editor th { background: transparent !important; color: inherit !important; border-color: var(--border) !important; }
.compose-editor img[src*="logo" i] { filter: brightness(1) contrast(1); }
.modal:has(.compose-email-form) { max-width: min(1100px, 95vw); max-height: 95vh; }
.compose-editor:empty::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }
.compose-editor a { color: var(--gold); }
.compose-editor ul, .compose-editor ol { padding-left: 24px; margin: 4px 0; }
.compose-editor img { max-width: 100%; border-radius: 6px; margin: 8px 0; }
.compose-editor hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.compose-editor-footer { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: var(--bg-tertiary); border-top: 1px solid var(--border); font-size: 0.72rem; color: var(--text-muted); }
.emoji-picker-popup { position: absolute; bottom: calc(100% - 60px); right: 10px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,0.4); max-width: 320px; }
.emoji-pick { font-size: 1.3rem; padding: 4px; cursor: pointer; border-radius: 6px; text-align: center; transition: background 0.1s; }
.emoji-pick:hover { background: rgba(255,255,255,0.1); }

.compose-signature-preview { margin-top: 6px; padding: 10px 14px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.compose-status { margin-top: 8px; font-size: 0.85rem; }
.compose-status code { background: var(--bg-tertiary); padding: 2px 8px; border-radius: 4px; font-size: 0.82rem; color: var(--gold); }

/* Add Contact from Email modal */
.ace-modal { }
.ace-source { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--bg-tertiary); border-radius: 8px; margin-bottom: 16px; font-size: 0.85rem; color: var(--text-secondary); }
.ace-section-title { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.ace-section-title i { font-size: 0.75rem; opacity: 0.6; }
.ace-warning { display: flex; gap: 12px; padding: 14px 16px; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); border-radius: 10px; margin-bottom: 16px; }
.ace-warning-icon { color: #ef4444; font-size: 1.2rem; flex-shrink: 0; padding-top: 2px; }
.ace-warning-body { flex: 1; font-size: 0.85rem; }
.ace-warning-body strong { color: #ef4444; }
.ace-warning-body p { color: var(--text-secondary); margin: 0; }
.ace-company-match { padding: 12px 14px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 10px; }
.ace-match-header { font-size: 0.82rem; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.ace-company-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; transition: background 0.15s; font-size: 0.85rem; }
.ace-company-option:hover { background: rgba(255,255,255,0.04); }
.ace-company-option input[type="radio"] { margin-top: 3px; accent-color: var(--gold); }
.ace-company-option strong { color: var(--text-primary); }
.email-item .sent-badge, .sent-badge { display: inline-block; font-size: 0.68rem; background: rgba(59,130,246,0.15); color: var(--blue); padding: 1px 6px; border-radius: 4px; margin-left: 6px; font-weight: 500; }
.sent-badge.gmail { background: rgba(234,67,53,0.12); color: #ea4335; }
.tracking-badge { display: inline-block; font-size: 0.68rem; padding: 1px 6px; border-radius: 4px; margin-left: 6px; font-weight: 500; }
.tracking-badge.opened { background: rgba(16,185,129,0.15); color: var(--teal); }
.tracking-badge.not-opened { background: rgba(239,68,68,0.15); color: #ef4444; }
.tracking-badge.clicked { background: rgba(6,182,212,0.15); color: var(--gold); }
.tracking-badge i { margin-right: 2px; font-size: 0.65rem; }
.email-item.sent-not-opened { background: rgba(239,68,68,0.06); border-left: 3px solid #ef4444; border-color: rgba(239,68,68,0.25); }
.email-item.sent-not-opened:hover { border-color: rgba(239,68,68,0.45); background: rgba(239,68,68,0.1); }
.email-item.sent-not-opened .email-subject { font-weight: 600; }
.email-item.sent-not-opened .email-date { color: #ef4444; }

/* Partner Tiers */
.partner-tiers-panel { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; }
.partner-tiers-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.partner-tiers-header h3 { font-size: 0.92rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.partner-tiers-header h3 i { color: var(--gold); margin-right: 8px; }
.partner-tiers-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.partner-tier-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg-tertiary); border: 1px solid var(--border); border-left: 3px solid; border-radius: var(--radius); padding: 10px 14px; min-width: 180px; flex: 1; }
.tier-card-header { display: flex; align-items: center; gap: 8px; }
.tier-card-header i { font-size: 0.9rem; }
.tier-name { font-weight: 600; font-size: 0.88rem; color: var(--text-primary); }
.tier-multiplier { font-size: 0.78rem; font-weight: 600; margin-left: auto; }
.tier-card-actions { display: flex; gap: 4px; }
.tier-card-actions .btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 6px; border-radius: 4px; font-size: 0.75rem; transition: all 0.2s; }
.tier-card-actions .btn-icon:hover { color: var(--gold); background: rgba(6,182,212,0.1); }
.tier-card-actions .btn-icon.delete:hover { color: var(--red); background: rgba(239,68,68,0.1); }
.btn.btn-sm.btn-outline { font-size: 0.78rem; padding: 4px 12px; }

/* Tier pricing preview in product form */
.tier-pricing-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.tier-price-item { display: flex; align-items: center; justify-content: space-between; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; min-width: 140px; flex: 1; }
.tier-price-label { font-size: 0.78rem; font-weight: 600; }
.tier-price-label i { margin-right: 4px; }
.tier-price-value { font-family: var(--font-heading); font-weight: 600; font-size: 0.88rem; color: var(--text-primary); }
.product-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.product-table-scroll table { min-width: 900px; }

/* Brand group headers */
.brand-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; margin-top: 16px;
  background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(41,81,0,0.08));
  border: 1px solid rgba(6,182,212,0.15); border-radius: 10px;
  cursor: pointer; user-select: none; transition: all 0.15s;
}
.brand-group-header:first-child { margin-top: 0; }
.brand-group-header:hover { background: linear-gradient(135deg, rgba(6,182,212,0.12), rgba(41,81,0,0.12)); }
.brand-group-header .brand-group-left {
  display: flex; align-items: center; gap: 10px;
}
.brand-group-header .brand-group-name {
  font-size: 1rem; font-weight: 700; color: var(--text-primary);
}
.brand-group-header .brand-group-count {
  font-size: 0.78rem; color: var(--text-muted); background: rgba(255,255,255,0.06);
  padding: 2px 10px; border-radius: 20px;
}
.brand-group-header .brand-group-chevron {
  color: var(--text-muted); font-size: 0.75rem; transition: transform 0.2s;
}
.brand-group-header.collapsed .brand-group-chevron { transform: rotate(-90deg); }
.brand-group-table { margin-bottom: 8px; }
.brand-group-table.hidden { display: none; }
#productGroupByBrandBtn.active {
  background: rgba(6,182,212,0.15); border-color: var(--gold); color: var(--gold);
}

/* Quote product search dropdown */
.qi-product-dropdown { display: none; position: absolute; top: 100%; left: 0; z-index: 999; min-width: 100%; width: max-content; max-width: 680px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); max-height: 360px; overflow-y: auto; overflow-x: hidden; margin-top: 2px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.qi-product-dropdown.open { display: block; }
.qi-product-option { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; cursor: pointer; transition: background 0.15s; font-size: 0.84rem; }
.qi-product-option:hover { background: rgba(6,182,212,0.1); }
.qi-po-name { color: var(--text-primary); font-weight: 500; flex: 1; white-space: normal; overflow-wrap: anywhere; word-break: break-word; line-height: 1.35; }
.qi-po-sku { color: var(--text-muted); font-size: 0.75rem; font-family: monospace; white-space: nowrap; flex-shrink: 0; }
.qi-po-price { color: var(--gold); font-size: 0.78rem; font-weight: 600; margin-left: auto; white-space: nowrap; flex-shrink: 0; }
.qi-product-new { color: var(--gold); font-weight: 600; border-top: 1px solid var(--border); }
.qi-product-new:hover { background: rgba(6,182,212,0.15); }
.qi-product-empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 0.82rem; }

/* Calendar Picker */
.calendar-picker-wrap { position: relative; }
.calendar-input { cursor: pointer; padding-right: 36px !important; }
.calendar-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); cursor: pointer; font-size: 0.88rem; transition: color 0.2s; }
.calendar-icon:hover { color: var(--gold); }
.calendar-dropdown { display: none; position: absolute; top: 100%; left: 0; z-index: 1000; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; width: 240px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); margin-top: 4px; }
.calendar-dropdown.open { display: block; }
.calendar-dropdown .cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.calendar-dropdown .cal-header span { font-weight: 600; font-size: 0.82rem; color: var(--text-primary); }
.calendar-dropdown .cal-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 6px; border-radius: 4px; font-size: 0.72rem; min-height: 0; transition: all 0.2s; }
.calendar-dropdown .cal-header button:hover { color: var(--gold); background: rgba(6,182,212,0.1); }
.calendar-dropdown .cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin-bottom: 2px; }
.calendar-dropdown .cal-weekdays div { font-size: 0.62rem; color: var(--text-muted); font-weight: 600; padding: 2px 0; }
.calendar-dropdown .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
/* Override the larger event-calendar .cal-day (defined later in this file)
   by scoping these rules to .calendar-dropdown so the date picker stays
   compact. min-height:0 unwinds the 90px set by the campaign calendar. */
.calendar-dropdown .cal-day { min-height: 0; text-align: center; padding: 4px 0; font-size: 0.78rem; color: var(--text-primary); cursor: pointer; border-radius: 4px; transition: all 0.15s; background: transparent; border: none; }
.calendar-dropdown .cal-day:hover { background: rgba(6,182,212,0.15); color: var(--gold); border-color: transparent; }
.calendar-dropdown .cal-day.empty { cursor: default; }
.calendar-dropdown .cal-day.empty:hover { background: none; }
.calendar-dropdown .cal-day.selected { background: var(--gold); color: #000; font-weight: 700; }
.calendar-dropdown .cal-day.today { border: 1px solid var(--gold); background: transparent; }
.calendar-dropdown .cal-day.today.selected { border-color: transparent; }
.calendar-dropdown .cal-footer { display: flex; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.calendar-dropdown .cal-today-btn, .calendar-dropdown .cal-clear-btn { background: none; border: 1px solid var(--border); color: var(--text-muted); font-size: 0.7rem; padding: 3px 8px; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.calendar-dropdown .cal-today-btn:hover { border-color: var(--gold); color: var(--gold); }
.calendar-dropdown .cal-clear-btn:hover { border-color: var(--red); color: var(--red); }

/* ===== AGENTS / TEAM ===== */
.agent-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--bg-card); }
.agent-row:hover { border-color: var(--border-light); }
.agent-row .mini-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.82rem; flex-shrink: 0; }
.agent-row .agent-info { flex: 1; }
.agent-row .agent-info h4 { font-size: 0.9rem; color: var(--text-primary); margin: 0; }
.agent-row .agent-info p { font-size: 0.78rem; color: var(--text-muted); margin: 2px 0 0; }
.agent-row .agent-role { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.agent-role.admin { background: rgba(6,182,212,0.15); color: var(--gold); }
.agent-role.agent { background: rgba(59,130,246,0.15); color: var(--blue); }
.agent-role.viewer { background: var(--bg-tertiary); color: var(--text-muted); }
.agent-role.consultant { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.agent-role.reseller { background: rgba(16,185,129,0.15); color: #10b981; }
.agent-role.facility { background: rgba(6,182,212,0.15); color: #06b6d4; }
.agent-role.marketing { background: rgba(236,72,153,0.15); color: #ec4899; }
.agent-switcher-dropdown { position: fixed; top: 56px; right: 16px; min-width: 220px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 0; box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 200; display: none; }

/* Notifications Dropdown */
.notifications-dropdown { position: fixed; top: 56px; right: 16px; width: 360px; max-height: 520px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(0,0,0,0.35); z-index: 200; display: none; }
.notifications-dropdown.active { display: block; }
.notifications-dropdown .nd-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
.notifications-dropdown .nd-header h4 { margin: 0; font-size: 0.95rem; color: var(--text-primary); }
.notifications-dropdown .nd-header button { font-size: 0.72rem; padding: 3px 10px; background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 6px; cursor: pointer; }
.notifications-dropdown .nd-header button:hover { color: #4f8cff; border-color: #4f8cff; }
.notifications-dropdown .nd-section { padding: 8px 10px 6px; }
.notifications-dropdown .nd-section-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: 6px 8px 4px; }
.notifications-dropdown .nd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 2px; border-radius: 8px; cursor: pointer; transition: background 0.12s; }
.notifications-dropdown .nd-item:hover { background: var(--bg-tertiary); }
.notifications-dropdown .nd-item .nd-icon { width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.82rem; }
.notifications-dropdown .nd-item .nd-body { flex: 1; min-width: 0; }
.notifications-dropdown .nd-item .nd-title { font-size: 0.85rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notifications-dropdown .nd-item .nd-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notifications-dropdown .nd-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 0.86rem; }
.notifications-dropdown .nd-footer { padding: 10px 14px; border-top: 1px solid var(--border); text-align: center; position: sticky; bottom: 0; background: var(--bg-card); }
.notifications-dropdown .nd-footer a { color: #4f8cff; font-size: 0.82rem; text-decoration: none; cursor: pointer; }
.notifications-dropdown .nd-footer a:hover { text-decoration: underline; }
.agent-switcher-dropdown.active { display: block; }
.agent-switcher-dropdown .agent-option { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; transition: background 0.15s; }
.agent-switcher-dropdown .agent-option:hover { background: var(--bg-tertiary); }
.agent-switcher-dropdown .agent-option.current { background: rgba(6,182,212,0.08); }
.agent-switcher-dropdown .agent-option .mini-avatar { width: 30px; height: 30px; font-size: 0.72rem; }
.agent-switcher-dropdown .agent-option span { font-size: 0.85rem; color: var(--text-primary); }
.agent-switcher-dropdown .agent-option small { font-size: 0.72rem; color: var(--text-muted); }

/* ===== EMAIL TEMPLATES ===== */
.templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.template-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; overflow: hidden; cursor: pointer; transition: border-color 0.2s, transform 0.2s; }
.template-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.template-card-header { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.template-card-header h3 { font-size: 0.95rem; color: var(--text-primary); margin: 0 0 4px; }
.template-card-category { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.template-card-category.sales { background: rgba(59,130,246,0.15); color: var(--blue); }
.template-card-category.follow-up { background: rgba(139,92,246,0.15); color: var(--purple); }
.template-card-category.onboarding { background: rgba(16,185,129,0.15); color: var(--teal); }
.template-card-category.marketing { background: rgba(236,72,153,0.15); color: #ec4899; }
.template-card-category.support { background: rgba(245,158,11,0.15); color: #f59e0b; }
.template-card-category.announcement { background: rgba(6,182,212,0.15); color: var(--gold); }
.template-card-category.other { background: var(--bg-tertiary); color: var(--text-muted); }
.template-card-subject { padding: 12px 20px 0; font-size: 0.85rem; color: var(--text-secondary); }
.template-card-subject strong { color: var(--text-primary); font-weight: 500; }
.template-card-preview { padding: 10px 20px; font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; max-height: 60px; overflow: hidden; }
.template-card-footer { padding: 10px 20px 14px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); }
.template-card-footer .template-date { font-size: 0.75rem; color: var(--text-muted); }
.template-card-footer .template-actions { display: flex; gap: 6px; }
.template-card-footer .template-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 6px; border-radius: 4px; font-size: 0.8rem; }
.template-card-footer .template-actions button:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.template-picker-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.template-picker-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.template-picker-item:last-child { border-bottom: none; }
.template-picker-item:hover { background: var(--bg-tertiary); }
.template-picker-item h4 { font-size: 0.88rem; color: var(--text-primary); margin: 0 0 2px; }
.template-picker-item p { font-size: 0.78rem; color: var(--text-muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== PRODUCTS ===== */
/* ===== PRODUCTS — LIST VIEW FOR AGENTS ===== */
.product-list-wrap {
  background: linear-gradient(160deg, #171b26, #111318);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
}
.product-list-table {
  width: 100%;
  border-collapse: collapse;
}
.product-list-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.product-list-table thead th.sortable { cursor: pointer; user-select: none; }
.product-list-table thead th.sortable:hover { color: #9ca3af; }
.product-list-table thead th .sort-icon { margin-left: 4px; font-size: 0.65rem; opacity: 0.5; }
.product-list-table thead th.sorted .sort-icon { opacity: 1; color: var(--gold); }
.product-list-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.product-list-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.product-list-table tbody td {
  padding: 11px 16px;
  font-size: 0.86rem;
  color: #d1d5db;
  vertical-align: middle;
}
.product-list-table tbody tr:last-child { border-bottom: none; }

/* Product name cell */
.pl-name {
  font-weight: 500;
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pl-name-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-desc { font-size: 0.73rem; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sku { font-size: 0.78rem; color: #6b7280; font-family: monospace; white-space: nowrap; }

/* Category & Brand pills */
.pl-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}
.pl-brand {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.pl-brand-flexstar { background: rgba(59,130,246,0.12); color: #60a5fa; }
.pl-brand-matrix { background: rgba(139,92,246,0.12); color: #a78bfa; }
.pl-brand-other { background: rgba(107,114,128,0.12); color: #9ca3af; }

/* Price cells */
.pl-price {
  font-family: var(--font-heading);
  font-weight: 700;
  white-space: nowrap;
}
.pl-cost { color: #34d399; }
.pl-msrp { color: #9ca3af; }
.pl-margin { font-size: 0.78rem; font-weight: 600; }
.pl-margin-good { color: #34d399; }
.pl-margin-low { color: #f59e0b; }
.pl-margin-neg { color: #f87171; }

/* Tax category */
.pl-tax {
  font-size: 0.78rem;
  color: #9ca3af;
  padding: 3px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  white-space: nowrap;
}

/* Actions */
.pl-actions { display: flex; gap: 6px; }
.pl-actions .btn { padding: 5px 10px; font-size: 0.75rem; }

/* Group headers */
.pl-group-row td {
  padding: 10px 16px 6px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  color: var(--gold) !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(6,182,212,0.04) !important;
  border-bottom: 1px solid rgba(6,182,212,0.1) !important;
}

/* Responsive list */
@media (max-width: 900px) {
  .product-list-table thead { display: none; }
  .product-list-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 12px 16px;
    align-items: center;
  }
  .product-list-table tbody td { padding: 0; border: none; }
  .product-list-table tbody td:first-child { flex: 1 1 100%; }
  .pl-name-text { max-width: none; }
  .pl-desc { max-width: none; }
  .pl-actions { margin-left: auto; }
}
@media (max-width: 600px) {
  .product-list-wrap { border-radius: 12px; }
  .product-list-table tbody td { font-size: 0.82rem; }
  .pl-name-text { font-size: 0.84rem; }
}

/* ===== QUOTES ===== */
.quotes-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.qtab-content { display: none; }
.qtab-content.active { display: block; }

.quote-builder { max-width: 100%; }
/* Read-only state: disabled inputs already block typing; this fades them
   slightly so the lock is obvious at a glance, and keeps cursor as default
   instead of text-input. */
.quote-builder-readonly .quote-builder input:disabled,
.quote-builder-readonly .quote-builder textarea:disabled,
.quote-builder-readonly .quote-builder select:disabled {
  opacity: 0.78;
  cursor: default;
  background: rgba(255,255,255,0.02);
}
.quote-builder-readonly .quote-builder { position: relative; }
.quote-builder-readonly .quote-builder::before {
  content: "Saved — click Edit to modify";
  position: sticky; top: 8px; z-index: 5;
  display: block; margin: 0 0 12px;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(6,182,212,0.12); color: var(--gold);
  border: 1px solid rgba(6,182,212,0.3);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.3px;
  width: fit-content;
}
.quote-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* Quote recipient tags */
.quote-recipient-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(6,182,212,0.12); border: 1px solid rgba(6,182,212,0.25);
  border-radius: 6px; padding: 3px 8px 3px 10px; font-size: 0.82rem; color: var(--text-primary);
  white-space: nowrap; max-width: 260px;
}
.quote-recipient-tag .tag-email { color: var(--text-muted); font-size: 0.78rem; }
.quote-recipient-tag .tag-remove {
  cursor: pointer; color: var(--text-muted); font-size: 0.7rem; padding: 2px 4px;
  border-radius: 4px; transition: all 0.15s;
}
.quote-recipient-tag .tag-remove:hover { color: #f87171; background: rgba(248,113,113,0.12); }
.quote-recipient-dd-item {
  padding: 8px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 1px;
  border-bottom: 1px solid rgba(255,255,255,0.04); transition: background 0.1s;
}
.quote-recipient-dd-item:last-child { border-bottom: none; }
.quote-recipient-dd-item:hover, .quote-recipient-dd-item.active { background: rgba(6,182,212,0.1); }
.quote-recipient-dd-item .dd-name { font-size: 0.88rem; color: var(--text-primary); }
.quote-recipient-dd-item .dd-email { font-size: 0.78rem; color: var(--text-muted); }
.quote-recipient-dd-item .dd-company { font-size: 0.75rem; color: var(--gold); }
.quote-items-table { margin-bottom: 16px; overflow: visible !important; }
.quote-items-table tbody { overflow: visible; }
.quote-items-table td { overflow: visible !important; position: relative; }
.quote-items-table select, .quote-items-table input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 0.85rem;
  outline: none;
}
.quote-items-table select:focus, .quote-items-table input:focus { border-color: var(--gold); }
.quote-items-table .remove-item {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}
.quote-items-table .remove-item:hover { color: #f87171; }

.quote-totals {
  max-width: 350px;
  margin-left: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.total-row.grand {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
}

/* ===== CAMPAIGNS ===== */
.camp-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.camp-kpi { background: linear-gradient(145deg, #1a1f2e, #141418); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 16px; position: relative; overflow: hidden; }
.camp-kpi::before { content:''; position:absolute; top:0;left:0;right:0; height:3px; border-radius:12px 12px 0 0; }
.camp-kpi[data-color="gold"]::before { background:#06B6D4; }
.camp-kpi[data-color="blue"]::before { background:#3b82f6; }
.camp-kpi[data-color="teal"]::before { background:#10b981; }
.camp-kpi[data-color="pink"]::before { background:#ec4899; }
.camp-kpi[data-color="purple"]::before { background:#8b5cf6; }
.camp-kpi .kpi-val { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 700; color: #fff; }
.camp-kpi .kpi-label { font-size: 0.7rem; color: #7a7f8e; text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }

.camp-tab-content, .social-tab-content { display: none; }
.camp-tab-content.active, .social-tab-content.active { display: block; animation: fadeIn 0.3s ease; }
.camp-tab, .social-tab { padding: 10px 20px; border: none; background: transparent; color: #7a7f8e; font-size: 0.85rem; font-weight: 500; border-radius: 10px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.camp-tab:hover, .social-tab:hover { color: #d1d5db; background: rgba(255,255,255,0.04); }
.camp-tab.active { background: rgba(6,182,212,0.12); color: #06B6D4; font-weight: 600; }
.social-tab.active { background: rgba(236,72,153,0.12); color: #ec4899; font-weight: 600; }

.campaigns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.campaign-card {
  background: linear-gradient(160deg, #171b26, #111318);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 22px;
  transition: all 0.25s;
}
.campaign-card:hover { border-color: rgba(255,255,255,0.12); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.campaign-card h3 { font-size: 1.02rem; margin-bottom: 6px; color: #e5e7eb; }
.campaign-card .campaign-type { display: inline-block; padding: 3px 10px; font-size: 0.7rem; border-radius: 10px; text-transform: capitalize; margin-bottom: 10px; font-weight: 600; }
.campaign-card .campaign-type.email { background: rgba(236,72,153,0.15); color: #ec4899; }
.campaign-card .campaign-type.sms { background: rgba(16,185,129,0.15); color: #10b981; }
.campaign-card .campaign-type.multi { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.campaign-card .campaign-type.social { background: rgba(59,130,246,0.15); color: #3b82f6; }
.campaign-card .campaign-type.drip { background: rgba(245,158,11,0.15); color: #f59e0b; }
.campaign-card .campaign-channels { display: flex; gap: 6px; margin: 8px 0; }
.campaign-card .campaign-channels i { font-size: 0.78rem; padding: 4px 8px; border-radius: 6px; background: rgba(255,255,255,0.04); color: #9ca3af; }
.campaign-stats { display: flex; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.06); }
.campaign-stats .cstat { text-align: center; flex: 1; }
.campaign-stats .cstat-val { font-family: var(--font-heading); font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.campaign-stats .cstat-label { font-size: 0.68rem; color: var(--text-muted); }

/* Campaign Calendar */
.camp-calendar-header, .social-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.camp-calendar-header h3, .social-cal-header h3 { font-size: 1.1rem; color: #e5e7eb; }
.camp-calendar-grid, .social-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-header { text-align: center; font-size: 0.72rem; color: #6b7280; padding: 8px 0; font-weight: 600; text-transform: uppercase; }
.cal-day {
  min-height: 90px; padding: 6px 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.cal-day:hover { border-color: rgba(6,182,212,0.3); }
.cal-day.today { border-color: rgba(6,182,212,0.5); background: rgba(6,182,212,0.04); }
.cal-day.other-month { opacity: 0.3; }
.cal-day .day-num { font-weight: 600; color: #9ca3af; margin-bottom: 4px; }
.cal-day .cal-event { padding: 2px 5px; border-radius: 4px; font-size: 0.65rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-event.email { background: rgba(236,72,153,0.2); color: #f472b6; }
.cal-event.sms { background: rgba(16,185,129,0.2); color: #34d399; }
.cal-event.social { background: rgba(59,130,246,0.2); color: #60a5fa; }
.cal-event.multi { background: rgba(139,92,246,0.2); color: #a78bfa; }

/* Campaign Templates */
.camp-templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.camp-template-card {
  background: linear-gradient(160deg, #171b26, #111318);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.camp-template-card:hover { border-color: rgba(6,182,212,0.3); transform: translateY(-2px); }
.camp-template-card h4 { font-size: 0.92rem; margin-bottom: 6px; color: #e5e7eb; }
.camp-template-card p { font-size: 0.78rem; color: #7a7f8e; margin-bottom: 10px; }
.camp-template-card .template-channels { display: flex; gap: 6px; }
.camp-template-card .template-channels span { font-size: 0.68rem; padding: 2px 8px; border-radius: 8px; }

/* ===== SOCIAL MEDIA ===== */
.social-accounts-row { display: flex; gap: 12px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 4px; }
.social-account-card {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(145deg, #1a1f2e, #141418);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 220px;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.social-account-card:hover { border-color: rgba(255,255,255,0.12); }
.social-account-card.linked { border-left: 3px solid; }
.social-account-card.not-linked { opacity: 0.5; }
.social-account-card i { font-size: 1.4rem; }
.social-account-card .sa-info { flex: 1; }
.social-account-card .sa-name { font-size: 0.82rem; font-weight: 600; color: #e5e7eb; }
.social-account-card .sa-handle { font-size: 0.72rem; color: #7a7f8e; }
.social-account-card .sa-status { font-size: 0.65rem; padding: 2px 8px; border-radius: 8px; }

.social-filter-bar { display: flex; gap: 10px; margin-bottom: 14px; }

.posts-list { display: flex; flex-direction: column; gap: 10px; }
.post-item {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: linear-gradient(160deg, #171b26, #111318);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  transition: border-color 0.2s;
}
.post-item:hover { border-color: rgba(255,255,255,0.12); }
.post-platform { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.post-info { flex: 1; }
.post-info h4 { font-size: 0.9rem; margin-bottom: 4px; color: #e5e7eb; }
.post-info p { font-size: 0.8rem; color: #7a7f8e; }
.post-info .post-platforms { display: flex; gap: 4px; margin-top: 4px; }
.post-info .post-platforms i { font-size: 0.72rem; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.04); }
.post-schedule { text-align: right; flex-shrink: 0; }
.post-schedule .post-date { font-size: 0.82rem; color: var(--gold); }
.post-schedule .post-time { font-size: 0.75rem; color: var(--text-muted); }

#postTemplates .templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
#postTemplates .template-card {
  background: linear-gradient(160deg, #171b26, #111318);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
#postTemplates .template-card:hover { border-color: rgba(6,182,212,0.3); transform: translateY(-2px); }
#postTemplates .template-card i { font-size: 1.5rem; margin-bottom: 10px; display: block; }
#postTemplates .template-card h4 { font-size: 0.92rem; margin-bottom: 4px; color: #e5e7eb; }
#postTemplates .template-card p { font-size: 0.78rem; color: #7a7f8e; }

/* ===== ANALYTICS ===== */
.analytics-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.analytics-kpi {
  background: linear-gradient(145deg, #1a1f2e, #141418);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 18px 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.analytics-kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.3); }
.analytics-kpi::before { content:''; position:absolute; top:0;left:0;right:0; height:3px; border-radius:14px 14px 0 0; }
.analytics-kpi[data-color="gold"]::before { background:linear-gradient(90deg,#06B6D4,#5dd5ec); }
.analytics-kpi[data-color="blue"]::before { background:linear-gradient(90deg,#3b82f6,#60a5fa); }
.analytics-kpi[data-color="teal"]::before { background:linear-gradient(90deg,#10b981,#34d399); }
.analytics-kpi[data-color="purple"]::before { background:linear-gradient(90deg,#8b5cf6,#a78bfa); }
.analytics-kpi[data-color="pink"]::before { background:linear-gradient(90deg,#ec4899,#f472b6); }
.analytics-kpi[data-color="amber"]::before { background:linear-gradient(90deg,#f59e0b,#fbbf24); }
.analytics-kpi[data-color="red"]::before { background:linear-gradient(90deg,#ef4444,#f87171); }
.analytics-kpi[data-color="green"]::before { background:linear-gradient(90deg,#22c55e,#4ade80); }
.analytics-kpi .kpi-val { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: #fff; line-height: 1.1; }
.analytics-kpi .kpi-label { font-size: 0.72rem; color: #7a7f8e; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.analytics-kpi .kpi-trend { font-size: 0.7rem; margin-top: 4px; }
.analytics-kpi .kpi-trend.up { color: #34d399; }
.analytics-kpi .kpi-trend.down { color: #f87171; }
.analytics-kpi .kpi-trend.flat { color: #6b7280; }

.analytics-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 4px;
  overflow-x: auto;
}
.analytics-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: #7a7f8e;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.analytics-tab:hover { color: #d1d5db; background: rgba(255,255,255,0.04); }
.analytics-tab.active { background: rgba(6,182,212,0.12); color: #06B6D4; font-weight: 600; box-shadow: 0 0 12px rgba(6,182,212,0.08); }

.analytics-tab-content { display: none; }
.analytics-tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.analytics-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.analytics-grid-3 .span-2 { grid-column: span 2; }
.analytics-grid-3 .span-3 { grid-column: span 3; }

.analytics-card {
  background: linear-gradient(160deg, #171b26, #111318);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 22px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.analytics-card:hover { border-color: rgba(255,255,255,0.1); box-shadow: 0 4px 24px rgba(0,0,0,0.2); }
.analytics-card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.analytics-card h3 i { font-size: 0.85rem; }
.chart-container { min-height: 200px; }

/* Horizontal bar chart for analytics */
.a-hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.a-hbar-label { font-size: 0.78rem; color: #d1d5db; width: 90px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-hbar-track { flex: 1; height: 26px; background: rgba(255,255,255,0.04); border-radius: 6px; overflow: hidden; position: relative; }
.a-hbar-fill { height: 100%; border-radius: 6px; transition: width 0.6s ease; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 0.72rem; font-weight: 600; color: rgba(0,0,0,0.8); min-width: 30px; }
.a-hbar-val { font-size: 0.78rem; color: #9ca3af; width: 50px; text-align: right; flex-shrink: 0; }

/* Stat cards within analytics */
.a-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.a-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.a-stat-val { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; color: #fff; }
.a-stat-label { font-size: 0.72rem; color: #7a7f8e; text-transform: uppercase; letter-spacing: 0.4px; margin-top: 4px; }

/* Ranked list */
.a-rank-list { list-style: none; padding: 0; margin: 0; }
.a-rank-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.a-rank-item:last-child { border-bottom: none; }
.a-rank-num { width: 24px; height: 24px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; flex-shrink: 0; }
.a-rank-num.gold { background: rgba(6,182,212,0.2); color: #06B6D4; }
.a-rank-num.silver { background: rgba(156,163,175,0.2); color: #9ca3af; }
.a-rank-num.bronze { background: rgba(217,119,6,0.2); color: #d97706; }
.a-rank-num.muted { background: rgba(255,255,255,0.04); color: #6b7280; }
.a-rank-name { flex: 1; font-size: 0.84rem; color: #d1d5db; }
.a-rank-val { font-size: 0.84rem; font-weight: 600; color: #06B6D4; }

/* Heatmap */
.a-heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.a-heat-cell { aspect-ratio: 1; border-radius: 4px; position: relative; transition: transform 0.15s; cursor: default; }
.a-heat-cell:hover { transform: scale(1.3); z-index: 2; }
.a-heat-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.65rem; color: #6b7280; }

/* Fullscreen mode */
#view-analytics.analytics-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background: var(--bg-base) !important;
  overflow-y: auto !important;
  padding: 24px 32px !important;
  margin: 0 !important;
  max-width: none !important;
  display: block !important;
}

/* Large monitor expansion */
@media (min-width: 1600px) {
  .analytics-grid-3 { grid-template-columns: repeat(3, 1fr); gap: 22px; }
  .analytics-kpi-row { grid-template-columns: repeat(8, 1fr); }
  .analytics-card { padding: 28px; }
  .chart-container { min-height: 240px; }
}
@media (min-width: 2000px) {
  .analytics-grid-3 { gap: 28px; }
  .analytics-kpi-row { gap: 18px; }
  .analytics-card { padding: 32px; }
  .analytics-card h3 { font-size: 1.05rem; }
  .chart-container { min-height: 280px; }
  .a-hbar-label { font-size: 0.85rem; width: 120px; }
}
@media (max-width: 1100px) {
  .analytics-grid-3 { grid-template-columns: 1fr 1fr; }
  .analytics-grid-3 .span-2 { grid-column: span 2; }
}
@media (max-width: 768px) {
  .analytics-grid-3 { grid-template-columns: 1fr; }
  .analytics-grid-3 .span-2 { grid-column: span 1; }
  .analytics-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* Chart bars (CSS-only charts) */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--gold), var(--orange));
  transition: height 0.5s ease;
  min-width: 20px;
}
.bar-label { font-size: 0.68rem; color: var(--text-muted); text-align: center; }
.bar-value { font-size: 0.72rem; color: var(--text-primary); font-weight: 600; }

/* Donut chart (CSS) */
.donut-chart {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin: 0 auto 16px;
  position: relative;
}
.donut-center {
  position: absolute;
  inset: 30px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.donut-center .donut-val { font-family: var(--font-heading); font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.donut-center .donut-label { font-size: 0.7rem; color: var(--text-muted); }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Funnel */
.funnel-chart { display: flex; flex-direction: column; gap: 4px; }
.funnel-stage {
  display: flex;
  align-items: center;
  gap: 12px;
}
.funnel-bar {
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bg-base);
}
.funnel-label { font-size: 0.78rem; color: var(--text-secondary); width: 80px; flex-shrink: 0; }

/* ===== TASKS ===== */
/* Tasks layout — fill the entire available width. No artificial cap.
   The .view container supplies left/right padding; this just stretches
   the inner list to use every pixel between sidebar and screen edge. */
.tasks-layout { width: 100%; max-width: 100%; margin: 0; }

/* Apply the same full-width treatment to Activity Log and Partner Activity
   so they don't shrink to a narrow center column on big monitors. Each view's
   internal containers stretch to fill the .view padding. */
#view-audit-log #auditList,
#view-partner-activity #partnerActivityUsers,
#view-partner-activity #partnerActivityFeed,
#view-campaign-dashboard #campaignDashAggregate,
#view-campaign-dashboard #campaignDashList { width: 100%; max-width: 100%; }
#view-audit-log,
#view-partner-activity,
#view-campaign-dashboard { width: 100%; max-width: 100%; }

/* Aggressive padding override at every breakpoint so these list-style views
   reach close to the screen edges instead of sitting in a narrow center
   column. The default .view padding scales up to 48px 72px on big monitors —
   that's ~144px of horizontal whitespace per row, which makes the content
   feel narrow on a wide screen. We pull it back universally to fill the
   available width on every monitor size. */
#view-tasks,
#view-audit-log,
#view-partner-activity,
#view-campaign-dashboard {
  padding: 16px 20px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}
/* The view-header at the top of each view also has its own implicit width
   from flex layout — force it to span the full row so the title + actions
   sit at the screen edges, matching the wider content beneath. */
#view-tasks .view-header,
#view-audit-log .view-header,
#view-partner-activity .view-header,
#view-campaign-dashboard .view-header {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
/* Children inside these views fill width too. Tasks-layout, audit list,
   partner list, etc. — every direct descendant becomes full-width so the
   "expanded header" matches the body underneath. */
#view-tasks > *,
#view-audit-log > *,
#view-partner-activity > *,
#view-campaign-dashboard > * { max-width: 100%; }

/* Prominent linked-entity chips on each task row. Contact = teal, Company =
   gold, Deal = purple — distinct enough to scan quickly, all clickable. */
.task-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}
.task-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}
.task-link-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.task-link-chip i { font-size: 0.85rem; padding: 0 4px; }
.task-chip-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.task-link-contact { background: rgba(16,185,129,0.14); color: #34d399; border-color: rgba(16,185,129,0.3); }
.task-link-contact:hover { border-color: #34d399; }
.task-link-contact .task-chip-avatar { background: #10b981; color: #022c1a; }
.task-link-company { background: rgba(6,182,212,0.14); color: var(--gold); border-color: rgba(6,182,212,0.3); padding-left: 12px; }
.task-link-company:hover { border-color: var(--gold); }
.task-link-deal { background: rgba(139,92,246,0.14); color: #a78bfa; border-color: rgba(139,92,246,0.3); padding-left: 12px; }
.task-link-deal:hover { border-color: #a78bfa; }
.task-chip-text { line-height: 1; }
.tasks-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.task-filter {
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.task-filter:hover { border-color: var(--border-light); }
.task-filter.active { background: rgba(6,182,212,0.1); border-color: var(--gold); color: var(--gold); }

.tasks-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.task-item:hover { border-color: var(--border-light); }
.task-checkbox {
  width: 22px; height: 22px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-checkbox:hover { border-color: var(--gold); }
.task-checkbox.completed { background: var(--teal); border-color: var(--teal); color: white; font-size: 0.7rem; }
.task-body { flex: 1; }
.task-body h4 { font-size: 0.95rem; margin-bottom: 4px; }
.task-body h4.completed { text-decoration: line-through; opacity: 0.5; }
.task-body .task-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; }
.task-due-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600;
  padding: 4px 12px; border-radius: 6px; white-space: nowrap; flex-shrink: 0;
  background: rgba(59,130,246,0.1); color: #3b82f6; border: 1px solid rgba(59,130,246,0.2);
}
.task-due-badge.overdue { background: rgba(239,68,68,0.12); color: #ef4444; border-color: rgba(239,68,68,0.25); animation: taskPulse 2s ease-in-out infinite; }
.task-due-badge.today { background: rgba(245,158,11,0.12); color: #f59e0b; border-color: rgba(245,158,11,0.25); }
.task-due-badge .task-due-date { font-weight: 400; font-size: 0.72rem; opacity: 0.8; }
@keyframes taskPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }

.mention-tag { color: var(--gold); font-weight: 600; cursor: pointer; }
.mention-tag:hover { text-decoration: underline; }
.mention-dropdown {
  position: absolute; z-index: 10002; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; max-height: 180px; overflow-y: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.3); min-width: 200px;
}
.mention-dropdown-item { padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 0.84rem; }
.mention-dropdown-item:hover { background: var(--bg-tertiary); }

.task-meta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.task-meta-item { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.task-meta-item i { font-size: 0.7rem; }
.priority-high { color: #f87171; }
.priority-medium { color: #fbbf24; }
.priority-low { color: #34d399; }
.task-item-actions { display: flex; gap: 6px; }
.task-item-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}
.task-item-actions button:hover { color: var(--gold); }

/* ===== SETTINGS ===== */
/* Settings Tab Navigation */
.settings-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
  padding: 6px;
  background: linear-gradient(145deg, rgba(20,20,24,.9), rgba(26,31,46,.9));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 2px 12px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.03);
}
.settings-tab {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 22px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  position: relative;
}
.settings-tab:hover { color: #fff; background: rgba(255,255,255,.06); }
.settings-tab.active {
  background: linear-gradient(135deg, rgba(79,140,255,.15), rgba(139,92,246,.1));
  color: #fff;
  box-shadow: 0 2px 8px rgba(79,140,255,.2), inset 0 1px 0 rgba(255,255,255,.06);
  border: 1px solid rgba(79,140,255,.25);
}
.settings-tab.active i { color: #4f8cff; }
.settings-tab i { font-size: 0.88rem; transition: color 0.2s; }
.settings-tab-panel { display: none; }
.settings-tab-panel.active { display: block; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.settings-card h3 { font-size: 1.05rem; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.settings-card h3 i { color: var(--gold); }
.settings-actions { display: flex; flex-direction: column; gap: 10px; }

/* Collapsible settings cards (accordion-style) */
details.settings-card > summary { list-style: none; }
details.settings-card > summary::-webkit-details-marker { display: none; }
details.settings-card > summary h3 { margin-bottom: 0; }
details.settings-card:not([open]) > summary h3 { margin-bottom: 0; }
details.settings-card[open] > summary #brandAccordionChevron,
details.settings-card[open] > summary .fa-chevron-down { transform: rotate(180deg); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.15rem; }
.modal-close {
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { border-color: var(--gold); color: var(--gold); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== EMAIL VIEWER (Full View Modal) ===== */
.modal-email-view {
  max-width: min(1100px, 95vw) !important;
  width: min(1100px, 95vw);
}
.modal-email-view .modal-body {
  max-height: 85vh;
}
.modal-email-view .ev-body-frame iframe {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  min-height: 60vh;
}
.modal-email-view .modal-header h2 {
  font-size: 0;
  height: 0;
  overflow: hidden;
}

.email-viewer {
  margin: -24px;
}

/* Email navigation bar */
.ev-nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 24px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}
.ev-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.ev-nav-btn:hover:not(:disabled) {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.ev-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.ev-nav-position {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 60px;
  text-align: center;
}

/* Header */
.ev-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.ev-sender-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
}
.ev-sender-info { flex: 1; }
.ev-sender-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ev-sender-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ev-channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ev-sender-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.ev-date-col {
  text-align: right;
  flex-shrink: 0;
}
.ev-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.ev-type-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 10px;
  letter-spacing: 0.4px;
}
.ev-type-sent { background: rgba(59,130,246,0.12); color: #3b82f6; }
.ev-type-received { background: rgba(16,185,129,0.12); color: #10b981; }
.ev-type-replied { background: rgba(139,92,246,0.12); color: #8b5cf6; }

/* Recipients */
.ev-recipients {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}
.ev-recipient-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  line-height: 1.8;
}
.ev-recipient-label {
  display: inline-block;
  width: 28px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.ev-recipient-value {
  color: var(--text-secondary);
}

/* Subject */
.ev-subject {
  padding: 16px 24px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

/* Branded email body frame */
.ev-body-frame {
  margin: 20px 24px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #ffffff;
}
.ev-brand-header {
  background: #295100;
  padding: 24px 28px;
  text-align: center;
}
.ev-brand-logo {
  max-width: 140px;
  height: auto;
}
.ev-brand-name {
  font-size: 17px;
  font-weight: 700;
  color: #06B6D4;
  margin-top: 8px;
  letter-spacing: 0.4px;
}
.ev-brand-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.5px;
  margin-top: 5px;
  font-style: italic;
}
.ev-brand-accent {
  height: 4px;
  background: linear-gradient(90deg, #295100, #feae1e, #295100);
}
.ev-body-content {
  padding: 28px 32px;
  font-size: 14.5px;
  line-height: 1.75;
  color: #2d2d2d;
  min-height: 80px;
}
.ev-body-content p {
  margin: 0 0 12px;
  color: #2d2d2d;
}
.ev-body-content a {
  color: #295100;
  font-weight: 500;
}

/* Signature */
.ev-brand-signature {
  padding: 0 32px 28px;
}
.ev-sig-divider {
  border: none;
  border-top: 2px solid #06B6D4;
  margin: 0 0 20px;
  width: 80px;
}
.ev-sig-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.ev-sig-logo {
  width: 90px;
  height: auto;
  flex-shrink: 0;
}
.ev-sig-details {
  border-left: 3px solid #06B6D4;
  padding-left: 16px;
}
.ev-sig-name {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
}
.ev-sig-title {
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  margin-top: 2px;
}
.ev-sig-contact {
  font-size: 12px;
  color: #555;
  margin-top: 6px;
  line-height: 1.6;
}
.ev-sig-quote {
  font-size: 11px;
  font-style: italic;
  color: #777;
  margin-top: 6px;
}
.ev-brand-footer {
  background: #295100;
  padding: 14px 28px;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ev-brand-footer span:first-child {
  color: #06B6D4;
  font-weight: 600;
}

/* Engagement stats bar */
.ev-engagement-bar {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  margin: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}
.ev-engagement-stat {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ev-stat-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.ev-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.ev-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Tracking timeline */
.ev-timeline {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.ev-timeline-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ev-timeline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.8rem;
}
.ev-timeline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ev-timeline-dot.open { background: var(--teal); }
.ev-timeline-dot.click { background: var(--gold); }
.ev-timeline-content { flex: 1; }
.ev-timeline-action {
  color: var(--text-secondary);
  font-weight: 500;
}
.ev-timeline-url {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 6px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.ev-timeline-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Quick action buttons */
.ev-actions {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  min-width: 280px;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } }
.toast.success { border-left: 3px solid var(--teal); }
.toast.error { border-left: 3px solid #f87171; }
.toast.info { border-left: 3px solid var(--blue); }
.toast.warning { border-left: 3px solid #fbbf24; }
.toast i { font-size: 1rem; }
.toast.success i { color: var(--teal); }
.toast.error i { color: #f87171; }
.toast.info i { color: var(--blue); }
.toast.warning i { color: #fbbf24; }
.toast span { font-size: 0.88rem; color: var(--text-primary); flex: 1; }
.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

/* ===== ACTION BAR ===== */
.action-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.action-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(6,182,212,0.05); }
.action-btn i { font-size: 0.85rem; }
.action-btn-primary { border-color: var(--gold); color: var(--gold); }
.deal-tab-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.deal-tab-desc { font-size: 0.78rem; color: var(--text-muted); margin: 0; }
.deal-tab-desc i { margin-right: 4px; }

/* Contact Type Badge */
.contact-type-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  background: rgba(6,182,212,0.12);
  color: var(--gold);
  border: 1px solid rgba(6,182,212,0.25);
}
.contact-type-badge:empty { display: none; }

/* ===== MEETINGS ===== */
.meetings-list { display: flex; flex-direction: column; gap: 10px; }
.meeting-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.meeting-card:hover { border-color: var(--border-light); }
.meeting-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  background: rgba(139,92,246,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple);
  font-size: 1rem;
  flex-shrink: 0;
}
.meeting-body { flex: 1; }
.meeting-body h4 { font-size: 0.95rem; margin-bottom: 4px; }
.meeting-body .meeting-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; }
.meeting-details { display: flex; gap: 16px; flex-wrap: wrap; }
.meeting-detail { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.meeting-detail i { font-size: 0.7rem; color: var(--gold); }
.meeting-actions { display: flex; gap: 6px; }
.meeting-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}
.meeting-actions button:hover { color: var(--gold); }

/* ===== BRANDED TEMPLATE ===== */
.branded-preview {
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 700px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
}
.branded-header {
  background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 3px solid #06B6D4;
}
.branded-header img { height: 44px; width: auto; }
.branded-header h2 {
  font-family: 'Sora', sans-serif;
  color: #06B6D4;
  font-size: 1.3rem;
  font-weight: 700;
}
.branded-body {
  padding: 32px;
  color: #333333;
  font-size: 0.92rem;
  line-height: 1.7;
}
.branded-body h3 { color: #0a0a0a; margin-bottom: 16px; font-size: 1.1rem; }
.branded-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.branded-body table th {
  background: #0a0a0a;
  color: #06B6D4;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.branded-body table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e5e5e5;
  font-size: 0.88rem;
  color: #333;
}
.branded-body table tr:nth-child(even) { background: #f9f9f9; }
.branded-totals {
  margin-left: auto;
  max-width: 280px;
  margin-top: 16px;
}
.branded-totals .bt-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.88rem;
  color: #555;
}
.branded-totals .bt-row.grand {
  border-top: 2px solid #0a0a0a;
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0a0a0a;
}
.branded-footer {
  background: #0a0a0a;
  padding: 24px 32px;
  color: #a0a0a0;
  font-size: 0.82rem;
  line-height: 1.7;
}
.branded-footer .sig-name { color: #feae1e; font-weight: 600; font-size: 0.92rem; }
.branded-footer .sig-title { color: #cccccc; }
.branded-stamp {
  display: inline-block;
  padding: 6px 18px;
  border: 2px solid #10b981;
  color: #10b981;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 12px;
  transform: rotate(-3deg);
}
.branded-stamp.declined { border-color: #f87171; color: #f87171; }

/* Modal wide variant for previews */
.modal.wide { max-width: 800px; }
.modal.wide.preview .modal-body { background: #ffffff; border-radius: 8px; padding: 0; overflow: auto; }
.modal.wide.preview .modal-body table { color: #333; }
.modal.wide .modal-body { padding: 24px; overflow: auto; }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.88rem; }

/* ===== GLOBAL LARGE SCREEN EXPANSION =====
   Every page tracks the dashboard's padding scale exactly so they all reach
   the same edge-to-edge width on wide monitors. Tables, lists, and the email
   split-pane all stretch full-width inside that gutter. */
.view-header, .toolbar, .data-table, .pipeline-board, .email-split,
.tasks-layout, .settings-grid, .detail-layout, .quote-builder,
.data-table-wrapper, .saved-views-bar, .active-filters,
.companies-grid, .pipeline-grid, .email-stats { width: 100%; box-sizing: border-box; }

/* Force every direct child of a view to fill the view's content width.
   Some views (contacts, emails) had subtle width oddities — this hammer makes
   sure they reach the same edges as Companies and Dashboard. */
.view > * { width: 100%; box-sizing: border-box; }
.view > .view-header { width: 100%; }
.view > .modal-overlay,
.view > .floating-only,
.view > .modal-container { width: auto; } /* exceptions: floating UI shouldn't stretch */

/* Targeted overrides for views Sean called out as narrow. These get the
   *minimal* possible padding so they reach edge-to-edge on any monitor. */
#view-contacts,
#view-emails,
#view-tasks,
#view-calendar,
#view-products,
#view-email-templates,
#view-form-builder,
#view-documents,
#view-campaigns,
#view-social,
#view-settings,
#view-team,
#view-billing,
#view-integrations,
#view-imports,
#view-business-units,
#view-iris,
#view-piq-admin {
  padding: 14px 18px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
@media (min-width: 1400px) {
  #view-contacts, #view-emails, #view-tasks, #view-calendar,
  #view-products, #view-email-templates, #view-form-builder, #view-documents,
  #view-campaigns, #view-social, #view-settings, #view-team, #view-billing,
  #view-integrations, #view-imports, #view-business-units, #view-iris, #view-piq-admin {
    padding: 18px 22px !important;
  }
}
@media (min-width: 1800px) {
  #view-contacts, #view-emails, #view-tasks, #view-calendar,
  #view-products, #view-email-templates, #view-form-builder, #view-documents,
  #view-campaigns, #view-social, #view-settings, #view-team, #view-billing,
  #view-integrations, #view-imports, #view-business-units, #view-iris, #view-piq-admin {
    padding: 22px 26px !important;
  }
}

/* Force every descendant container that commonly holds page-level content
   to span the full width too. This catches grids, lists, and tables that
   might otherwise sit in a narrow center column. */
#view-contacts > *, #view-emails > *, #view-tasks > *, #view-calendar > *,
#view-products > *, #view-email-templates > *, #view-form-builder > *, #view-documents > *,
#view-campaigns > *, #view-social > *, #view-settings > *, #view-team > *, #view-billing > *,
#view-integrations > *, #view-imports > *, #view-business-units > *, #view-iris > *, #view-piq-admin > * {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* 1400px+ — pages span nearly edge-to-edge */
@media (min-width: 1400px) {
  .view { padding: 22px 24px; }
  .view-header { margin-bottom: 28px; }
  .view-header h1 { font-size: 1.85rem; }
  .topbar { padding: 0 36px; height: 68px; }
  .data-table thead th { padding: 14px 20px; font-size: 0.8rem; }
  .data-table tbody td { padding: 14px 20px; font-size: 0.9rem; }
  .contact-name-cell a { font-size: 0.92rem; }
  .mini-avatar { width: 36px; height: 36px; font-size: 0.82rem; }
  .detail-layout { grid-template-columns: 360px 1fr; gap: 28px; }
  .detail-card { padding: 28px; }
  .profile-avatar, .company-avatar { width: 88px; height: 88px; font-size: 1.8rem; }
  .toolbar { padding: 14px 18px; gap: 14px; margin-bottom: 20px; }
  .toolbar-search input { font-size: 0.9rem; }
  .modal { max-width: 640px; padding: 32px; }
  .form-input, .select-input, .form-textarea { padding: 11px 14px; font-size: 0.9rem; }
  .btn { padding: 11px 22px; font-size: 0.9rem; }
  .action-bar { gap: 10px; }
  .action-btn { padding: 10px 18px; font-size: 0.86rem; }
  .table-actions button { width: 32px; height: 32px; font-size: 0.82rem; }
  /* Quote builder fills the available width on large screens */
  .quote-builder { max-width: 100%; }
  .quote-details-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .quote-totals { max-width: 400px; }
  /* Pipeline */
  .pipeline-board { gap: 12px; }
  .pipeline-col-header { padding: 12px 14px; }
  /* Email list */
  .email-preview { max-width: 600px; }
  .email-item { padding: 12px 18px; }
  /* Product text */
  .pl-name-text { max-width: 400px; }
  .pl-desc { max-width: 400px; }
  /* Settings */
  .settings-grid { gap: 20px; }
  .settings-card { padding: 28px; }
  /* Notes */
  .note-card { padding: 16px; }
  .note-composer textarea { min-height: 80px; }
  /* Tabs */
  .tab-btn { padding: 10px 20px; }
  .detail-tabs { gap: 4px; margin-bottom: 20px; }
}

/* 1800px+ — large monitors, ultrawide */
@media (min-width: 1800px) {
  .view { padding: 26px 30px; }
  .view-header h1 { font-size: 2rem; letter-spacing: -0.3px; }
  .view-subtitle { font-size: 0.95rem; }
  .topbar { padding: 0 48px; height: 72px; }
  .topbar-search input { width: 400px; font-size: 0.92rem; }
  .data-table thead th { padding: 16px 24px; font-size: 0.82rem; letter-spacing: 1px; }
  .data-table tbody td { padding: 16px 24px; font-size: 0.92rem; }
  .contact-name-cell { gap: 14px; }
  .contact-name-cell a { font-size: 0.95rem; }
  .mini-avatar { width: 40px; height: 40px; font-size: 0.85rem; }
  .detail-layout { grid-template-columns: 400px 1fr; gap: 36px; }
  .detail-card { padding: 32px; border-radius: 18px; }
  .profile-avatar, .company-avatar { width: 96px; height: 96px; font-size: 2rem; }
  .profile-card h2 { font-size: 1.3rem; }
  .meta-row { font-size: 0.9rem; padding: 6px 0; }
  .toolbar { padding: 16px 22px; border-radius: 16px; }
  .toolbar-search input { font-size: 0.92rem; }
  .modal { max-width: 720px; padding: 36px; border-radius: 20px; }
  .modal.wide { max-width: 900px; }
  .form-group label { font-size: 0.88rem; }
  .form-input, .select-input, .form-textarea { padding: 12px 16px; font-size: 0.92rem; border-radius: 12px; }
  .btn { padding: 12px 24px; font-size: 0.92rem; border-radius: 12px; }
  .action-bar { gap: 12px; margin-bottom: 28px; }
  .action-btn { padding: 12px 22px; font-size: 0.88rem; border-radius: 12px; }
  .table-actions button { width: 34px; height: 34px; }
  .tab-btn { padding: 12px 22px; font-size: 0.9rem; }
  .sidebar-nav .nav-item { padding: 12px 22px; font-size: 0.92rem; }
  .sidebar-header { padding: 22px; }
  .note-card { padding: 18px; }
  .email-item { padding: 14px 18px; }
  .tag { padding: 5px 12px; font-size: 0.82rem; }
  .status-badge { padding: 4px 12px; font-size: 0.78rem; }
  /* Quote builder */
  .quote-builder { max-width: 1400px; }
  .quote-details-grid { grid-template-columns: 1fr 1fr 1fr 1fr; gap: 20px; }
  .quote-totals { max-width: 440px; padding: 20px; }
  .quote-items-table select, .quote-items-table input { padding: 8px 12px; font-size: 0.88rem; }
  /* Pipeline */
  .pipeline-board { gap: 14px; }
  .pipeline-column { border-radius: 16px; }
  .pipeline-col-header { padding: 14px 16px; }
  .pipeline-col-header h3 { font-size: 0.95rem; }
  .deal-card { padding: 12px; border-radius: 12px; }
  .deal-value { font-size: 1rem; }
  /* Email list */
  .email-preview { max-width: 700px; }
  .email-item { gap: 14px; }
  .email-subject { font-size: 0.92rem; }
  /* Product text */
  .pl-name-text { max-width: 500px; }
  .pl-desc { max-width: 500px; }
  /* Settings */
  .settings-grid { gap: 24px; }
  .settings-card { padding: 32px; border-radius: 18px; }
  /* Compose email */
  .compose-modal .form-input, .compose-modal .form-textarea { font-size: 0.92rem; }
  /* Tasks */
  .task-item { padding: 14px 18px; }
  /* Campaigns / Social */
  .campaign-card, .social-card { padding: 20px; border-radius: 14px; }
  /* Analytics */
  .analytics-grid { gap: 22px; }
}

/* 2200px+ — 4K and ultrawide monitors */
@media (min-width: 2200px) {
  .view { padding: 30px 36px; }
  .view-header h1 { font-size: 2.2rem; }
  .topbar { padding: 0 64px; height: 76px; }
  .topbar-search input { width: 500px; }
  .data-table thead th { padding: 18px 28px; font-size: 0.85rem; }
  .data-table tbody td { padding: 18px 28px; font-size: 0.95rem; }
  .mini-avatar { width: 44px; height: 44px; font-size: 0.88rem; }
  .detail-layout { grid-template-columns: 480px 1fr; gap: 48px; }
  .detail-card { padding: 36px; border-radius: 22px; }
  .profile-avatar, .company-avatar { width: 104px; height: 104px; font-size: 2.2rem; }
  .modal { max-width: 800px; padding: 40px; }
  .modal.wide { max-width: 1000px; }
  .form-input, .select-input, .form-textarea { padding: 14px 18px; font-size: 0.95rem; }
  /* Activity feed on large monitors */
  .activity-item { padding: 14px 8px; }
  .activity-icon { width: 38px; height: 38px; font-size: 0.88rem; }
  .activity-text { font-size: 0.92rem; }
  .act-preview { max-width: 500px; font-size: 0.82rem; }
  .activity-expanded { margin-left: 50px; }
  .activity-email-body { max-height: 300px; }
  .activity-task-desc { font-size: 0.88rem; }
  .btn { padding: 14px 28px; font-size: 0.95rem; }
  .sidebar { width: 300px; }
  .main-content { margin-left: 300px; max-width: calc(100vw - 300px); }
  .sidebar-nav .nav-item { padding: 14px 26px; font-size: 0.95rem; }
  /* Quote builder */
  .quote-builder { max-width: none; }
  .quote-totals { max-width: 480px; padding: 24px; }
  /* Pipeline */
  .pipeline-board { gap: 18px; }
  .pipeline-column { border-radius: 18px; }
  .pipeline-col-header { padding: 16px 18px; }
  .deal-card { padding: 14px; border-radius: 14px; }
  /* Email / Product */
  .email-preview { max-width: none; }
  .email-item { padding: 16px 22px; }
  .pl-name-text { max-width: none; }
  .pl-desc { max-width: none; }
  /* Settings */
  .settings-grid { gap: 28px; }
  .settings-card { padding: 36px; border-radius: 20px; }
  /* Tabs */
  .tab-btn { padding: 14px 26px; font-size: 0.95rem; }
  .detail-tabs { gap: 6px; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1280px) {
  .pipeline-board { grid-template-columns: repeat(4, minmax(0, 1fr)); height: calc(100vh - 180px); grid-auto-rows: 1fr; }
}

@media (max-width: 1024px) {
  .detail-layout { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .quote-details-grid { grid-template-columns: 1fr; }
  .pipeline-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; max-width: 100vw; }
  .mobile-menu-btn { display: block; }
  .topbar { padding: 0 16px; }
  .topbar-user span { display: none; }
  .view { padding: 16px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .email-stats { flex-direction: column; }
  .social-stats { flex-direction: column; }
  .pipeline-board { grid-template-columns: 1fr; height: auto; }
  .view-header { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-tabs { gap: 2px; padding: 3px; }
  .settings-tab { padding: 8px 12px; font-size: 0.78rem; }
  .settings-tab span.tab-label { display: none; }

  /* Contact / company / deal detail view fixes — long values were getting
     cut off because of nowrap-with-ellipsis rules tuned for desktop. On
     phones we'd rather wrap than truncate. */
  body { overflow-x: hidden; }
  .detail-card { padding: 16px; min-width: 0; }
  .detail-main, .detail-sidebar { min-width: 0; }
  .profile-meta { width: 100%; min-width: 0; }
  .profile-meta .meta-row {
    align-items: flex-start;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
    width: 100%;
  }
  /* Critical: flex children need an explicit min-width:0 to break out of
     their min-content sizing — that's what was forcing long emails to
     overflow the row instead of wrapping. */
  .profile-meta .meta-row a,
  .profile-meta .meta-row span {
    min-width: 0;
    word-break: break-all;
    overflow-wrap: anywhere;
  }
  /* Profile card itself needs a hard width cap so long content can't push
     the parent grid wider than the viewport. */
  .profile-card { max-width: 100%; }
  .profile-card h2 { word-break: break-word; }

  /* Activity feed: drop the inner 600px scroll container so the page
     scrolls naturally — no double-scroll-trap on touch devices. */
  .activity-feed { max-height: none; overflow-y: visible; }

  /* Email subject preview was clamped to 300px + nowrap + ellipsis,
     which on a 375px screen with padding cuts off after ~10 chars.
     Allow wrapping. */
  .act-preview {
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  /* Chips can wrap onto a second line rather than overflow horizontally. */
  .act-link { white-space: normal; }
  .activity-text-row { gap: 4px; }
  .activity-detail-row { gap: 6px; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .view-actions { width: 100%; }
  .view-actions .btn { flex: 1; justify-content: center; }
  .toolbar { flex-direction: column; }
  .toolbar-filters { width: 100%; }
  .toolbar-filters .select-input { flex: 1; }
}

/* ===== SAVED VIEWS BAR ===== */
.saved-views-bar {
  display: flex;
  gap: 4px;
  padding: 0 0 14px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}
.saved-views-bar::-webkit-scrollbar { height: 0; }
.view-tab {
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  color: #9ca3af;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.view-tab:hover { background: rgba(255,255,255,0.05); color: #d1d5db; border-color: rgba(255,255,255,0.1); }
.view-tab.active {
  background: rgba(6,182,212,0.1);
  border-color: rgba(6,182,212,0.3);
  color: #fbbf24;
}
.view-tab i { font-size: 0.7rem; }
.view-tab-add {
  background: none;
  border: 1px dashed rgba(255,255,255,0.1);
  color: #6b7280;
}
.view-tab-add:hover { border-color: var(--gold); color: var(--gold); }
.view-tab .view-count {
  font-size: 0.65rem;
  background: rgba(255,255,255,0.08);
  padding: 1px 6px;
  border-radius: 8px;
  color: #6b7280;
}
.view-tab.active .view-count { background: rgba(6,182,212,0.15); color: #fbbf24; }
.view-tab .view-delete {
  font-size: 0.65rem;
  opacity: 0;
  margin-left: 2px;
  color: #6b7280;
}
.view-tab:hover .view-delete { opacity: 1; }
.view-tab .view-delete:hover { color: #f87171; }

/* Active filter chips */
.active-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 0 12px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 20px;
  font-size: 0.72rem;
  color: #60a5fa;
}
.filter-chip .chip-label { color: #9ca3af; margin-right: 2px; }
.filter-chip .chip-remove {
  cursor: pointer;
  font-size: 0.68rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.filter-chip .chip-remove:hover { opacity: 1; color: #f87171; }

/* Stale/engagement indicators */
.contact-stale { color: #f87171; }
.contact-warm { color: #f59e0b; }
.contact-fresh { color: #10b981; }

@media (max-width: 768px) {
  .saved-views-bar { padding-bottom: 10px; }
  .view-tab { padding: 6px 10px; font-size: 0.72rem; }
}

/* ===== TEAM CHAT ===== */
.chat-layout { display: flex; height: calc(100vh - var(--topbar-height) - 48px); margin: -24px -28px; border-radius: 0; overflow: hidden; }
.chat-sidebar {
  width: 260px; flex-shrink: 0; background: #0e1015; border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; overflow-y: auto;
}
.chat-sidebar-header {
  padding: 18px 18px 12px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chat-sidebar-header h3 { font-size: 0.95rem; color: #e5e7eb; margin: 0; }
.chat-sidebar-section { padding: 16px 18px 8px; }
.chat-sidebar-section h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px; color: #6b7280; margin: 0; }

.chat-channel-list, .chat-dm-list { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; }
.chat-channel-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  cursor: pointer; transition: all 0.15s; color: #9ca3af; font-size: 0.88rem;
}
.chat-channel-item:hover { background: rgba(255,255,255,0.04); color: #d1d5db; }
.chat-channel-item.active { background: rgba(6,182,212,0.1); color: #fbbf24; }
.chat-channel-item .ch-icon { font-size: 0.8rem; width: 20px; text-align: center; flex-shrink: 0; }
.chat-channel-item .ch-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-channel-item .ch-badge {
  background: var(--gold); color: #000; font-size: 0.65rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.chat-channel-item .ch-lock { font-size: 0.65rem; color: #6b7280; }

.chat-main { flex: 1; display: flex; flex-direction: column; background: #111318; min-width: 0; }
.chat-main-header {
  padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.chat-channel-info h3 { font-size: 1rem; color: #e5e7eb; margin: 0; }
.chat-header-actions { display: flex; gap: 8px; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px;
}
.chat-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #4b5563; }

.chat-msg {
  display: flex; gap: 12px; padding: 8px 4px; border-radius: 8px; transition: background 0.15s;
}
.chat-msg:hover { background: rgba(255,255,255,0.02); }
.chat-msg-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.chat-msg-body { flex: 1; min-width: 0; }
.chat-msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.chat-msg-name { font-size: 0.88rem; font-weight: 600; color: #e5e7eb; }
.chat-msg-time { font-size: 0.72rem; color: #6b7280; }
.chat-msg-text { font-size: 0.88rem; color: #d1d5db; line-height: 1.5; word-break: break-word; }
.chat-msg-text a { color: var(--gold); }

/* Group same-sender messages */
.chat-msg.continuation { padding-top: 1px; }
.chat-msg.continuation .chat-msg-avatar { visibility: hidden; height: 0; }
.chat-msg.continuation .chat-msg-header { display: none; }

.chat-date-divider {
  text-align: center; padding: 12px 0; font-size: 0.72rem; color: #6b7280;
  display: flex; align-items: center; gap: 12px;
}
.chat-date-divider::before, .chat-date-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.06);
}

.chat-composer {
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; gap: 10px; flex-shrink: 0;
}
.chat-composer .form-input {
  flex: 1; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 10px 16px; color: #e5e7eb; font-size: 0.9rem;
}
.chat-composer .form-input:focus { border-color: var(--gold); }
.chat-composer .btn { border-radius: 10px; padding: 10px 18px; }

.chat-nav-badge {
  background: var(--gold); color: #000; font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; margin-left: auto;
}

@media (max-width: 768px) {
  .chat-layout { flex-direction: column; height: calc(100vh - var(--topbar-height)); margin: -16px; }
  .chat-sidebar { width: 100%; height: auto; max-height: 200px; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .chat-channel-list { flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px; }
  .chat-channel-item { white-space: nowrap; padding: 6px 12px; }
  .chat-dm-list { display: none; }
  .chat-sidebar-section { display: none; }
}
@media (min-width: 1800px) {
  .chat-sidebar { width: 300px; }
  .chat-msg-avatar { width: 38px; height: 38px; }
  .chat-msg-name { font-size: 0.92rem; }
  .chat-msg-text { font-size: 0.92rem; }
  .chat-composer .form-input { padding: 12px 18px; font-size: 0.92rem; }
}

/* ===== FOLLOW-UP TASK ===== */
.followup-section { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.followup-preset { transition: all 0.15s; }
.followup-preset.active { background: var(--gold) !important; color: var(--bg-base) !important; border-color: var(--gold) !important; font-weight: 700; }

/* ===== AI WRITING ASSIST ===== */
.ai-toolbar { margin-top: 8px; }

.btn-ai {
  background: linear-gradient(135deg, #6c3aed, #8b5cf6);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-ai:hover { background: linear-gradient(135deg, #5b21b6, #7c3aed); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,58,237,0.3); }
.btn-ai:active { transform: translateY(0); }

.ai-panel {
  margin-top: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(108,58,237,0.3);
  border-radius: var(--radius-lg, 10px);
  padding: 16px;
  animation: aiPanelIn 0.2s ease-out;
}

@keyframes aiPanelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #a78bfa;
}
.ai-panel-header i { margin-right: 6px; }

.ai-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.ai-panel-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.ai-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.ai-action-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.ai-action-btn:hover {
  border-color: #8b5cf6;
  color: #c4b5fd;
  background: rgba(108,58,237,0.08);
}
.ai-action-btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.ai-action-btn i {
  color: #a78bfa;
  font-size: 0.82rem;
  width: 14px;
  text-align: center;
}

.ai-freeform {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.ai-prompt-input {
  flex: 1;
  font-size: 0.82rem !important;
  padding: 8px 12px !important;
}

.ai-status {
  padding: 10px 0;
  font-size: 0.82rem;
  color: #a78bfa;
}
.ai-status i { margin-right: 6px; }

.ai-result {
  margin-top: 10px;
  background: var(--bg-tertiary);
  border: 1px solid rgba(108,58,237,0.2);
  border-radius: var(--radius);
  overflow: hidden;
}

.ai-result-text {
  padding: 14px 16px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-primary);
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.ai-result-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: rgba(108,58,237,0.04);
}

/* Notification alert animations */
@keyframes notifSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes notifSlideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }


/* ===== CLIENT ORDERS ===== */
.client-orders-badge { background: #f59e0b; color: #000; font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 10px; margin-left: auto; }
.co-stats-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.co-stat { flex: 1; min-width: 140px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.co-stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); font-family: var(--font-heading); }
.co-stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.co-stat-pending .co-stat-value { color: #f59e0b; }
.co-stat-confirm .co-stat-value { color: #8b5cf6; }
.co-stat-ready .co-stat-value { color: #10b981; }
.co-stat-revenue .co-stat-value { color: var(--gold); }

.co-filter-tabs { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
.co-tab { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; font-size: 0.82rem; color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: all 0.2s; display: flex; align-items: center; gap: 6px; }
.co-tab:hover { border-color: var(--gold); color: var(--text-primary); }
.co-tab.active { background: var(--gold); color: #000; border-color: var(--gold); font-weight: 600; }
.co-tab-count { background: rgba(255,255,255,0.25); padding: 1px 7px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; }
.co-tab.active .co-tab-count { background: rgba(0,0,0,0.2); }

#clientOrdersGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.co-order-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s; }
.co-order-card:hover { border-color: var(--border-light); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.co-order-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.co-order-header > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.co-order-id { font-family: var(--font-heading); font-weight: 700; font-size: 0.88rem; color: var(--text-primary); }
.co-order-group { font-size: 0.72rem; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }
.co-brand-tag { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.co-status-badge { font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 8px; white-space: nowrap; }

.co-order-body { padding: 14px 16px; }
.co-order-customer { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.co-order-customer i { color: var(--text-muted); font-size: 0.9rem; }
.co-order-customer strong { display: block; font-size: 0.88rem; color: var(--text-primary); }
.co-order-customer span { display: block; font-size: 0.78rem; color: var(--text-muted); }

.co-order-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; background: var(--bg-input); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.co-order-meta > div { text-align: center; }
.co-meta-label { display: block; font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.co-order-meta span:not(.co-meta-label) { font-size: 0.85rem; color: var(--text-primary); }

.co-shipping-terms { font-size: 0.78rem; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.co-shipping-terms i { color: var(--gold); font-size: 0.75rem; }
.co-order-date { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }

.co-order-actions { display: flex; gap: 8px; padding: 10px 16px 14px; }
.co-order-actions .btn { flex: 1; }
.btn-sm { padding: 6px 12px !important; font-size: 0.78rem !important; }

/* Client Order Detail Modal */
.co-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.co-detail-section { background: var(--bg-input); border-radius: 10px; padding: 14px; }
.co-detail-section h4 { color: var(--gold); font-size: 0.82rem; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.co-detail-section p { margin: 4px 0; font-size: 0.85rem; color: var(--text-secondary); }
.co-detail-section p i { width: 16px; text-align: center; margin-right: 6px; color: var(--text-muted); }

.co-totals { background: var(--bg-input); border-radius: 10px; padding: 14px 16px; margin-top: 12px; }
.co-totals > div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.88rem; color: var(--text-secondary); }
.co-total-final { font-weight: 700; color: var(--gold) !important; font-size: 1rem !important; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px !important; }
.co-total-final span { color: var(--gold); }

.co-history { display: flex; flex-direction: column; gap: 6px; }
.co-history-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-input); border-radius: 8px; font-size: 0.82rem; }
.co-history-status { font-weight: 600; color: var(--text-primary); min-width: 130px; }
.co-history-by { color: var(--text-secondary); }
.co-history-date { color: var(--text-muted); margin-left: auto; }
.co-history-notes { color: var(--text-muted); font-style: italic; }

/* Status badges for client orders */
.status-badge.status-pending_review { background: #f59e0b20; color: #f59e0b; }
.status-badge.status-shipping_applied { background: #3b82f620; color: #3b82f6; }
.status-badge.status-awaiting_confirmation { background: #8b5cf620; color: #8b5cf6; }
.status-badge.status-confirmed { background: #10b98120; color: #10b981; }
.status-badge.status-invoiced { background: #06b6d420; color: #06b6d4; }
.status-badge.status-active { background: #10b98120; color: #10b981; }
.status-badge.status-inactive { background: #6b728020; color: #6b7280; }

@media (max-width: 768px) {
  .co-stats-bar { gap: 8px; }
  .co-stat { min-width: 100px; padding: 12px; }
  .co-stat-value { font-size: 1.1rem; }
  #clientOrdersGrid { grid-template-columns: 1fr; }
  .co-order-meta { grid-template-columns: repeat(2, 1fr); }
  .co-detail-grid { grid-template-columns: 1fr; }
  .co-filter-tabs { gap: 3px; }
  .co-tab { padding: 6px 10px; font-size: 0.75rem; }
}

/* ===== DRAFTS PANEL ===== */
#emailDraftsPanel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.draft-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 4px; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.draft-item:hover { border-color: var(--gold); background: var(--bg-card-hover); }
