:root, [data-bs-theme="dark"] {
  --crm-navy: #09090b;
  --crm-blue: #0095B6;
  --crm-blue-dark: #007a95;
  --crm-accent: #0095B6;
  --crm-accent-dark: #007a95;
  --crm-ink: #f4f4f5;
  --crm-muted: #a1a1aa;
  --crm-border: #27272a;
  --crm-border-light: #3f3f46;
  --crm-surface: #111113;
  --crm-surface-elevated: #18181b;
  --crm-canvas: #000000;
  --crm-success: #10b981;
  --crm-sidebar-width: 16.5rem;
  --crm-sidebar-collapsed-width: 4.75rem;

  --bs-primary: #0095B6;
  --bs-primary-rgb: 0, 149, 182;
  --bs-link-color: #0095B6;
  --bs-link-hover-color: #14b8dc;
  --bs-body-bg: var(--crm-canvas);
  --bs-body-color: var(--crm-ink);
  --bs-border-color: var(--crm-border);
  --bs-card-bg: var(--crm-surface);
  --bs-card-border-color: var(--crm-border);
}

[data-bs-theme="light"] {
  --crm-navy: #ffffff;
  --crm-blue: #0095B6;
  --crm-blue-dark: #007a95;
  --crm-accent: #0095B6;
  --crm-accent-dark: #007a95;
  --crm-ink: #0f172a;
  --crm-muted: #64748b;
  --crm-border: #e2e8f0;
  --crm-border-light: #cbd5e1;
  --crm-surface: #ffffff;
  --crm-surface-elevated: #f8fafc;
  --crm-canvas: #f8fafc;
  --crm-success: #059669;
  --crm-sidebar-width: 16.5rem;
  --crm-sidebar-collapsed-width: 4.75rem;

  --bs-primary: #0095B6;
  --bs-primary-rgb: 0, 149, 182;
  --bs-link-color: #00829e;
  --bs-link-hover-color: #006075;
  --bs-body-bg: var(--crm-canvas);
  --bs-body-color: var(--crm-ink);
  --bs-border-color: var(--crm-border);
  --bs-card-bg: var(--crm-surface);
  --bs-card-border-color: var(--crm-border);
}

