/* ===================================================================
   Ankush_CRM - Enterprise Light & Professional Standard Portal
   Inspired by SproutSuite.app (Pipeline-first, MIS, Unified Operations)
   =================================================================== */

:root {
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-muted: #f8fafc;
  
  --border-light: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #10b981;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverted: #ffffff;

  --primary: #059669;         /* Sprout Emerald */
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;
  --primary-text: #065f46;

  --accent-blue: #2563eb;     /* Enterprise Trust Blue */
  --accent-blue-light: #eff6ff;
  --accent-indigo: #4f46e5;
  --accent-purple: #7c3aed;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #0ea5e9;
  --info-bg: #f0f9ff;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.06);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-width: 260px;
  --header-height: 70px;
}

/* ===================================================================
   DARK THEME MODE
   =================================================================== */
[data-theme="dark"] {
  --bg-main: #0b1120;
  --bg-sidebar: #0f172a;
  --bg-card: #1e293b;
  --bg-surface-hover: #334155;
  --bg-muted: #1e293b;
  
  --border-light: #334155;
  --border-subtle: #1e293b;
  --border-focus: #34d399;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-inverted: #0f172a;

  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.15);
  --primary-border: #047857;
  --primary-text: #a7f3d0;

  --accent-blue-light: rgba(37, 99, 235, 0.15);
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info-bg: rgba(14, 165, 233, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===================================================================
   LAYOUT & APP WRAPPER
   =================================================================== */

#app-container, .app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
aside.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 30;
  transition: width 0.2s ease;
}

.sidebar-brand, .brand-section {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.brand-link, .brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-link:hover, .brand-logo:hover {
  text-decoration: none;
  color: var(--primary);
}

.brand-logo-icon, .brand-icon-box {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name, .brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-tagline {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.brand-badge {
  font-size: 10px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-category {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.8px;
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--primary);
}

.nav-item .badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--border-light);
  color: var(--text-muted);
  font-weight: 600;
}

.nav-item.active .badge {
  background: #10b981;
  color: #fff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-sidebar);
}

.user-quick-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}

.user-quick-profile:hover {
  background: var(--bg-surface-hover);
}

.avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #059669, #0f172a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid var(--border-light);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
}

.avatar-circle.status-online::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid #fff;
  border-radius: 50%;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===================================================================
   MAIN CONTENT AREA
   =================================================================== */

main.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-main);
}

/* Top Navigation Bar */
header.top-header {
  height: var(--header-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-trail span.current {
  color: var(--text-main);
  font-weight: 600;
}

.header-search {
  position: relative;
  width: 320px;
}

.header-search input {
  width: 100%;
  height: 38px;
  padding: 0 16px 0 38px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
}

.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.search-icon-pos {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle Button (Light/Dark Mode) */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.btn-theme-toggle:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-theme-toggle .theme-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
}

[data-theme="dark"] .btn-theme-toggle .theme-icon {
  color: #60a5fa;
}

.btn-quick-create {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
  transition: all 0.15s ease;
}

.btn-quick-create:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}

.header-icon-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.pulse-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* Scrollable View Container */
.view-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 40px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   CARDS, STATS & ATTRACTIVE CLICKABLE METRICS
   =================================================================== */

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title-group h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.page-title-group p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.page-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

/* Interactive Clickable Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.stat-card.clickable-card {
  cursor: pointer;
  user-select: none;
}

.stat-card.clickable-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.stat-card.clickable-card:active {
  transform: translateY(-1px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
}

.stat-card.accent-emerald::before { background: var(--primary); }
.stat-card.accent-blue::before { background: var(--accent-blue); }
.stat-card.accent-indigo::before { background: var(--accent-indigo); }
.stat-card.accent-warning::before { background: var(--warning); }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stat-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.click-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
}

.stat-card.clickable-card:hover .click-hint {
  opacity: 1;
  transform: translateX(3px);
}

.badge-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 11px;
}

.badge-trend.positive {
  background: var(--success-bg);
  color: #10b981;
}

.badge-trend.negative {
  background: var(--danger-bg);
  color: #ef4444;
}

/* Quick Navigation Cards Bar on Dashboard */
.quick-jump-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.quick-jump-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.quick-jump-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-jump-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-jump-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.quick-jump-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ===================================================================
   KANBAN PIPELINE BOARD
   =================================================================== */

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(280px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 220px);
}