html { font-size: 16px; color-scheme: dark; }
html[data-bs-theme="light"] { color-scheme: light; }
body { margin: 0; color: var(--crm-ink); background: var(--crm-canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; overflow-x: hidden; }
a { color: #0095B6; text-decoration: none; }
[data-bs-theme="dark"] a { color: #14b8dc; }
[data-bs-theme="dark"] a:hover { color: #6edcf2; }
[data-bs-theme="light"] a { color: #00829e; }
[data-bs-theme="light"] a:hover { color: #006075; }
:focus-visible { outline: 3px solid #0095B6; outline-offset: 2px; }

.skip-link { position: fixed; z-index: 2000; top: .5rem; left: .5rem; padding: .65rem 1rem; color: #fff; background: #000; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.crm-shell { min-height: 100vh; position: relative; }

/* Sidebar Navigation */
.crm-sidebar {
  width: var(--crm-sidebar-width) !important;
  color: #e2e8f0;
  background: #09090b;
  border-right: 1px solid var(--crm-border);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1020;
}

.crm-brand-row {
  min-height: 4.5rem;
  height: 4.5rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--crm-border);
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  background: #09090b;
  box-sizing: border-box;
}

.crm-brand {
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s ease;
}

.crm-brand:hover {
  color: #fff;
  opacity: 0.9;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  min-width: 2.35rem;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #0095B6 0%, #00637a 100%);
  border-radius: 0.7rem;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 4px 14px rgba(0, 149, 182, 0.4);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
}

.crm-brand:hover .brand-mark {
  transform: scale(1.08) rotate(-3deg);
  box-shadow: 0 6px 20px rgba(0, 149, 182, 0.55);
}

.brand-text {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f8fafc;
  transition: opacity 0.2s ease;
}

.brand-accent {
  background: linear-gradient(135deg, #14b8dc 0%, #0095B6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Interactive Sidebar / Menu Toggle Buttons */
.sidebar-toggle-btn {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  min-width: 2.4rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.65rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle-btn:hover {
  color: #ffffff;
  background: rgba(0, 149, 182, 0.18);
  border-color: rgba(0, 149, 182, 0.45);
  box-shadow: 0 0 14px rgba(0, 149, 182, 0.35);
  transform: scale(1.08);
}

.sidebar-toggle-btn:active {
  transform: scale(0.92);
}

.sidebar-toggle-btn .toggle-icon {
  display: inline-block;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s ease;
}

.sidebar-toggle-btn:hover .toggle-icon {
  color: #0095B6;
}

.crm-sidebar-body {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4.5rem);
  padding: 1rem 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--crm-border) transparent;
}

/* Interactive Sidebar Search / Quick Filter */
.sidebar-search-box {
  margin-bottom: 0.75rem;
}

.sidebar-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-search-icon {
  position: absolute;
  left: 0.7rem;
  font-size: 0.8rem;
  color: #64748b;
  pointer-events: none;
  transition: color 0.15s ease;
}

.sidebar-filter-input {
  width: 100%;
  height: 2.15rem;
  padding: 0.35rem 1.85rem 0.35rem 2.05rem;
  font-size: 0.82rem;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 0.6rem;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-filter-input::placeholder {
  color: #64748b;
  font-size: 0.8rem;
}

.sidebar-filter-input:focus {
  background: rgba(0, 149, 182, 0.08);
  border-color: #0095B6;
  box-shadow: 0 0 0 3px rgba(0, 149, 182, 0.22);
  color: #ffffff;
}

.sidebar-filter-input:focus ~ .sidebar-search-icon {
  color: #0095B6;
}

.sidebar-filter-clear {
  position: absolute;
  right: 0.55rem;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  color: #94a3b8;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.sidebar-filter-clear:hover {
  color: #f43f5e;
  transform: scale(1.15);
}

/* Primary Dashboard Link */
.crm-nav-primary {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 2.85rem;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.85rem;
  color: #f1f5f9;
  background: rgba(0, 149, 182, 0.12);
  border: 1px solid rgba(0, 149, 182, 0.25);
  border-radius: 0.7rem;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.crm-nav-primary:hover {
  color: #fff;
  background: rgba(0, 149, 182, 0.24);
  border-color: rgba(0, 149, 182, 0.5);
  box-shadow: 0 4px 16px rgba(0, 149, 182, 0.25);
  transform: translateY(-1px);
}

.crm-nav-primary:active {
  transform: scale(0.98);
}

.crm-nav-primary.active {
  color: #ffffff;
  background: rgba(0, 149, 182, 0.28);
  border-color: #0095B6;
  box-shadow: 0 0 16px rgba(0, 149, 182, 0.35);
}

.crm-nav-primary.active .nav-primary-icon-box {
  background: #0095B6;
  border-color: #0095B6;
  box-shadow: 0 0 12px rgba(0, 149, 182, 0.6);
}

.crm-nav-primary.active .nav-primary-icon {
  color: #ffffff;
}

.nav-primary-icon-box {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  min-width: 2.15rem;
  border-radius: 0.55rem;
  background: rgba(0, 149, 182, 0.25);
  border: 1px solid rgba(0, 149, 182, 0.4);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.crm-nav-primary:hover .nav-primary-icon-box {
  background: rgba(0, 149, 182, 0.4);
  box-shadow: 0 0 12px rgba(0, 149, 182, 0.45);
  transform: scale(1.12);
}

.nav-primary-icon {
  font-size: 1.1rem;
  color: #6edcf2;
  text-align: center;
  transition: color 0.15s ease;
}

.crm-nav-primary:hover .nav-primary-icon {
  color: #ffffff;
}

/* Nav Accordion & Groups */
.crm-nav-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-group {
  border-radius: 0.65rem;
  transition: background 0.15s ease;
}

.nav-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.65rem;
  color: #94a3b8;
  background: transparent;
  border: 0;
  border-radius: 0.65rem;
  font-size: 0.9rem;
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-group-header:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.nav-group-header:active {
  transform: scale(0.98);
}

.nav-group-icon {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  min-width: 2.15rem;
  font-size: 1.05rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.55rem;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-group-header:hover .nav-group-icon {
  transform: scale(1.1) translateY(-1px);
  color: #ffffff;
}

/* Group Badge */
.nav-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  margin-left: auto;
  margin-right: 0.35rem;
  transition: all 0.2s ease;
}

.nav-group-header:hover .nav-group-badge {
  background: rgba(0, 149, 182, 0.22);
  color: #14b8dc;
  transform: scale(1.08);
}

/* Module-specific interactive accents */
.nav-section-group[data-module="sales"] .nav-group-header:hover .nav-group-icon,
.nav-section-group[data-module="sales"].is-active-group .nav-group-icon {
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.nav-section-group[data-module="activities"] .nav-group-header:hover .nav-group-icon,
.nav-section-group[data-module="activities"].is-active-group .nav-group-icon {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.nav-section-group[data-module="commercial"] .nav-group-header:hover .nav-group-icon,
.nav-section-group[data-module="commercial"].is-active-group .nav-group-icon {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.nav-section-group[data-module="analytics"] .nav-group-header:hover .nav-group-icon,
.nav-section-group[data-module="analytics"].is-active-group .nav-group-icon {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.nav-section-group[data-module="administration"] .nav-group-header:hover .nav-group-icon,
.nav-section-group[data-module="administration"].is-active-group .nav-group-icon {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.3);
}

.nav-group-title {
  flex: 1;
  letter-spacing: 0.01em;
}

.nav-group-arrow {
  font-size: 0.75rem;
  color: #64748b;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s ease;
}

.nav-group-header:hover .nav-group-arrow {
  color: #cbd5e1;
  transform: translateX(2px);
}

.nav-group-header:not(.collapsed) .nav-group-arrow {
  transform: rotate(180deg);
  color: #93c5fd;
}

.nav-group-header:not(.collapsed):hover .nav-group-arrow {
  transform: rotate(180deg) translateY(2px);
}

/* Sub-items List & Tree Connectors */
.nav-sub-list {
  padding: 0.25rem 0 0.4rem 1.65rem;
  margin: 0;
  list-style: none;
  border-left: 1.5px solid rgba(255, 255, 255, 0.09);
  margin-left: 1.7rem;
  position: relative;
}

.nav-sub-item {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 0.2rem;
}

/* Horizontal branch connector */
.nav-sub-item::before {
  content: "";
  position: absolute;
  left: -1.65rem;
  top: 50%;
  width: 1.1rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.09);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.nav-sub-item:hover::before {
  background: #0095B6;
  width: 1.35rem;
  box-shadow: 0 0 6px rgba(0, 149, 182, 0.6);
}

.nav-sub-item.is-item-active::before {
  background: #0095B6;
  width: 1.35rem;
}

/* Luminous active node on the tree stem */
.nav-sub-item.is-item-active::after {
  content: "";
  position: absolute;
  left: -1.7rem;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0095B6;
  box-shadow: 0 0 8px #0095B6, 0 0 14px rgba(0, 149, 182, 0.6);
  pointer-events: none;
}

.nav-sub-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.25rem;
  padding: 0.38rem 0.65rem;
  padding-right: 2rem;
  color: #94a3b8;
  border-radius: 0.55rem;
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-sub-link:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(3px);
}

.nav-sub-link.active {
  color: #14b8dc;
  background: linear-gradient(90deg, rgba(0, 149, 182, 0.18) 0%, rgba(0, 149, 182, 0.05) 100%);
  font-weight: 650;
  border-left: 3px solid #0095B6;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  box-shadow: inset 1px 0 0 rgba(0, 149, 182, 0.3);
}

.nav-sub-icon {
  font-size: 0.95rem;
  min-width: 1.25rem;
  text-align: center;
  color: #64748b;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-sub-link:hover .nav-sub-icon {
  color: #14b8dc;
  transform: translateX(2px) scale(1.15);
}

.nav-sub-link.active .nav-sub-icon {
  color: #0095B6;
  filter: drop-shadow(0 0 6px rgba(0, 149, 182, 0.5));
}

/* Sub-item count badge */
.nav-sub-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  color: #64748b;
  margin-left: auto;
  transition: all 0.2s ease;
}

.nav-sub-link:hover .nav-sub-count-badge {
  background: rgba(0, 149, 182, 0.25);
  color: #38bdf8;
  transform: scale(1.1);
}

.nav-sub-link.active .nav-sub-count-badge {
  background: #0095B6;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(0, 149, 182, 0.5);
}

/* Interactive Quick Add (+) Button on Hover */
.nav-quick-add-btn {
  position: absolute;
  right: 0.35rem;
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 0.72rem;
  opacity: 0;
  transform: scale(0.75);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  z-index: 2;
}

.nav-sub-item:hover .nav-quick-add-btn {
  opacity: 1;
  transform: scale(1);
}

.nav-quick-add-btn:hover {
  background: #0095B6;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 149, 182, 0.6);
  transform: scale(1.18) rotate(90deg);
}

.nav-quick-add-btn:active {
  transform: scale(0.95) rotate(90deg);
}

/* Sidebar Context Bottom Box */
.sidebar-context {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  margin-top: auto;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--crm-border);
  border-radius: 0.65rem;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-context strong { color: #f1f5f9; font-size: 0.86rem; }
.context-label, .eyebrow { color: var(--crm-blue); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }

/* Collapsed Mini Rail Mode */
.crm-shell.crm-sidebar-collapsed .crm-sidebar {
  width: var(--crm-sidebar-collapsed-width) !important;
}

.crm-shell.crm-sidebar-collapsed .crm-workspace {
  margin-left: var(--crm-sidebar-collapsed-width);
}

.crm-shell.crm-sidebar-collapsed .crm-brand-row {
  justify-content: center;
  padding: 0.85rem 0.5rem;
}

.crm-shell.crm-sidebar-collapsed .crm-brand {
  display: none !important;
}

.crm-shell.crm-sidebar-collapsed #sidebarCollapseBtnSidebar {
  display: grid !important;
  margin: 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--crm-brand);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  align-items: center;
  justify-content: center;
}

.crm-shell.crm-sidebar-collapsed #sidebarCollapseBtnSidebar:hover {
  background: var(--crm-brand);
  color: #ffffff;
  border-color: var(--crm-brand);
  transform: scale(1.08);
}

[data-bs-theme="light"] .crm-shell.crm-sidebar-collapsed #sidebarCollapseBtnSidebar {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--crm-brand);
}

[data-bs-theme="light"] .crm-shell.crm-sidebar-collapsed #sidebarCollapseBtnSidebar:hover {
  background: var(--crm-brand);
  color: #ffffff;
  border-color: var(--crm-brand);
}

.crm-shell.crm-sidebar-collapsed .brand-text,
.crm-shell.crm-sidebar-collapsed .nav-primary-text,
.crm-shell.crm-sidebar-collapsed .nav-group-title,
.crm-shell.crm-sidebar-collapsed .nav-group-arrow,
.crm-shell.crm-sidebar-collapsed .nav-sub-text,
.crm-shell.crm-sidebar-collapsed .sidebar-context strong,
.crm-shell.crm-sidebar-collapsed .sidebar-context span {
  display: none !important;
}

.crm-shell.crm-sidebar-collapsed .crm-nav-primary {
  justify-content: center;
  padding: 0.55rem;
}

.crm-shell.crm-sidebar-collapsed .nav-group-header {
  justify-content: center;
  padding: 0.5rem;
}

.crm-shell.crm-sidebar-collapsed .nav-sub-list {
  padding-left: 0;
  margin-left: 0;
  border-left: 0;
}

.crm-shell.crm-sidebar-collapsed .nav-sub-link {
  justify-content: center;
  padding: 0.4rem;
}

.crm-shell.crm-sidebar-collapsed .sidebar-context {
  align-items: center;
  padding: 0.5rem;
}

/* Workspace & Topbar */
.crm-workspace {
  min-width: 0;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.crm-topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 4.5rem;
  padding: 0.65rem clamp(1rem, 3vw, 2rem);
  background: rgba(9, 9, 11, 0.94);
  border-bottom: 1px solid var(--crm-border);
  backdrop-filter: blur(14px);
}

.topbar-spacer { flex: 1; }

/* Topbar Global Search */
.topbar-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: #141417;
  border: 1px solid var(--crm-border-light);
  border-radius: 0.65rem;
  padding: 0.45rem 0.85rem;
  width: 22rem;
  gap: 0.6rem;
  transition: all 0.18s ease;
}

.topbar-search-wrapper:focus-within {
  border-color: var(--crm-blue);
  box-shadow: 0 0 0 3px rgba(0, 149, 182, 0.22);
  background: #18181b;
  width: 25rem;
}

.topbar-search-wrapper .search-icon {
  color: #64748b;
  font-size: 0.9rem;
}

.topbar-search-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: #fff;
  font-size: 0.86rem;
}

.topbar-search-input::placeholder {
  color: #64748b;
}

.search-shortcut {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--crm-border);
  border-radius: 0.35rem;
  padding: 0.15rem 0.45rem;
}

.icon-button, .user-menu { border: 0; background: transparent; }
.icon-button {
  position: relative;
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  color: var(--crm-ink);
  border: 1px solid var(--crm-border);
  border-radius: 0.65rem;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-button:hover {
  background: var(--crm-surface-elevated);
  border-color: var(--crm-border-light);
  color: #fff;
}

.notification-dot {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 0.48rem;
  height: 0.48rem;
  background: #ef4444;
  border: 2px solid #09090b;
  border-radius: 50%;
}

/* Quick Create Menu */
.quick-create-menu {
  background: var(--crm-surface-elevated);
  border: 1px solid var(--crm-border);
  border-radius: 0.75rem;
  min-width: 14rem;
  padding: 0.5rem;
}

.quick-create-menu .dropdown-item {
  border-radius: 0.45rem;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.quick-create-menu .dropdown-item:hover {
  background: rgba(0, 149, 182, 0.15);
  color: #fff;
}

/* Notification Dropdown */
.notification-dropdown {
  background: var(--crm-surface-elevated);
  border: 1px solid var(--crm-border);
  border-radius: 0.85rem;
  overflow: hidden;
}

.notification-item {
  transition: background 0.15s ease;
}

.notification-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.notification-badge-icon {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  min-width: 2.2rem;
  place-items: center;
  border-radius: 0.6rem;
  font-size: 1rem;
}

/* User Menu */
.user-dropdown-menu {
  background: var(--crm-surface-elevated);
  border: 1px solid var(--crm-border);
  border-radius: 0.85rem;
  min-width: 16.5rem;
  padding: 0.5rem;
}

.user-dropdown-menu .dropdown-item {
  border-radius: 0.45rem;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.user-dropdown-menu .dropdown-item:hover {
  background: rgba(0, 149, 182, 0.15);
  color: #fff;
}

.theme-segmented-group {
  background: var(--crm-surface-elevated);
  padding: 0.2rem;
  border-radius: 0.5rem;
  border: 1px solid var(--crm-border);
}

.theme-segmented-group .btn {
  border: 0;
  border-radius: 0.35rem !important;
  color: var(--crm-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  transition: all 0.15s ease;
}

.theme-segmented-group .btn:hover {
  background: var(--crm-surface);
  color: var(--crm-ink);
}

.theme-segmented-group .btn.active {
  background: #0095B6 !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.user-menu {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  padding: 0.2rem 0.65rem 0.2rem 0.35rem;
  color: var(--crm-ink);
  border: 1px solid var(--crm-border);
  border-radius: 0.65rem;
  cursor: pointer;
  height: 2.6rem;
  transition: all 0.15s ease;
}

.user-menu:hover {
  background: var(--crm-surface-elevated);
  border-color: var(--crm-border-light);
}
.user-avatar {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #0095B6, #00637a);
  border-radius: 0.65rem;
  font-size: 0.8rem;
  font-weight: 750;
}

.user-copy { display: none; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-copy small { color: var(--crm-muted); }

/* Main Content Area */
.crm-content {
  width: min(100%, 96rem);
  padding: 1.4rem clamp(1rem, 3vw, 2.2rem) 3rem;
  margin-inline: auto;
}

.page-heading { margin-bottom: 1.35rem; }
.page-heading h1 { margin: 0.25rem 0 0; font-size: clamp(1.55rem, 3vw, 2rem); font-weight: 750; letter-spacing: -0.025em; color: #f8fafc; }
.breadcrumb { margin: 0; font-size: 0.82rem; }
.breadcrumb-item.active { color: var(--crm-muted); }

.welcome-panel, .module-intro {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1.3rem, 3vw, 2.2rem);
  margin-bottom: 1.75rem;
  background: linear-gradient(125deg, #111113 35%, #1c1c20);
  border: 1px solid var(--crm-border);
  border-radius: 1rem;
  box-shadow: 0 12px 36px rgba(0,0,0,.45);
}

.welcome-panel h2, .module-intro h2 { margin: 0.3rem 0 0.45rem; font-size: clamp(1.4rem, 3vw, 2.05rem); font-weight: 750; color: #fff; }
.welcome-panel p, .module-intro p, .module-card p { max-width: 48rem; margin: 0; color: var(--crm-muted); }

.btn {
  font-weight: 600;
  border-radius: 0.55rem;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn-primary, a.btn-primary {
  background: #0095B6 !important;
  border: 1px solid #00829e !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 149, 182, 0.25) !important;
}
.btn-primary:hover, a.btn-primary:hover {
  background: #007a95 !important;
  border-color: #006b82 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 149, 182, 0.35) !important;
}
.btn-primary:active, a.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 149, 182, 0.25) !important;
}

.btn-outline-primary, a.btn-outline-primary {
  color: #0095B6 !important;
  border: 1px solid #0095B6 !important;
  background: transparent !important;
}
.btn-outline-primary:hover, a.btn-outline-primary:hover {
  background: #0095B6 !important;
  border-color: #0095B6 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 149, 182, 0.25) !important;
}

.btn-outline-secondary, a.btn-outline-secondary {
  color: var(--crm-muted) !important;
  border: 1px solid var(--crm-border) !important;
  background: transparent !important;
}
.btn-outline-secondary:hover, a.btn-outline-secondary:hover {
  color: var(--crm-ink) !important;
  border-color: var(--crm-border-light) !important;
  background: var(--crm-surface-elevated) !important;
  transform: translateY(-1px);
}
.btn-outline-secondary.active, .btn-outline-secondary:active {
  color: #ffffff !important;
  background-color: #27272a !important;
  border-color: #3f3f46 !important;
}

.section-heading { display: flex; gap: 1rem; align-items: end; justify-content: space-between; margin-bottom: 1rem; }
.section-heading h2 { margin: 0.2rem 0 0; font-size: 1.25rem; font-weight: 750; color: #f1f5f9; }
.status-pill { display: inline-flex; gap: 0.35rem; align-items: center; width: fit-content; padding: 0.28rem 0.58rem; color: #34d399; background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.25); border-radius: 999px; font-size: 0.73rem; font-weight: 700; white-space: nowrap; }

.workspace-grid, .module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.workspace-card, .module-card { min-width: 0; padding: 1.2rem; background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: 0.85rem; box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.workspace-card { display: flex; flex-direction: column; gap: 0.42rem; color: var(--crm-ink); text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.workspace-card:hover { color: #fff; border-color: #0095B6; box-shadow: 0 12px 30px rgba(0, 149, 182, .15); transform: translateY(-2px); }
.workspace-card span:last-child { color: var(--crm-muted); font-size: 0.88rem; }
.card-icon { display: grid; width: 2.3rem; height: 2.3rem; margin-bottom: 0.55rem; place-items: center; color: #14b8dc; background: rgba(0, 149, 182, .15); border-radius: 0.65rem; }
.module-card { scroll-margin-top: 6rem; }
.module-card-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.module-card h2 { margin: 0.3rem 0 0.45rem; font-size: 1.05rem; font-weight: 750; color: #f1f5f9; }

.empty-state { max-width: 44rem; padding: clamp(1.5rem, 4vw, 3rem); margin: 3rem auto; text-align: center; background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: 1rem; }
.empty-state p { color: var(--crm-muted); }
.empty-icon { display: grid; width: 3.25rem; height: 3.25rem; margin: 0 auto 1rem; place-items: center; color: #fff; background: var(--crm-blue); border-radius: 0.9rem; font-weight: 750; }

/* Interactive Enterprise Empty State */
.crm-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.crm-empty-state-icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  background: rgba(0, 149, 182, 0.1);
  color: #0095B6;
  font-size: 1.6rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(0, 149, 182, 0.15);
}

.crm-empty-state h4 {
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--crm-ink);
  margin-bottom: 0.35rem;
}

.crm-empty-state p {
  color: var(--crm-muted);
  font-size: 0.88rem;
  max-width: 26rem;
  margin-bottom: 1.25rem;
}

/* Breadcrumb Navigation */
.crm-breadcrumb-nav .breadcrumb {
  font-size: 0.82rem;
  margin: 0;
}
.crm-breadcrumb-nav .breadcrumb-item a {
  color: var(--crm-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.crm-breadcrumb-nav .breadcrumb-item a:hover {
  color: #0095B6;
}
.crm-breadcrumb-nav .breadcrumb-item.active {
  color: var(--crm-ink);
  font-weight: 500;
}

/* Form Controls & Labels */
.form-label {
  font-size: 0.73rem !important;
  font-weight: 750 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--crm-muted) !important;
  margin-bottom: 0.35rem;
}

/* Bootstrap Overrides */
.card {
  background-color: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 0.85rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
}
.card-header, .card-footer { background-color: var(--crm-surface-elevated) !important; border-color: var(--crm-border); color: var(--crm-ink); }
.card.bg-dark { background-color: var(--crm-surface) !important; border-color: var(--crm-border) !important; }
.card-header.bg-dark, .card-footer.bg-dark { background-color: var(--crm-surface-elevated) !important; border-color: var(--crm-border) !important; }
.bg-white { background-color: var(--crm-surface) !important; color: var(--crm-ink) !important; }

/* Enhanced Table */
.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,.02);
  --bs-table-hover-bg: rgba(0, 149, 182, .04);
  --bs-table-border-color: var(--crm-border);
  color: var(--crm-ink);
  margin-bottom: 0;
  vertical-align: middle;
}
.table thead th,
.table-light th {
  background-color: var(--crm-surface-elevated) !important;
  color: var(--crm-muted) !important;
  font-size: 0.73rem !important;
  font-weight: 750 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  padding: 0.85rem 1rem !important;
  border-bottom: 1px solid var(--crm-border) !important;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--crm-border);
  font-size: 0.88rem;
  vertical-align: middle;
}
.table tbody tr {
  transition: background-color 0.15s ease;
}
.table tbody tr:hover {
  background-color: rgba(0, 149, 182, 0.035) !important;
}

.table-light { --bs-table-bg: var(--crm-surface-elevated) !important; --bs-table-color: var(--crm-ink) !important; }
.form-control, .form-select {
  background-color: #141417;
  border: 1px solid var(--crm-border);
  color: var(--crm-ink);
  border-radius: 0.6rem;
  padding: 0.52rem 0.85rem;
  font-size: 0.88rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:hover, .form-select:hover {
  border-color: var(--crm-border-light);
}
.form-control.bg-dark, .form-select.bg-dark { background-color: #141417 !important; border-color: var(--crm-border) !important; color: var(--crm-ink) !important; }
.form-control:focus, .form-select:focus {
  background-color: #18181b;
  border-color: var(--crm-blue) !important;
  color: #fff;
  box-shadow: 0 0 0 0.22rem rgba(0, 149, 182, .25) !important;
}
.input-group-text { background-color: var(--crm-surface-elevated); border-color: var(--crm-border); color: var(--crm-muted); border-radius: 0.6rem; }
.input-group-text.bg-dark { background-color: var(--crm-surface-elevated) !important; border-color: var(--crm-border) !important; color: var(--crm-muted) !important; }
.border-secondary { border-color: var(--crm-border) !important; }

/* Badges */
.badge {
  font-weight: 650;
  font-size: 0.72rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.badge.bg-danger {
  background-color: rgba(239, 68, 68, 0.12) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
}
.badge.bg-warning {
  background-color: rgba(245, 158, 11, 0.12) !important;
  color: #d97706 !important;
  border: 1px solid rgba(245, 158, 11, 0.25) !important;
}
.badge.bg-secondary {
  background-color: rgba(100, 116, 139, 0.12) !important;
  color: #64748b !important;
  border: 1px solid rgba(100, 116, 139, 0.22) !important;
}
.badge.bg-success {
  background-color: rgba(16, 185, 129, 0.12) !important;
  color: #059669 !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
}
.badge.bg-primary {
  background-color: rgba(0, 149, 182, 0.12) !important;
  color: #0095B6 !important;
  border: 1px solid rgba(0, 149, 182, 0.25) !important;
}
.badge.bg-dark { background-color: #27272a !important; border-color: var(--crm-border) !important; color: var(--crm-ink) !important; }
.nav-tabs { border-bottom-color: var(--crm-border); }
.nav-tabs .nav-link { color: var(--crm-muted); border-color: transparent; }
.nav-tabs .nav-link:hover { color: var(--crm-ink); border-color: var(--crm-border) var(--crm-border) transparent; }
.nav-tabs .nav-link.active { color: #fff; background-color: var(--crm-surface); border-color: var(--crm-border) var(--crm-border) transparent; }
.dropdown-menu { background-color: var(--crm-surface-elevated); border-color: var(--crm-border); }
.dropdown-menu.bg-dark { background-color: var(--crm-surface-elevated) !important; border-color: var(--crm-border) !important; }
.dropdown-item { color: var(--crm-ink); }
.dropdown-item:hover { background-color: rgba(255, 255, 255, 0.07); color: #fff; }
.dropdown-divider { border-top-color: var(--crm-border); }

@media (min-width: 992px) {
  .crm-sidebar { position: fixed; inset: 0 auto 0 0; visibility: visible !important; transform: none !important; }
  .crm-workspace { margin-left: var(--crm-sidebar-width); }
  .user-copy { display: flex; }
}

@media (max-width: 767.98px) {
  .welcome-panel, .module-intro { align-items: flex-start; flex-direction: column; }
  .welcome-panel .btn { width: 100%; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Authentication Page Dark Styling */
.authentication-page { min-height: 100vh; background: #000000; }
.authentication-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(20rem, 1fr) minmax(22rem, .85fr); }
.authentication-brand { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(2rem, 6vw, 5rem); color: #fff; background: radial-gradient(circle at 20% 20%, #27272a, transparent 55%), #09090b; border-right: 1px solid var(--crm-border); }
.authentication-brand h1 { max-width: 42rem; margin: 0.8rem 0 1rem; font-size: clamp(2.2rem, 5vw, 4.5rem); font-weight: 780; letter-spacing: -0.045em; color: #fff; }
.authentication-brand p { max-width: 38rem; color: var(--crm-muted); font-size: 1.05rem; }
.authentication-brand .eyebrow { color: #14b8dc; }
.authentication-content { display: grid; padding: clamp(1rem, 5vw, 4rem); place-items: center; background: #000000; }
.login-card { width: min(100%, 29rem); padding: clamp(1.5rem, 4vw, 2.5rem); background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: 1rem; box-shadow: 0 22px 60px rgba(0,0,0,.6); }
.login-card h2 { margin: 0.4rem 0 0.35rem; font-size: 1.75rem; font-weight: 760; color: #fff; }
.login-card > p { color: var(--crm-muted); }
.form-field { margin-top: 1.15rem; }
.form-field label { display: block; margin-bottom: 0.4rem; font-size: 0.88rem; font-weight: 700; color: #cbd5e1; }
.login-submit { width: 100%; min-height: 2.9rem; margin-top: 1.35rem; font-weight: 700; }
.login-help { padding-top: 1rem; margin: 1.4rem 0 0; border-top: 1px solid var(--crm-border); font-size: 0.82rem; text-align: center; color: var(--crm-muted); }
.validation-summary, .field-validation-error { color: #f87171; font-size: 0.84rem; }
.validation-summary ul { padding-left: 1.1rem; margin: 0.8rem 0 0; }
.input-validation-error { border-color: #ef4444; }

@media (max-width: 799.98px) {
  .authentication-shell { display: block; background: #000000; }
  .authentication-brand { min-height: 15rem; padding: 1.5rem; }
  .authentication-brand h1 { margin-top: 2rem; font-size: 2rem; }
  .authentication-content { padding: 1rem; }
  .login-card { margin: -2rem auto 1rem; }
}

/* Dashboard Enhanced Components */
.dashboard-kpi-card {
  position: relative;
  overflow: hidden;
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 0.85rem;
  padding: 1.25rem;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.dashboard-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 149, 182, 0.4);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.dashboard-kpi-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 0.65rem;
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.dashboard-kpi-card:hover .dashboard-kpi-icon {
  transform: scale(1.1);
}

.dashboard-chart-card {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.dashboard-chart-card .card-header {
  background: var(--crm-surface-elevated) !important;
  border-bottom: 1px solid var(--crm-border);
  padding: 0.85rem 1.25rem;
}

.chart-container-box {
  position: relative;
  padding: 1rem;
  width: 100%;
}

.chart-segmented-toggle .btn {
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 0.45rem;
}

/* Theme Dropdown Menu */
.theme-dropdown-menu .theme-option-btn.active .theme-check {
  display: inline-block !important;
}
.theme-dropdown-menu .theme-option-btn.active {
  background-color: rgba(0, 149, 182, 0.12);
  font-weight: 600;
}
.theme-dropdown-menu .theme-option-btn:hover {
  background-color: rgba(0, 149, 182, 0.15);
}

/* Light Theme Component Overrides */
[data-bs-theme="light"] .crm-sidebar {
  color: var(--crm-ink);
  background: #ffffff;
  border-right-color: var(--crm-border);
}
[data-bs-theme="light"] .crm-brand-row {
  background: #ffffff;
  border-bottom-color: var(--crm-border);
}
[data-bs-theme="light"] .crm-brand {
  color: var(--crm-ink);
}
[data-bs-theme="light"] .crm-brand:hover {
  color: var(--crm-blue);
}
[data-bs-theme="light"] .brand-text {
  color: #0f172a;
}
[data-bs-theme="light"] .crm-nav-primary {
  color: var(--crm-blue-dark);
  background: rgba(0, 149, 182, 0.08);
  border-color: rgba(0, 149, 182, 0.2);
}
[data-bs-theme="light"] .crm-nav-primary:hover {
  color: #00647a;
  background: rgba(0, 149, 182, 0.16);
  border-color: rgba(0, 149, 182, 0.35);
}
[data-bs-theme="light"] .nav-group-header {
  color: #475569;
}
[data-bs-theme="light"] .nav-group-header:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}
[data-bs-theme="light"] .nav-group-icon {
  color: #64748b;
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}
[data-bs-theme="light"] .nav-group-header:hover .nav-group-icon {
  color: #0f172a;
}
[data-bs-theme="light"] .nav-sub-link {
  color: #64748b;
}
[data-bs-theme="light"] .nav-sub-link:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}
[data-bs-theme="light"] .nav-sub-link.active {
  color: var(--crm-blue-dark);
  background: rgba(0, 149, 182, 0.1);
  border-left-color: var(--crm-blue);
}
[data-bs-theme="light"] .nav-sub-list {
  border-left-color: rgba(0, 0, 0, 0.08);
}
[data-bs-theme="light"] .sidebar-context {
  color: #64748b;
  background: #f8fafc;
  border-color: var(--crm-border);
}
[data-bs-theme="light"] .sidebar-context strong {
  color: #0f172a;
}
[data-bs-theme="light"] .crm-topbar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: var(--crm-border);
}
[data-bs-theme="light"] .topbar-search-wrapper {
  background: #f8fafc;
  border-color: var(--crm-border-light);
}
[data-bs-theme="light"] .topbar-search-wrapper:focus-within {
  background: #ffffff;
  border-color: var(--crm-blue);
  box-shadow: 0 0 0 3px rgba(0, 149, 182, 0.15);
}
[data-bs-theme="light"] .topbar-search-input {
  color: #0f172a;
}
[data-bs-theme="light"] .topbar-search-input::placeholder {
  color: #94a3b8;
}
[data-bs-theme="light"] .search-shortcut {
  background: #f1f5f9;
  border-color: var(--crm-border);
  color: var(--crm-muted);
}
[data-bs-theme="light"] .sidebar-toggle-btn {
  color: #475569;
  background: rgba(0, 0, 0, 0.03);
  border-color: var(--crm-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
[data-bs-theme="light"] .sidebar-toggle-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
  border-color: var(--crm-border-light);
}
[data-bs-theme="light"] .icon-button {
  color: var(--crm-ink);
  border-color: var(--crm-border);
}
[data-bs-theme="light"] .icon-button:hover {
  background: var(--crm-surface-elevated);
  border-color: var(--crm-border-light);
  color: var(--crm-ink);
}
[data-bs-theme="light"] .user-menu {
  color: var(--crm-ink);
  border-color: var(--crm-border);
  background: var(--crm-surface);
}
[data-bs-theme="light"] .user-menu:hover {
  background: var(--crm-surface-elevated);
  border-color: var(--crm-border-light);
}
[data-bs-theme="light"] .theme-segmented-group {
  background: #f1f5f9;
  border-color: var(--crm-border);
}
[data-bs-theme="light"] .theme-segmented-group .btn {
  color: #64748b;
}
[data-bs-theme="light"] .theme-segmented-group .btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
[data-bs-theme="light"] .theme-segmented-group .btn.active {
  background: #0095B6 !important;
  color: #ffffff !important;
}
[data-bs-theme="light"] .page-heading h1 {
  color: #0f172a;
}
[data-bs-theme="light"] .welcome-panel,
[data-bs-theme="light"] .module-intro {
  background: linear-gradient(125deg, #ffffff 35%, #f1f5f9);
  border-color: var(--crm-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
[data-bs-theme="light"] .welcome-panel h2,
[data-bs-theme="light"] .module-intro h2,
[data-bs-theme="light"] .section-heading h2,
[data-bs-theme="light"] .module-card h2 {
  color: #0f172a;
}
[data-bs-theme="light"] .workspace-card,
[data-bs-theme="light"] .module-card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
[data-bs-theme="light"] .empty-state {
  background: #ffffff;
  border-color: var(--crm-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
[data-bs-theme="light"] .card {
  background-color: var(--crm-surface);
  border-color: var(--crm-border);
  color: var(--crm-ink);
}
[data-bs-theme="light"] .card.bg-dark {
  background-color: var(--crm-surface) !important;
}
[data-bs-theme="light"] .card-header.bg-dark,
[data-bs-theme="light"] .card-footer.bg-dark {
  background-color: var(--crm-surface-elevated) !important;
  color: var(--crm-ink) !important;
}
[data-bs-theme="light"] .card-header.bg-dark h2,
[data-bs-theme="light"] .card-header.bg-dark h5,
[data-bs-theme="light"] .card-header.bg-dark h6,
[data-bs-theme="light"] .card-header.bg-dark .text-white,
[data-bs-theme="light"] .card-header.bg-dark .text-light,
[data-bs-theme="light"] .card-title.text-white {
  color: var(--crm-ink) !important;
}
[data-bs-theme="light"] .form-label.text-light {
  color: var(--crm-ink) !important;
}
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
  background-color: #ffffff;
  border-color: var(--crm-border-light);
  color: var(--crm-ink);
}
[data-bs-theme="light"] .form-control.bg-dark,
[data-bs-theme="light"] .form-select.bg-dark {
  background-color: #ffffff !important;
  border-color: var(--crm-border-light) !important;
  color: var(--crm-ink) !important;
}
[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
  background-color: #ffffff;
  border-color: var(--crm-blue);
  color: var(--crm-ink);
  box-shadow: 0 0 0 0.22rem rgba(0, 149, 182, 0.18);
}
[data-bs-theme="light"] .form-control.text-light,
[data-bs-theme="light"] .form-select.text-light {
  color: var(--crm-ink) !important;
}
[data-bs-theme="light"] .input-group-text.bg-dark {
  background-color: var(--crm-surface-elevated) !important;
  border-color: var(--crm-border-light) !important;
  color: var(--crm-muted) !important;
}
[data-bs-theme="light"] .dropdown-menu {
  background-color: #ffffff;
  border-color: var(--crm-border);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}
[data-bs-theme="light"] .dropdown-menu.bg-dark {
  background-color: #ffffff !important;
}
[data-bs-theme="light"] .dropdown-item {
  color: var(--crm-ink);
}
[data-bs-theme="light"] .dropdown-item:hover {
  background-color: rgba(0, 149, 182, 0.08);
  color: var(--crm-blue-dark);
}
[data-bs-theme="light"] .dropdown-header {
  color: var(--crm-muted) !important;
}
[data-bs-theme="light"] .table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(0, 0, 0, 0.02);
  --bs-table-hover-bg: rgba(0, 149, 182, 0.035);
  --bs-table-border-color: var(--crm-border);
  color: var(--crm-ink);
}
[data-bs-theme="light"] .table thead th,
[data-bs-theme="light"] .table-light th {
  background-color: #f8fafc !important;
  color: #64748b !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
[data-bs-theme="light"] .table tbody td {
  border-bottom: 1px solid #f1f5f9;
}
[data-bs-theme="light"] .table tbody tr:hover {
  background-color: rgba(0, 149, 182, 0.035) !important;
}
[data-bs-theme="light"] .card {
  background-color: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}
[data-bs-theme="light"] .btn-outline-secondary {
  color: #475569 !important;
  border-color: #cbd5e1 !important;
  background-color: #ffffff !important;
}
[data-bs-theme="light"] .btn-outline-secondary:hover {
  color: #0f172a !important;
  border-color: #94a3b8 !important;
  background-color: #f8fafc !important;
}
[data-bs-theme="light"] .badge.bg-danger {
  background-color: rgba(239, 68, 68, 0.1) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
}
[data-bs-theme="light"] .badge.bg-warning {
  background-color: rgba(245, 158, 11, 0.1) !important;
  color: #b45309 !important;
  border: 1px solid rgba(245, 158, 11, 0.25) !important;
}
[data-bs-theme="light"] .badge.bg-secondary {
  background-color: rgba(100, 116, 139, 0.1) !important;
  color: #475569 !important;
  border: 1px solid rgba(100, 116, 139, 0.2) !important;
}
[data-bs-theme="light"] .badge.bg-success {
  background-color: rgba(16, 185, 129, 0.1) !important;
  color: #047857 !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
}
[data-bs-theme="light"] .badge.bg-primary {
  background-color: rgba(0, 149, 182, 0.1) !important;
  color: #007a95 !important;
  border: 1px solid rgba(0, 149, 182, 0.25) !important;
}
[data-bs-theme="light"] .dashboard-kpi-card {
  background: var(--crm-surface);
  border-color: var(--crm-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
[data-bs-theme="light"] .dashboard-kpi-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
[data-bs-theme="light"] .dashboard-chart-card {
  background: var(--crm-surface);
  border-color: var(--crm-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
[data-bs-theme="light"] .dashboard-chart-card .card-header {
  background: var(--crm-surface-elevated) !important;
  border-bottom-color: var(--crm-border);
}
[data-bs-theme="light"] .user-dropdown-menu .fw-bold.text-white {
  color: var(--crm-ink) !important;
}
[data-bs-theme="light"] .theme-dropdown-menu .theme-option-btn.active {
  background-color: rgba(0, 149, 182, 0.08);
  color: var(--crm-blue-dark);
}
[data-bs-theme="light"] .authentication-page {
  background: #f1f5f9;
}
[data-bs-theme="light"] .authentication-shell {
  background: #f8fafc;
}
[data-bs-theme="light"] .authentication-brand {
  background: radial-gradient(circle at 20% 20%, #e0f7fa, #f1f5f9 60%);
  border-right-color: var(--crm-border);
  color: var(--crm-ink);
}
[data-bs-theme="light"] .authentication-brand h1 {
  color: #0f172a;
}
[data-bs-theme="light"] .authentication-content {
  background: #f1f5f9;
}
[data-bs-theme="light"] .login-card {
  background: #ffffff;
  border-color: var(--crm-border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}
[data-bs-theme="light"] .login-card h2 {
  color: #0f172a;
}
[data-bs-theme="light"] .form-field label {
  color: #334155;
}
[data-bs-theme="light"] label.form-check-label.bg-black {
  background-color: var(--crm-surface-elevated) !important;
  border-color: var(--crm-border) !important;
}
[data-bs-theme="light"] label.form-check-label .text-light {
  color: var(--crm-ink) !important;
}

.list-group-item.active {
  background-color: var(--crm-blue) !important;
  border-color: var(--crm-blue) !important;
  color: #ffffff !important;
}

/* Quill Rich Text Editor */
.crm-quill-wrapper {
  display: flex;
  flex-direction: column;
}

.ql-toolbar.ql-snow {
  border: 1px solid var(--crm-border, #334155) !important;
  background-color: var(--crm-surface-elevated, #1e293b) !important;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  padding: 8px 12px;
}

.ql-container.ql-snow {
  border: 1px solid var(--crm-border, #334155) !important;
  border-top: none !important;
  background-color: var(--crm-surface, #0f172a) !important;
  color: var(--crm-ink, #f8fafc) !important;
  font-family: inherit;
  font-size: 0.95rem;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
  min-height: 140px;
}

.ql-editor {
  min-height: 120px;
  font-family: inherit;
  font-size: 0.95rem;
}

.ql-editor.ql-blank::before {
  color: var(--crm-muted, #94a3b8) !important;
  font-style: normal;
}

/* Toolbar icons in dark mode */
[data-bs-theme="dark"] .ql-snow .ql-stroke {
  stroke: #cbd5e1 !important;
}

[data-bs-theme="dark"] .ql-snow .ql-fill {
  fill: #cbd5e1 !important;
}

[data-bs-theme="dark"] .ql-snow .ql-picker {
  color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .ql-snow .ql-picker-options {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #f8fafc !important;
}

[data-bs-theme="dark"] .ql-snow .ql-picker-item:hover,
[data-bs-theme="dark"] .ql-snow .ql-picker-item.ql-selected {
  color: #0095B6 !important;
}

/* Light mode */
[data-bs-theme="light"] .ql-toolbar.ql-snow {
  border: 1px solid #dee2e6 !important;
  background-color: #f8f9fa !important;
}

[data-bs-theme="light"] .ql-container.ql-snow {
  border: 1px solid #dee2e6 !important;
  border-top: none !important;
  background-color: #ffffff !important;
  color: #212529 !important;
}

[data-bs-theme="light"] .ql-editor.ql-blank::before {
  color: #6c757d !important;
}

/* Focus state */
.crm-quill-wrapper:focus-within .ql-toolbar.ql-snow,
.crm-quill-wrapper:focus-within .ql-container.ql-snow {
  border-color: #0095B6 !important;
}

.lead-description {
  line-height: 1.6;
}

.lead-description p:last-child {
  margin-bottom: 0;
}

.lead-description ul,
.lead-description ol {
  padding-left: 1.25rem;
}

/* ==========================================================================
   Interactive Left Navbar & Light Mode Polish
   ========================================================================== */
[data-bs-theme="light"] .crm-sidebar {
  background: #ffffff !important;
  border-right-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-bs-theme="light"] .crm-brand-row {
  background: #ffffff !important;
  border-bottom-color: #e2e8f0 !important;
}

[data-bs-theme="light"] .crm-brand .brand-text {
  color: #0f172a !important;
}

[data-bs-theme="light"] .sidebar-toggle-btn {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}

[data-bs-theme="light"] .sidebar-toggle-btn:hover {
  background: rgba(0, 149, 182, 0.12) !important;
  border-color: #0095B6 !important;
  color: #0095B6 !important;
}

[data-bs-theme="light"] .sidebar-filter-input {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-bs-theme="light"] .sidebar-filter-input:focus {
  background: #ffffff !important;
  border-color: #0095B6 !important;
  box-shadow: 0 0 0 3px rgba(0, 149, 182, 0.18) !important;
  color: #0f172a !important;
}

[data-bs-theme="light"] .sidebar-filter-clear {
  color: #64748b !important;
}

[data-bs-theme="light"] .sidebar-filter-clear:hover {
  color: #e11d48 !important;
}

[data-bs-theme="light"] .crm-nav-primary {
  background: rgba(0, 149, 182, 0.08) !important;
  border-color: rgba(0, 149, 182, 0.22) !important;
  color: #007a95 !important;
}

[data-bs-theme="light"] .crm-nav-primary:hover {
  background: rgba(0, 149, 182, 0.15) !important;
  border-color: rgba(0, 149, 182, 0.4) !important;
  color: #005a6e !important;
}

[data-bs-theme="light"] .nav-primary-icon-box {
  background: rgba(0, 149, 182, 0.15) !important;
  border-color: rgba(0, 149, 182, 0.3) !important;
}

[data-bs-theme="light"] .nav-primary-icon {
  color: #0095B6 !important;
}

[data-bs-theme="light"] .nav-group-header {
  color: #1e293b !important;
}

[data-bs-theme="light"] .nav-group-header:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

[data-bs-theme="light"] .nav-group-icon {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
}

/* Light mode category icon boxes */
[data-bs-theme="light"] .nav-section-group[data-module="sales"] .nav-group-icon {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #059669 !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="sales"]:hover .nav-group-icon,
[data-bs-theme="light"] .nav-section-group[data-module="sales"].is-active-group .nav-group-icon {
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25) !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="activities"] .nav-group-icon {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #d97706 !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="activities"]:hover .nav-group-icon,
[data-bs-theme="light"] .nav-section-group[data-module="activities"].is-active-group .nav-group-icon {
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25) !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="commercial"] .nav-group-icon {
  background: #f5f3ff !important;
  border-color: #ddd6fe !important;
  color: #7c3aed !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="commercial"]:hover .nav-group-icon,
[data-bs-theme="light"] .nav-section-group[data-module="commercial"].is-active-group .nav-group-icon {
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.25) !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="analytics"] .nav-group-icon {
  background: #f0f9ff !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="analytics"]:hover .nav-group-icon,
[data-bs-theme="light"] .nav-section-group[data-module="analytics"].is-active-group .nav-group-icon {
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.25) !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="administration"] .nav-group-icon {
  background: #fff1f2 !important;
  border-color: #fecdd3 !important;
  color: #e11d48 !important;
}

[data-bs-theme="light"] .nav-section-group[data-module="administration"]:hover .nav-group-icon,
[data-bs-theme="light"] .nav-section-group[data-module="administration"].is-active-group .nav-group-icon {
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.25) !important;
}

[data-bs-theme="light"] .nav-group-badge {
  background: #f1f5f9 !important;
  color: #64748b !important;
}

[data-bs-theme="light"] .nav-group-arrow {
  color: #94a3b8 !important;
}

[data-bs-theme="light"] .nav-group-header:not(.collapsed) .nav-group-arrow {
  color: #0095B6 !important;
}

[data-bs-theme="light"] .nav-sub-list {
  border-left-color: #e2e8f0 !important;
}

[data-bs-theme="light"] .nav-sub-item::before {
  background: #e2e8f0 !important;
}

[data-bs-theme="light"] .nav-sub-item:hover::before {
  background: #0095B6 !important;
}

[data-bs-theme="light"] .nav-sub-link {
  color: #475569 !important;
}

[data-bs-theme="light"] .nav-sub-link:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}

[data-bs-theme="light"] .nav-sub-link.active {
  color: #007a95 !important;
  background: linear-gradient(90deg, rgba(0, 149, 182, 0.12) 0%, rgba(0, 149, 182, 0.02) 100%) !important;
  border-left-color: #0095B6 !important;
}

[data-bs-theme="light"] .nav-sub-icon {
  color: #64748b !important;
}

[data-bs-theme="light"] .nav-sub-link:hover .nav-sub-icon {
  color: #0095B6 !important;
}

[data-bs-theme="light"] .nav-sub-link.active .nav-sub-icon {
  color: #007a95 !important;
}

[data-bs-theme="light"] .nav-sub-count-badge {
  background: #f1f5f9 !important;
  color: #64748b !important;
}

[data-bs-theme="light"] .nav-sub-link:hover .nav-sub-count-badge {
  background: rgba(0, 149, 182, 0.15) !important;
  color: #007a95 !important;
}

[data-bs-theme="light"] .nav-quick-add-btn {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}

[data-bs-theme="light"] .nav-quick-add-btn:hover {
  background: #0095B6 !important;
  border-color: #0095B6 !important;
  color: #ffffff !important;
}

[data-bs-theme="light"] .sidebar-context {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
}

[data-bs-theme="light"] .sidebar-context strong {
  color: #0f172a !important;
}

/* Collapsed Mini-Rail Interactivity */
.crm-shell.crm-sidebar-collapsed .sidebar-search-box {
  display: none !important;
}

.crm-shell.crm-sidebar-collapsed .nav-quick-add-btn,
.crm-shell.crm-sidebar-collapsed .nav-group-badge,
.crm-shell.crm-sidebar-collapsed .nav-sub-count-badge {
  display: none !important;
}

.crm-shell.crm-sidebar-collapsed .nav-sub-item::before,
.crm-shell.crm-sidebar-collapsed .nav-sub-item::after {
  display: none !important;
}