.pipeline-column {
  background: var(--bg-surface-hover);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.pipeline-column-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.col-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.col-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.col-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
}

.col-count {
  font-size: 11px;
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.col-total-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.cards-stream {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 160px;
}

.cards-stream.drag-over {
  background: rgba(16, 185, 129, 0.08);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-md);
}

.deal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.deal-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.deal-card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.tag-badge {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.tag-rotting {
  background: var(--danger-bg);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.tag-ai-score {
  background: var(--success-bg);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-source {
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.deal-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.deal-card-company {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.deal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px dashed var(--border-light);
}

.deal-card-value {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.deal-card-owner {
  display: flex;
  align-items: center;
  gap: 6px;
}

.avatar-mini {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===================================================================
   DEAL / OPPORTUNITY DETAIL WORKSPACE (SproutSuite Style)
   =================================================================== */

.deal-detail-header-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.detail-top-nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.btn-detail-back {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-detail-back:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
}

.detail-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.detail-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-icon-box {
  width: 48px;
  height: 48px;
  background: #2563eb;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.detail-title-text h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.detail-amount-display {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

.detail-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.detail-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-toolbar-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-toolbar-action:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
}

.btn-toolbar-action.primary-btn {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.btn-toolbar-action.primary-btn:hover {
  background: #1d4ed8;
}

/* Two-column layout */
.deal-workspace-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.workspace-left-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workspace-right-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-side-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.detail-side-card h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-account-box {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

/* Sub Tab Bar on Right Area */
.detail-subtabs-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 8px 16px 0;
  overflow-x: auto;
}

.detail-tab-btn {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.detail-tab-btn:hover {
  color: var(--text-main);
}

.detail-tab-btn.active {
  color: var(--text-main);
  border-bottom-color: var(--primary);
  background: var(--bg-surface-hover);
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

.detail-tab-btn.highlighted-purple {
  background: #7c3aed;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-bottom: 4px;
}

/* Activity Composer Box */
.activity-composer-container {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.composer-type-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.composer-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface-hover);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.composer-type-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.composer-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}

.composer-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.composer-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

/* Timeline Feed */
.activity-timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
}

.activity-type-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

/* ===================================================================
   DATA TABLES (LEADS, ACCOUNTS, QUOTES, TICKETS, USERS)
   =================================================================== */

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  flex-wrap: wrap;
  gap: 12px;
}

.table-search-box {
  position: relative;
  width: 280px;
}

.table-search-box input {
  width: 100%;
  height: 36px;
  padding: 0 14px 0 34px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  background: var(--bg-card);
  color: var(--text-main);
}

.table-search-box input:focus {
  border-color: var(--primary);
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.custom-select:focus {
  border-color: var(--primary);
}

.data-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

table.data-table th {
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.3px;
}

table.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background: var(--bg-surface-hover);
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
}

.status-badge.status-won { background: var(--success-bg); color: #10b981; }
.status-badge.status-open { background: var(--info-bg); color: #0ea5e9; }
.status-badge.status-pending { background: var(--warning-bg); color: #f59e0b; }
.status-badge.status-danger { background: var(--danger-bg); color: #ef4444; }
.status-badge.status-approved { background: var(--success-bg); color: #10b981; }

/* Table Action Buttons */
.action-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
}

.icon-btn-sm:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--primary);
}

.icon-btn-sm.delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fca5a5;
}

/* ===================================================================
   MODALS & DIALOGS (WITH 4-COLUMN RESPONSIVE GRID FOR EDIT DEAL)
   =================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop.quick-modal-backdrop {
  z-index: 300;
  background: rgba(15, 23, 42, 0.75);
}

.modal-content,
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 92%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-main);
  box-sizing: border-box;
}

.modal-content.modal-wide,
.modal-card.modal-wide {
  max-width: 860px;
}

.modal-backdrop.open .modal-content,
.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-title,
.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.btn-close-modal,
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-close-modal:hover,
.modal-close-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* Field Previews and Inline Add Links */
.field-preview-box {
  background: var(--bg-muted);
  border: 1px dashed var(--border-light);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-label {
  font-weight: 600;
  color: var(--text-light);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.preview-val {
  font-weight: 600;
  color: var(--text-main);
}

.link-inline-add {
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s ease;
}

.link-inline-add:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.modal-body {
  padding: 24px;
}

/* SproutSuite 4-column Opportunity Info Grid */
.deal-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .deal-edit-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.btn-inline-new {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.form-help-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-main);
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

textarea.form-control {
  height: 80px;
  padding: 10px 12px;
  resize: vertical;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface-hover);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-secondary {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
}

.btn-primary {
  padding: 8px 18px;
  border-radius: var(--radius-md);
  background: var(--accent-blue);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: #1d4ed8;
}

/* ===================================================================
   TOAST NOTIFICATIONS
   =================================================================== */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-main);
  min-width: 280px;
  pointer-events: auto;
  animation: slideInRight 0.25s ease forwards;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.info { border-left: 4px solid var(--info); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===================================================================
   CRM DASHBOARD KPI METRICS GRID & CARDS
   =================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.2s ease;
}

.metric-card:nth-child(1)::before { background: linear-gradient(90deg, #10b981, #059669); }
.metric-card:nth-child(2)::before { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.metric-card:nth-child(3)::before { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.metric-card:nth-child(4)::before { background: linear-gradient(90deg, #8b5cf6, #10b981); }

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.metric-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.metric-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}

.metric-value {
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font-family);
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.metric-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.metric-footer.positive {
  color: #10b981;
}

.metric-footer.negative {
  color: #ef4444;
}

.rotting-deal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.rotting-deal-item:last-child {
  border-bottom: none;
}

.rotting-deal-item:hover {
  background: var(--bg-surface-hover);
  padding-left: 22px;
}

/* Master Data Summary Strip in CRM Dashboard */
.dash-master-pills-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.dash-master-pill-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dash-master-pill-card:hover {
  border-color: var(--primary);
  background: var(--bg-surface-hover);
  transform: translateY(-1px);
}

.dash-master-pill-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.dash-master-pill-info {
  display: flex;
  flex-direction: column;
}

.dash-master-pill-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.dash-master-pill-count {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

/* Detail Workspace Column Classes & Subtabs */
.deal-left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.deal-right-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.deal-workspace-subtabs-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 10px 16px 0;
  overflow-x: auto;
}

.deal-subtab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.deal-subtab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.deal-subtab.highlight-purple {
  color: #7c3aed;
}

.activity-composer-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.composer-type-selector-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.composer-type-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  cursor: pointer;
}

.composer-type-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.composer-input-area textarea {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-surface-hover);
  color: var(--text-main);
  font-size: 13.5px;
  font-family: var(--font-family);
  resize: vertical;
  outline: none;
}

.composer-input-area textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.composer-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.timeline-feed-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
}

.timeline-filter-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.filter-pills-row {
  display: flex;
  gap: 6px;
}

.filter-pill-btn {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: none;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.filter-pill-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.timeline-items-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.timeline-stream-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-master-pills-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .dash-master-pills-row {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   CHARTS & GRAPHS
   =================================================================== */

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.chart-container-box {
  width: 100%;
  height: 220px;
  position: relative;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
  .pipeline-board {
    grid-template-columns: repeat(5, 260px);
  }
  .deal-workspace-grid {
    grid-template-columns: 1fr;
  }
}


/* ===================================================================
   SPROUTSUITE ENHANCEMENTS: WORKSPACE STRIP, PIPELINE KPIS & CARDS
   =================================================================== */

.workspace-subnav-strip {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.workspace-subnav-strip::-webkit-scrollbar {
  display: none;
}
.subnav-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-right: 12px;
  padding: 10px 0;
}
.subnav-pill {
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
}
.subnav-pill:hover {
  color: var(--primary);
  background: var(--bg-surface-hover);
}
.subnav-pill.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* Pipeline Top 4 KPI Cards (Matching Screenshot) */
.pipeline-kpis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.pipeline-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.pipeline-kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.pipeline-kpi-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.pipeline-kpi-val.highlight-won {
  color: #10b981;
}
.pipeline-kpi-sub {
  font-size: 11.5px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Pipeline Filter & View Toolbar */
.pipeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 6px 0;
}
.toolbar-left-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar-right-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.view-switch-group {
  display: inline-flex;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.view-switch-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.view-switch-btn:hover {
  color: var(--text-main);
}
.view-switch-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}
.filter-dropdown-select {
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
}
.filter-dropdown-select:focus {
  border-color: var(--primary);
}
.scope-pills-group {
  display: inline-flex;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.scope-pill-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}
.scope-pill-btn.active {
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
}
[data-theme="dark"] .scope-pill-btn.active {
  background: #3b82f6;
  color: #ffffff;
}

/* SproutSuite Style Deal Cards */
.deal-card-sprout {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.deal-card-sprout:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-header-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.card-title-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}
.badge-rotting-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.card-opp-no {
  font-size: 11.5px;
  color: var(--text-light);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
}
.card-opp-copy-icon {
  cursor: pointer;
  opacity: 0.6;
}
.card-opp-copy-icon:hover {
  opacity: 1;
}
.card-amount-lg {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin: 4px 0 2px 0;
  letter-spacing: -0.3px;
}
.card-meta-line {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.card-meta-icon {
  opacity: 0.7;
}
.card-close-date {
  font-size: 11.5px;
  color: var(--text-light);
  margin-top: 2px;
}

@media (max-width: 1200px) {
  .pipeline-kpis-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .pipeline-kpis-grid {
    grid-template-columns: 1fr;
  }
  .pipeline-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

.data-table-wrapper, .table-responsive {
  overflow-x: auto;
  width: 100%;
}

table.data-table, table.crm-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

table.data-table th, table.crm-table th {
  background: var(--bg-surface-hover);
  padding: 12px 18px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table.data-table td, table.crm-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

table.data-table tbody tr:hover, table.crm-table tbody tr:hover {
  background-color: var(--bg-surface-hover);
}

table.data-table tbody tr:last-child td, table.crm-table tbody tr:last-child td {
  border-bottom: none;
}
/* ===================================================================
   OPPORTUNITY DETAIL HERO & WORKSPACE CARDS
   =================================================================== */

.detail-hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.detail-title-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-opp-number-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.detail-deal-oppno {
  font-weight: 700;
  color: var(--text-muted);
}

.btn-copy-opp {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}

.detail-deal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.detail-status-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.status-pill {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: var(--bg-surface-hover);
}

.status-pill.stage {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

.status-pill.probability {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.3);
}

.status-pill.priority {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.status-pill.close-date {
  background: var(--bg-surface-hover);
  color: var(--text-muted);
}

.detail-deal-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  text-align: right;
}

.workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.workspace-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.header-icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
}

.linked-account-card {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
}

.acc-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.detail-company-icon {
  font-size: 20px;
}

.acc-name-box {
  display: flex;
  flex-direction: column;
}

.acc-category-text {
  font-size: 11px;
  color: var(--text-muted);
}

.acc-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.workspace-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sparkle-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%) !important;
  color: #fff !important;
  border: none !important;
}

.pill-account-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.muted-note-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.toggle-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toggle-pill-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.icon-only {
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===================================================================
   ENTERPRISE CRM DASHBOARD V3.0 STYLES
   Corporate Navy Blue (#0f172a, #1e293b), White & Subtle Teal (#0d9488, #10b981)
   =================================================================== */

/* Header Role Selector */
.role-selector-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  box-shadow: var(--shadow-sm);
}

.role-selector-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-dropdown {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  outline: none;
  cursor: pointer;
  font-family: var(--font-family);
}

/* Global Dashboard Filter Card (Section 9) */
.dashboard-filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.filter-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.filter-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-reset-filters {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-reset-filters:hover {
  background: var(--bg-surface-hover);
  color: #ef4444;
  border-color: #ef4444;
}

.filters-grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control-sm {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface-hover);
  color: var(--text-main);
  font-size: 12.5px;
  font-family: var(--font-family);
  outline: none;
  transition: all 0.15s ease;
}

.form-control-sm:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

/* 10 Key KPI Cards Grid (Section 2) */
.kpi-grid-10 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card-enterprise {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.kpi-card-enterprise:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.kpi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.kpi-card-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.kpi-card-val {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-family);
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.4px;
}

.kpi-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.kpi-card-bottom.positive {
  color: #10b981;
}

.kpi-card-bottom.negative {
  color: #ef4444;
}

.kpi-card-link {
  font-size: 10.5px;
  color: var(--primary);
  font-weight: 700;
}

/* 9-Stage Opportunity Lifecycle Ribbon (Section 3) */
.lifecycle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.lifecycle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.lifecycle-stages-ribbon {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.lifecycle-stage-step {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 120px;
}

.lifecycle-stage-step:hover {
  background: var(--bg-card);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stage-step-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stage-index-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-step-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-step-count {
  font-size: 14px;
  font-weight: 800;
}

.stage-step-val {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
}

.stage-step-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.stage-step-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.stage-step-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* 9 Interactive Analytics Charts Grid (Section 4) */
.charts-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.charts-grid-9 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}

.chart-box:hover {
  border-color: var(--primary);
}

.chart-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart-box-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.chart-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.canvas-wrapper {
  width: 100%;
  height: 190px;
  position: relative;
}

/* Table Toolbar Left/Right & Status Tabs */
.table-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-status-filters {
  display: flex;
  gap: 4px;
  background: var(--bg-surface-hover);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.status-tab-btn {
  border: none;
  background: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.sortable-th {
  cursor: pointer;
  user-select: none;
}

.sortable-th:hover {
  color: var(--primary);
  background: rgba(16, 185, 129, 0.08) !important;
}

/* Table Pagination Bar */
.table-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
  font-size: 12.5px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-page {
  padding: 5px 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.btn-page:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.current-page-num {
  font-weight: 800;
  color: var(--primary);
  padding: 0 4px;
}

/* Deal Closure Analytics Grid (Section 6) */
.deal-closure-analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.closure-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.closure-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.closure-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.closure-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.closure-kpi-item {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
}

.closure-kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.closure-kpi-value {
  font-size: 16px;
  font-weight: 800;
  margin-top: 4px;
  color: var(--text-main);
}

.closure-kpi-value.positive { color: #10b981; }
.closure-kpi-value.negative { color: #ef4444; }

.lost-reasons-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lost-reason-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  font-size: 12.5px;
}

.upcoming-closures-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upcoming-deal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.upcoming-deal-row:hover {
  background: var(--bg-card);
  border-color: #10b981;
}

.overdue-deal-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 6px;
}

.overdue-deal-alert:hover {
  border-color: #ef4444;
}

/* Progress bar for Sales Team Leaderboard */
.progress-bar-sm {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  width: 100px;
}

.progress-fill-sm {
  height: 100%;
  border-radius: 3px;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.settings-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

/* Modal Form Rows */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.link-inline-add {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.link-inline-add:hover {
  text-decoration: underline;
}

/* Responsive Breakpoints */
@media (max-width: 1400px) {
  .kpi-grid-10 {
    grid-template-columns: repeat(3, 1fr);
  }
  .charts-grid-9 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .kpi-grid-10 {
    grid-template-columns: repeat(2, 1fr);
  }
  .charts-grid-9 {
    grid-template-columns: 1fr;
  }
  .deal-closure-analytics-grid {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .lifecycle-stages-ribbon {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid-10 {
    grid-template-columns: 1fr;
  }
  .filters-grid-row {
    grid-template-columns: 1fr;
  }
  .form-row-2, .form-row-3 {
    grid-template-columns: 1fr;
  }
}


/* ========================================================================= */
/* ENTERPRISE WORKSPACE SWITCHER & ITSM HELPDESK STYLING                    */
/* ========================================================================= */

.workspace-switcher-pills {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.ws-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.ws-pill:hover {
  color: var(--text-main);
  background: rgba(0,0,0,0.04);
}

.ws-pill.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.ws-pill .ws-icon {
  font-size: 14px;
}

/* Priority & SLA Badges */
.badge-urgent {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: 1px solid #fca5a5;
  font-weight: 700;
}

.badge-high {
  background: #ffedd5 !important;
  color: #c2410c !important;
  border: 1px solid #fdba74;
  font-weight: 600;
}

.badge-medium {
  background: #fef9c3 !important;
  color: #854d0e !important;
  border: 1px solid #fde047;
}

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

.badge-ticket-count {
  background: #0284c7 !important;
  color: #ffffff !important;
}

/* Threaded Ticket Conversation Stream */
.ticket-messages-stream {
  max-height: 580px;
  overflow-y: auto;
  padding-right: 6px;
}

.message-card-internal {
  background: #fef9c3 !important;
  border: 1px solid #fde047 !important;
  border-left: 4px solid #eab308 !important;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(234, 179, 8, 0.1);
}

.message-card-agent {
  background: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
  border-left: 4px solid #0284c7 !important;
  border-radius: 8px;
  padding: 14px 16px;
}

.message-card-customer {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
  border-left: 4px solid var(--primary) !important;
  border-radius: 8px;
  padding: 14px 16px;
}

/* Ticket Kanban Cards */
.ticket-kanban-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ticket-kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.ticket-kanban-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.kanban-col.drag-over {
  background: rgba(16, 185, 129, 0.08) !important;
  border-color: var(--primary) !important;
}

/* Print Stylesheet for Reports */
@media print {
  .sidebar, .top-header, .workspace-subnav-strip, .page-actions-group, .global-filter-bar, .modal-backdrop, .toast-container {
    display: none !important;
  }
  .app-layout, .main-viewport, .view-container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .table-card {
    border: none !important;
    box-shadow: none !important;
  }
  .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  .data-table th, .data-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 8px 10px !important;
  }
}


/* ===================================================================
   EXECUTIVE THEMES: LIGHT, DARK, CEO EXECUTIVE, CCO OPERATIONS
   =================================================================== */

/* Root theme variable bridges */
:root {
  --border-color: var(--border-light);
  --bg-surface: var(--bg-card);
  --bg-surface-elevated: var(--bg-card);
  --header-bg: var(--bg-card);
  --input-bg: var(--bg-card);
  --badge-bg: var(--bg-surface-hover);
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
}

/* Light Mode (Explicit) */
[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-muted: #f8fafc;
  --border-light: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #10b981;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverted: #ffffff;
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;
  --primary-text: #065f46;
  --border-color: #e2e8f0;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --header-bg: #ffffff;
  --input-bg: #ffffff;
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
}

/* Dark Mode (Enhanced) */
[data-theme="dark"] {
  --bg-main: #0b1120;
  --bg-sidebar: #060b14;
  --bg-card: #111a2e;
  --bg-surface-hover: #1e293b;
  --bg-muted: #0f172a;
  --border-light: #1e293b;
  --border-subtle: #1e293b;
  --border-focus: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-inverted: #0f172a;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: #1d4ed8;
  --primary-text: #93c5fd;
  --border-color: #1e293b;
  --bg-surface: #111a2e;
  --bg-surface-elevated: #162238;
  --header-bg: #111a2e;
  --input-bg: #162238;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
}

/* 👑 CEO Executive Suite View */
[data-theme="ceo"] {
  --bg-main: #f0f4f8;
  --bg-sidebar: #0a192f;
  --bg-card: #ffffff;
  --bg-surface-hover: #e2e8f0;
  --bg-muted: #f8fafc;
  --border-light: #cbd5e1;
  --border-subtle: #e2e8f0;
  --border-focus: #0284c7;
  --text-main: #0a192f;
  --text-muted: #475569;
  --text-light: #64748b;
  --text-inverted: #ffffff;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-border: #7dd3fc;
  --primary-text: #0369a1;
  --accent-blue: #0284c7;
  --border-color: #cbd5e1;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --header-bg: #ffffff;
  --input-bg: #ffffff;
  --badge-bg: #f0fdf4;
  --card-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
}

[data-theme="ceo"] .sidebar {
  background: #0a192f !important;
  border-right: 1px solid #1e293b;
}

[data-theme="ceo"] .sidebar .brand-badge {
  background: linear-gradient(135deg, #0284c7, #059669);
  color: white;
}

[data-theme="ceo"] .sidebar .nav-item {
  color: #94a3b8;
}

[data-theme="ceo"] .sidebar .nav-item:hover,
[data-theme="ceo"] .sidebar .nav-item.active {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
}

[data-theme="ceo"] .top-header {
  border-bottom: 2px solid #0284c7;
}

/* 🛠️ CCO Operations Command View */
[data-theme="cco"] {
  --bg-main: #090d16;
  --bg-sidebar: #020617;
  --bg-card: #0f172a;
  --bg-surface-hover: #1e293b;
  --bg-muted: #0d1527;
  --border-light: #334155;
  --border-subtle: #1e293b;
  --border-focus: #06b6d4;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-inverted: #020617;
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --primary-light: rgba(6, 182, 212, 0.15);
  --primary-border: #0891b2;
  --primary-text: #67e8f9;
  --accent-blue: #38bdf8;
  --border-color: #334155;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #1e293b;
  --header-bg: #0f172a;
  --input-bg: #1e293b;
  --badge-bg: #1e293b;
  --card-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

[data-theme="cco"] .sidebar {
  background: #020617 !important;
  border-right: 1px solid #1e293b;
}

[data-theme="cco"] .sidebar .brand-badge {
  background: linear-gradient(135deg, #06b6d4, #f59e0b);
  color: #020617;
}

[data-theme="cco"] .sidebar .nav-item {
  color: #94a3b8;
}

[data-theme="cco"] .sidebar .nav-item:hover,
[data-theme="cco"] .sidebar .nav-item.active {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}

[data-theme="cco"] .top-header {
  background: #0f172a;
  border-bottom: 2px solid #06b6d4;
}

/* ===================================================================
   GLOBAL FILTER BAR & FILTER CONTROLS GRID
   =================================================================== */

.global-filter-bar {
  background: var(--bg-surface, var(--bg-card));
  border: 1px solid var(--border-color, var(--border-light));
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
  display: block !important;
}

.filter-header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle, var(--border-light));
}

.filter-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-main);
}

.filter-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.filter-col {
  flex: 1;
  min-width: 170px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-col label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.filter-col select,
.filter-col input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-color, var(--border-light));
  border-radius: 8px;
  background-color: var(--input-bg, var(--bg-card));
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.filter-col select:focus,
.filter-col input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ===================================================================
   KPI DASHBOARD GRID & CARDS
   =================================================================== */

.kpi-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card-dash {
  background: var(--bg-surface, var(--bg-card));
  border: 1px solid var(--border-color, var(--border-light));
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card-dash:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

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

.kpi-label-dash {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.kpi-badge-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--badge-bg, rgba(0,0,0,0.04));
}

.kpi-val-dash {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.kpi-sub-line {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===================================================================
   BI CHARTS GRID & CARDS
   =================================================================== */

.charts-bi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-surface, var(--bg-card));
  border: 1px solid var(--border-color, var(--border-light));
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.chart-canvas-container {
  position: relative;
  width: 100%;
  height: 220px;
}

/* ===================================================================
   EXECUTIVE THEME CARDS & SETTINGS GRID
   =================================================================== */

.theme-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.theme-preview-card {
  border: 2px solid var(--border-color, var(--border-light));
  border-radius: 12px;
  padding: 16px;
  background: var(--bg-surface, var(--bg-card));
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theme-preview-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.theme-preview-card.active {
  border-color: var(--primary) !important;
  background: var(--bg-surface-hover) !important;
  box-shadow: 0 0 0 2px var(--primary);
}

.theme-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-swatches {
  display: flex;
  gap: 6px;
  margin: 6px 0;
}

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.15);
}

.theme-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.theme-active-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #dcfce7;
  color: #15803d;
}

/* ===================================================================
   TOP HEADER REFINED LAYOUT & THEME SELECTOR
   =================================================================== */

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 20px;
  background: var(--header-bg, var(--bg-card));
  border-bottom: 1px solid var(--border-color, var(--border-light));
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-center {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 380px;
  min-width: 160px;
}

.header-search {
  width: 100%;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.theme-dropdown {
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color, var(--border-light));
  background: var(--input-bg, var(--bg-card));
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.theme-dropdown:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, var(--border-light));
  background: var(--input-bg, var(--bg-card));
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.08);
}
