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

/* ========================================================
   QUBENIX OS — CANONICAL DESIGN SYSTEM (PHASE 1)
   Architecture, Design Tokens & Core Component Primitives
   ======================================================== */

:root {
  /* ========================================================
     1. TYPOGRAPHY TOKENS (INTER & SYSTEM UI)
     ======================================================== */
  --qb-font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --qb-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Font Weights */
  --qb-font-weight-light: 300;
  --qb-font-weight-regular: 400;
  --qb-font-weight-medium: 500;
  --qb-font-weight-semibold: 600;
  --qb-font-weight-bold: 700;
  --qb-font-weight-extrabold: 800;

  /* Type Scale */
  --qb-text-display: 600 1.75rem/1.2 var(--qb-font-sans);
  --qb-text-h1: 600 1.25rem/1.25 var(--qb-font-sans);
  --qb-text-h2: 600 1.05rem/1.3 var(--qb-font-sans);
  --qb-text-h3: 600 0.95rem/1.35 var(--qb-font-sans);
  --qb-text-body: 400 0.875rem/1.45 var(--qb-font-sans);
  --qb-text-body-bold: 600 0.875rem/1.45 var(--qb-font-sans);
  --qb-text-small: 400 0.8125rem/1.35 var(--qb-font-sans);
  --qb-text-small-bold: 600 0.8125rem/1.35 var(--qb-font-sans);
  --qb-text-caption: 500 0.75rem/1.35 var(--qb-font-sans);
  --qb-text-label: 600 0.75rem/1.2 var(--qb-font-sans);

  /* ========================================================
     2. OFFICIAL QUBENIX COLOR SYSTEM TOKENS
     ======================================================== */
  /* 2.1 Core Canonical Brand Colors */
  --q-primary: #3C32A3;
  --q-primary-foreground: #FFFFFF;

  --q-accent: #6B5FD1;
  --q-accent-foreground: #FFFFFF;

  --q-background: #FFFFFF;
  --q-surface: #F5F4FB;
  --q-surface-secondary: #F5F4FB;

  --q-text: #141225;
  --q-text-muted: #64748B;
  --q-text-disabled: #ADB5BD;
  --q-text-inverse: #FFFFFF;

  --q-border: #E2E8F0;
  --q-border-subtle: #EDEBF8;
  --q-border-focus: #3C32A3;

  /* 2.2 Primary Shade Scale (Base #3C32A3) */
  --q-primary-50: #F5F4FB;
  --q-primary-100: #EAE8F7;
  --q-primary-200: #D6D2F0;
  --q-primary-300: #B8B0E5;
  --q-primary-400: #9084D6;
  --q-primary-500: #6B5FD1;
  --q-primary-600: #4E42B8;
  --q-primary-700: #3C32A3; /* Base Canonical */
  --q-primary-800: #312885; /* Hover */
  --q-primary-900: #251E66; /* Active */
  --q-primary-950: #171340;

  /* 2.3 Accent Shade Scale (Base #6B5FD1) */
  --q-accent-50: #F7F6FD;
  --q-accent-100: #EEECFB;
  --q-accent-200: #DDD9F7;
  --q-accent-300: #C3BCF1;
  --q-accent-400: #9F94E5;
  --q-accent-500: #6B5FD1; /* Base Accent */
  --q-accent-600: #5648BF;
  --q-accent-700: #4538A2;
  --q-accent-800: #392E83;
  --q-accent-900: #2E266B;
  --q-accent-950: #1B1642;

  /* 2.4 Semantic Colors */
  --q-success: #28A745;
  --q-success-hover: #218838;
  --q-success-light: #EAF7ED;
  --q-success-border: #B8E6C1;
  --q-success-text: #1E7E34;

  --q-warning: #FFC107;
  --q-warning-hover: #E0A800;
  --q-warning-light: #FFF9E6;
  --q-warning-border: #FFE699;
  --q-warning-text: #856404;

  --q-error: #DC3545;
  --q-error-hover: #C82333;
  --q-error-light: #FBEBEB;
  --q-error-border: #F5C6CB;
  --q-error-text: #721C24;

  --q-info: #1F77B4;
  --q-info-hover: #175D8D;
  --q-info-light: #E8F1F8;
  --q-info-border: #BCD5E7;
  --q-info-text: #134B71;

  /* 2.5 Supporting Colors (Contextual & Data Visualizations) */
  --q-sea-blue: #1F77B4;
  --q-orange: #FF7F0E;
  --q-forest: #2CA02C;
  --q-forest-green: #2CA02C;
  --q-red: #D62728;
  --q-deep-red: #D62728;
  --q-lavender: #9467BD;
  --q-brown: #8C564B;

  /* 2.6 Neutral Grayscale System */
  --q-neutral-50: #F8F9FA;
  --q-neutral-100: #F1F3F5;
  --q-neutral-200: #E9ECEF;
  --q-neutral-300: #DEE2E6;
  --q-neutral-400: #CED4DA;
  --q-neutral-500: #ADB5BD;
  --q-neutral-600: #6C757D;
  --q-neutral-700: #495057;
  --q-neutral-800: #343A40;
  --q-neutral-900: #141225;
  --q-neutral-950: #0C0A17;

  /* ========================================================
     3. CANONICAL ALIASES & COMPATIBILITY LAYER
     ======================================================== */
  --qb-brand-50: var(--q-primary-50);
  --qb-brand-100: var(--q-primary-100);
  --qb-brand-200: var(--q-primary-200);
  --qb-brand-300: var(--q-primary-300);
  --qb-brand-400: var(--q-primary-400);
  --qb-brand-500: var(--q-accent-500);
  --qb-brand-600: var(--q-primary-600);
  --qb-brand-700: var(--q-primary-700);
  --qb-brand-800: var(--q-primary-800);
  --qb-brand-900: var(--q-primary-900);
  --qb-brand-950: var(--q-primary-950);
  --qb-brand-glow: rgba(60, 50, 163, 0.25);

  --qb-color-primary: var(--q-primary);
  --qb-color-accent: var(--q-accent);
  --qb-color-background: var(--q-background);
  --qb-color-surface: var(--q-surface);
  --qb-color-text: var(--q-text);

  --color-primary: var(--q-primary);
  --color-accent: var(--q-accent);
  --color-background: var(--q-background);
  --color-surface: var(--q-surface);
  --color-text: var(--q-text);

  /* Surfaces */
  --qb-surface-canvas: var(--q-background);
  --qb-surface-card: #FFFFFF;
  --qb-surface-secondary: var(--q-surface);
  --qb-surface-subtle: var(--q-surface);
  --qb-surface-overlay: #FFFFFF;
  --qb-surface-hover: #F8F7FD;
  --qb-surface-active: var(--q-surface);

  /* Text Hierarchy */
  --qb-text-primary: var(--q-text);
  --qb-text-secondary: #334155;
  --qb-text-muted: var(--q-text-muted);
  --qb-text-disabled: var(--q-text-disabled);
  --qb-text-inverse: var(--q-text-inverse);

  /* Semantic Alerts */
  --qb-semantic-success: var(--q-success);
  --qb-semantic-success-hover: var(--q-success-hover);
  --qb-semantic-success-light: var(--q-success-light);
  --qb-semantic-success-border: var(--q-success-border);
  --qb-semantic-success-text: var(--q-success-text);

  --qb-semantic-warning: var(--q-warning);
  --qb-semantic-warning-hover: var(--q-warning-hover);
  --qb-semantic-warning-light: var(--q-warning-light);
  --qb-semantic-warning-border: var(--q-warning-border);
  --qb-semantic-warning-text: var(--q-warning-text);

  --qb-semantic-error: var(--q-error);
  --qb-semantic-error-hover: var(--q-error-hover);
  --qb-semantic-error-light: var(--q-error-light);
  --qb-semantic-error-border: var(--q-error-border);
  --qb-semantic-error-text: var(--q-error-text);

  --qb-semantic-info: var(--q-info);
  --qb-semantic-info-hover: var(--q-info-hover);
  --qb-semantic-info-light: var(--q-info-light);
  --qb-semantic-info-border: var(--q-info-border);
  --qb-semantic-info-text: var(--q-info-text);

  /* Borders */
  --qb-border-subtle: var(--q-border);
  --qb-border-standard: #CBD5E1;
  --qb-border-strong: #94A3B8;
  --qb-border-focus: var(--q-primary);
  --qb-border-brand-subtle: rgba(60, 50, 163, 0.12);

  /* ========================================================
     4. SPACING SCALE
     ======================================================== */
  --qb-space-1: 4px;
  --qb-space-2: 8px;
  --qb-space-3: 12px;
  --qb-space-4: 16px;
  --qb-space-5: 20px;
  --qb-space-6: 24px;
  --qb-space-8: 32px;
  --qb-space-10: 40px;
  --qb-space-12: 48px;

  /* ========================================================
     5. BORDER RADII
     ======================================================== */
  --qb-radius-sm: 6px;
  --qb-radius-md: 8px;
  --qb-radius-lg: 14px;
  --qb-radius-full: 9999px;

  /* ========================================================
     6. ELEVATION & SHADOWS
     ======================================================== */
  --qb-shadow-xs: 0 1px 2px rgba(20, 18, 37, 0.04);
  --qb-shadow-sm: 0 1px 3px rgba(20, 18, 37, 0.05), 0 1px 2px rgba(20, 18, 37, 0.03);
  --qb-shadow-md: 0 4px 12px rgba(20, 18, 37, 0.08), 0 2px 4px rgba(20, 18, 37, 0.04);
  --qb-shadow-lg: -4px 0 24px rgba(20, 18, 37, 0.12);
  --qb-shadow-xl: 0 20px 25px -5px rgba(20, 18, 37, 0.1), 0 8px 10px -6px rgba(20, 18, 37, 0.05);
  --qb-shadow-brand-glow: 0 4px 14px rgba(60, 50, 163, 0.25);

  /* ========================================================
     7. TRANSITIONS & TIMING
     ======================================================== */
  --qb-transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --qb-transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);

  /* ========================================================
     8. APP SHELL & LAYOUT GEOMETRY TOKENS
     ======================================================== */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 64px;

  /* ========================================================
     9. BACKWARD COMPATIBILITY ALIASES
     ======================================================== */
  --bg-app: var(--qb-surface-canvas);
  --bg-body: var(--qb-surface-canvas);
  --bg-card: var(--qb-surface-card);
  --bg-sidebar: var(--qb-surface-card);
  --bg-topbar: rgba(255, 255, 255, 0.96);
  --bg-input: var(--qb-surface-card);
  --bg-subtle: var(--qb-surface-subtle);

  --text-primary: var(--qb-text-primary);
  --text-secondary: var(--qb-text-secondary);
  --text-muted: var(--qb-text-muted);

  --qubenix-primary: var(--q-primary);
  --qubenix-accent: var(--q-accent);
  --qubenix-primary-hover: var(--q-primary-800);
  --qubenix-primary-active: var(--q-primary-900);
  --qubenix-primary-light: var(--q-primary-50);
  --qubenix-primary-subtle: rgba(60, 50, 163, 0.08);
  --qubenix-primary-border: var(--qb-border-brand-subtle);

  --neon-purple: var(--q-primary);
  --neon-cyan: var(--q-info);
  --neon-pink: var(--q-accent);
  --neon-green: var(--q-success);
  --neon-red: var(--q-error);
  --neon-amber: var(--q-warning);

  --gradient-main: linear-gradient(135deg, #3C32A3 0%, #6B5FD1 100%);
  --gradient-alt: linear-gradient(135deg, #3C32A3 0%, #6B5FD1 100%);

  --glow-purple: 0 4px 14px rgba(60, 50, 163, 0.2);
  --glow-cyan: 0 4px 14px rgba(31, 119, 180, 0.2);
  --qubenix-glow: 0 4px 14px rgba(60, 50, 163, 0.25);

  --border-subtle: var(--qb-border-subtle);
  --border-hover: var(--qb-border-standard);
  --border-color: var(--qb-border-subtle);

  --radius-sm: var(--qb-radius-sm);
  --radius-md: var(--qb-radius-md);
  --radius-lg: var(--qb-radius-lg);
  --radius-card: var(--qb-radius-lg);
  --radius-xl: 20px;

  --shadow-subtle: var(--qb-shadow-sm);
  --shadow-card: var(--qb-shadow-sm);
  --shadow-md: var(--qb-shadow-md);
  --shadow-lg: var(--qb-shadow-lg);

  --transition-fast: var(--qb-transition-fast);
  --transition-normal: var(--qb-transition-normal);
}

html, body {
  font-family: var(--qb-font-sans) !important;
  color: var(--qb-text-primary);
  background-color: var(--qb-surface-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--qb-font-sans);
  color: var(--qb-text-primary);
  font-weight: 600;
  line-height: 1.25;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
h5 { font-size: 0.875rem; font-weight: 600; }
h6 { font-size: 0.8125rem; font-weight: 600; }

p {
  margin-top: 0;
  margin-bottom: 1rem;
  line-height: 1.5;
  color: var(--qb-text-secondary);
}

a {
  color: var(--qb-brand-700);
  text-decoration: none;
  transition: color var(--qb-transition-fast);
}

a:hover {
  color: var(--qb-brand-800);
}

button {
  font-family: inherit;
}

code, pre, kbd, samp, .code-block, .json-payload {
  font-family: var(--qb-font-mono) !important;
}

/* ========================================================
   COMPONENT PRIMITIVES: 1. BUTTON SYSTEM (.qb-btn, .btn)
   ======================================================== */
.qb-btn, .btn, .btn-qubenix-primary, .btn-qubenix-secondary, .qubenix-bottom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  font-family: var(--qb-font-sans);
  font-size: 0.85rem;
  font-weight: var(--qb-font-weight-semibold);
  border-radius: var(--qb-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
  transition: background-color var(--qb-transition-fast), 
              border-color var(--qb-transition-fast), 
              color var(--qb-transition-fast), 
              box-shadow var(--qb-transition-fast), 
              transform var(--qb-transition-fast);
}

.qb-btn svg, .btn svg, .btn-qubenix-primary svg, .btn-qubenix-secondary svg, .qubenix-bottom-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

.qb-btn:focus-visible, .btn:focus-visible, .btn-qubenix-primary:focus-visible, .btn-qubenix-secondary:focus-visible {
  outline: 2px solid var(--qb-brand-700) !important;
  outline-offset: 2px !important;
}

.qb-btn:disabled, .qb-btn.disabled, .btn:disabled, .btn.disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

/* Button Variants */
.qb-btn-primary, .btn-primary, .btn-qubenix-primary, .qubenix-bottom-btn {
  background: var(--qb-brand-700) !important;
  color: var(--qb-text-inverse) !important;
  border-color: transparent !important;
  box-shadow: 0 1px 2px rgba(60, 50, 163, 0.2);
}

.qb-btn-primary:hover, .btn-primary:hover, .btn-qubenix-primary:hover, .qubenix-bottom-btn:hover {
  background: var(--qb-brand-800) !important;
  color: var(--qb-text-inverse) !important;
  box-shadow: 0 4px 12px rgba(60, 50, 163, 0.25);
  transform: translateY(-1px);
}

.qb-btn-primary:active, .btn-primary:active, .btn-qubenix-primary:active, .qubenix-bottom-btn:active {
  background: var(--qb-brand-900) !important;
  transform: translateY(0);
}

.qb-btn-secondary, .btn-secondary, .btn-qubenix-secondary {
  background: var(--qb-surface-card) !important;
  color: var(--qb-text-primary) !important;
  border-color: var(--qb-border-subtle) !important;
  box-shadow: var(--qb-shadow-xs);
}

.qb-btn-secondary:hover, .btn-secondary:hover, .btn-qubenix-secondary:hover {
  background: var(--qb-surface-hover) !important;
  border-color: var(--qb-border-standard) !important;
  color: var(--qb-text-primary) !important;
  transform: translateY(-1px);
}

.qb-btn-secondary:active, .btn-secondary:active, .btn-qubenix-secondary:active {
  background: var(--qb-surface-active) !important;
  transform: translateY(0);
}

.qb-btn-accent, .btn-accent {
  background: var(--qb-brand-500) !important;
  color: var(--qb-text-inverse) !important;
  border-color: transparent !important;
  box-shadow: 0 1px 2px rgba(107, 95, 209, 0.2);
}

.qb-btn-accent:hover, .btn-accent:hover {
  background: var(--q-accent-600) !important;
  box-shadow: 0 4px 12px rgba(107, 95, 209, 0.25);
  transform: translateY(-1px);
}

.qb-btn-ghost, .btn-ghost, .btn-tertiary {
  background: transparent !important;
  color: var(--qb-text-secondary) !important;
  border-color: transparent !important;
}

.qb-btn-ghost:hover, .btn-ghost:hover, .btn-tertiary:hover {
  background: rgba(15, 23, 42, 0.05) !important;
  color: var(--qb-text-primary) !important;
}

.qb-btn-danger, .btn-danger, .btn-destructive {
  background: var(--qb-semantic-error) !important;
  color: var(--qb-text-inverse) !important;
  border-color: transparent !important;
  box-shadow: 0 1px 2px rgba(220, 53, 69, 0.2);
}

.qb-btn-danger:hover, .btn-danger:hover, .btn-destructive:hover {
  background: var(--qb-semantic-error-hover) !important;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.25);
  transform: translateY(-1px);
}

.qb-btn-success, .btn-success {
  background: var(--qb-semantic-success) !important;
  color: var(--qb-text-inverse) !important;
  border-color: transparent !important;
  box-shadow: 0 1px 2px rgba(40, 167, 69, 0.2);
}

.qb-btn-success:hover, .btn-success:hover {
  background: var(--qb-semantic-success-hover) !important;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.25);
  transform: translateY(-1px);
}

/* Icon Buttons */
.qb-btn-icon, .btn-icon, .icon-btn, .action-btn, .table-action-btn, .btn-inline-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--qb-radius-md);
  background: transparent;
  color: var(--qb-text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--qb-transition-fast);
  box-sizing: border-box;
  flex-shrink: 0;
}

.qb-btn-icon:hover, .btn-icon:hover, .icon-btn:hover, .action-btn:hover, .table-action-btn:hover, .btn-inline-retry:hover {
  background: var(--qb-surface-subtle);
  color: var(--qb-text-primary);
  border-color: var(--qb-border-subtle);
}

.qb-btn-icon:focus-visible, .btn-icon:focus-visible, .icon-btn:focus-visible, .action-btn:focus-visible, .table-action-btn:focus-visible {
  outline: 2px solid var(--qb-brand-700) !important;
  outline-offset: 2px !important;
}

/* Close Buttons */
.drawer-close-btn, .close-modal, .close-drawer, .outreach-drawer-close-btn, .sol-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--qb-radius-sm);
  background: transparent;
  color: var(--qb-text-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--qb-transition-fast);
  box-sizing: border-box;
}

.drawer-close-btn:hover, .close-modal:hover, .close-drawer:hover, .outreach-drawer-close-btn:hover, .sol-drawer-close:hover {
  background: var(--qb-surface-subtle);
  color: var(--qb-text-primary);
  border-color: var(--qb-border-subtle);
}

/* Button Sizing */
.qb-btn-sm, .btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 0.8rem;
  border-radius: var(--qb-radius-sm);
}

.qb-btn-sm.qb-btn-icon, .btn-sm.btn-icon, .table-action-btn {
  width: 30px;
  height: 30px;
}

.qb-btn-lg, .btn-lg {
  height: 44px;
  padding: 0 20px;
  font-size: 0.95rem;
  border-radius: var(--qb-radius-md);
}

.btn-block, .w-full {
  width: 100%;
}

/* ========================================================
   COMPONENT PRIMITIVES: 2. FORM SYSTEM
   ======================================================== */
.qb-input,
.qubenix-input,
.qb-select,
.qb-textarea,
.form-input,
.form-select,
.form-textarea,
.sol-form-input,
.sol-form-select,
.sol-form-textarea,
.auto-form-input,
.auto-form-select,
.auto-form-textarea,
.clients-form-input,
.clients-form-select,
.clients-form-textarea,
.search-input {
  width: 100%;
  font-family: var(--qb-font-sans);
  font-size: 0.85rem;
  color: var(--qb-text-primary);
  background-color: var(--qb-surface-card);
  border: 1px solid var(--qb-border-subtle);
  border-radius: var(--qb-radius-md);
  padding: 0 14px;
  height: 38px;
  box-sizing: border-box;
  transition: border-color var(--qb-transition-fast), 
              box-shadow var(--qb-transition-fast), 
              background-color var(--qb-transition-fast);
}

.qb-textarea,
.form-textarea,
.sol-form-textarea,
.auto-form-textarea,
.clients-form-textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 14px;
  line-height: 1.5;
  resize: vertical;
}

.qb-input::placeholder,
.qb-textarea::placeholder,
.form-input::placeholder,
.form-textarea::placeholder,
.search-input::placeholder {
  color: var(--qb-text-muted);
}

.qb-input:hover,
.qb-select:hover,
.qb-textarea:hover,
.form-input:hover,
.form-select:hover,
.form-textarea:hover,
.search-input:hover {
  border-color: var(--qb-border-standard);
}

.qb-input:focus,
.qb-select:focus,
.qb-textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.search-input:focus {
  outline: none;
  border-color: var(--qb-brand-700) !important;
  box-shadow: 0 0 0 3px rgba(60, 50, 163, 0.12) !important;
  background-color: #ffffff !important;
}

.qb-input:disabled,
.qb-select:disabled,
.qb-textarea:disabled,
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--qb-surface-subtle) !important;
  color: var(--qb-text-disabled) !important;
  border-color: var(--qb-border-subtle) !important;
  cursor: not-allowed !important;
}

.qb-input.has-error,
.form-input.has-error {
  border-color: var(--qb-semantic-error) !important;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12) !important;
}

.qb-input.is-valid,
.form-input.is-valid {
  border-color: var(--qb-semantic-success) !important;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12) !important;
}

/* Form Group, Label & Help Text */
.qb-form-group, .form-group, .sol-form-group, .auto-form-group, .clients-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.qb-form-label, .form-label, .sol-form-label, .auto-form-label, .clients-form-label {
  font-size: 0.78rem;
  font-weight: var(--qb-font-weight-semibold);
  color: var(--qb-text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-help, .form-hint {
  font-size: 0.75rem;
  color: var(--qb-text-muted);
  margin-top: 4px;
}

.form-error-msg {
  font-size: 0.75rem;
  color: var(--qb-semantic-error);
  margin-top: 4px;
  font-weight: 500;
}

/* Custom Checkboxes & Radios */
input[type="checkbox"], input[type="radio"],
.qb-checkbox, .qb-radio, .form-checkbox, .form-radio {
  accent-color: var(--qb-brand-700);
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
}

input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: 2px solid var(--qb-brand-700) !important;
  outline-offset: 2px !important;
}

/* Universal Search Container */
.search-box, .topbar-search, .ai-sol-search-box, .global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--qb-surface-card);
  border: 1px solid var(--qb-border-subtle);
  border-radius: var(--qb-radius-md);
  padding: 0 12px;
  height: 38px;
  box-sizing: border-box;
  transition: all var(--qb-transition-fast);
}

.search-box:focus-within, .topbar-search:focus-within, .ai-sol-search-box:focus-within, .global-search:focus-within {
  border-color: var(--qb-brand-700);
  box-shadow: 0 0 0 3px rgba(60, 50, 163, 0.12);
}

.search-box input, .topbar-search input, .ai-sol-search-box input, .global-search input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
  height: 100% !important;
  width: 100%;
}

/* File Dropzones */
.file-dropzone, .upload-dropzone, .creative-dropzone {
  border: 2px dashed var(--qb-border-subtle);
  border-radius: var(--qb-radius-lg);
  padding: 24px;
  text-align: center;
  background: var(--qb-surface-secondary);
  transition: all var(--qb-transition-fast);
  cursor: pointer;
}

.file-dropzone:hover, .upload-dropzone:hover, .creative-dropzone:hover {
  border-color: var(--qb-brand-700);
  background: var(--qb-surface-hover);
}

/* ========================================================
   COMPONENT PRIMITIVES: 3. STATUS BADGES & PILLS
   ======================================================== */
.qb-badge,
.badge,
.snap-badge,
.status-pill,
.status-badge,
.outreach-badge,
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  font-family: var(--qb-font-sans);
  font-size: 0.72rem;
  font-weight: var(--qb-font-weight-semibold);
  border-radius: var(--qb-radius-full);
  white-space: nowrap;
  border: 1px solid transparent;
  box-sizing: border-box;
  text-transform: capitalize;
}

/* Semantic Badge Variants */
.qb-badge-neutral, .badge-neutral, .status-pill.draft, .status-pill.archived, .status-pill.idle {
  background: var(--qb-surface-subtle) !important;
  color: var(--qb-text-secondary) !important;
  border-color: var(--qb-border-subtle) !important;
}

.qb-badge-primary, .qb-badge-purple, .badge-primary, .badge-purple, .status-pill.verified, .status-pill.high {
  background: var(--qb-brand-50) !important;
  color: var(--qb-brand-700) !important;
  border-color: var(--qb-brand-200) !important;
}

.qb-badge-success, .badge-success, .status-pill.active, .status-pill.completed, .status-pill.won, .status-pill.paid, .status-pill.onboarding, .status-pill.done {
  background: var(--qb-semantic-success-light) !important;
  color: var(--qb-semantic-success-text) !important;
  border-color: var(--qb-semantic-success-border) !important;
}

.qb-badge-warning, .badge-warning, .status-pill.pending, .status-pill.review, .status-pill.proposal, .status-pill.paused, .status-pill.inv-pending {
  background: var(--qb-semantic-warning-light) !important;
  color: var(--qb-semantic-warning-text) !important;
  border-color: var(--qb-semantic-warning-border) !important;
}

.qb-badge-error, .qb-badge-danger, .badge-error, .badge-danger, .status-pill.blocked, .status-pill.failed, .status-pill.overdue, .status-pill.cancelled {
  background: var(--qb-semantic-error-light) !important;
  color: var(--qb-semantic-error-text) !important;
  border-color: var(--qb-semantic-error-border) !important;
}

.qb-badge-info, .badge-info, .status-pill.in-progress, .status-pill.running, .status-pill.discovery {
  background: var(--qb-semantic-info-light) !important;
  color: var(--qb-semantic-info-text) !important;
  border-color: var(--qb-semantic-info-border) !important;
}

/* ========================================================
   COMPONENT PRIMITIVES: 4. CARD SYSTEM
   ======================================================== */
.qb-card, .qubenix-card, .card, .portal-box, .fin-card, .settings-card, .glass-card {
  background: var(--qb-surface-card);
  border: 1px solid var(--qb-border-subtle);
  border-radius: var(--qb-radius-lg);
  box-shadow: var(--qb-shadow-sm);
  padding: 20px;
  box-sizing: border-box;
  transition: border-color var(--qb-transition-fast), 
              box-shadow var(--qb-transition-fast);
}

.qb-card:hover, .qubenix-card:hover, .card:hover, .portal-box:hover, .fin-card:hover {
  border-color: var(--qb-border-standard);
  box-shadow: var(--qb-shadow-md);
}

.card-header, .portal-box-header, .fin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.card-title, .portal-box-title, .fin-card-title {
  font-size: 0.95rem;
  font-weight: var(--qb-font-weight-semibold);
  color: var(--qb-text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--qb-text-muted);
  margin-top: 2px;
}

/* ========================================================
   COMPONENT PRIMITIVES: 5. KPI & METRIC CARD SYSTEM
   ======================================================== */
.qb-kpi-card, .kpi-card, .snap-card, .portal-kpi-card, .ai-sol-kpi-card, .auto-kpi-card, .cal-kpi-card, .fin-snap-card, .analytics-kpi-card, .team-kpi-card, .intern-kpi-card, .stat-card {
  background: var(--qb-surface-card);
  border: 1px solid var(--qb-border-subtle);
  border-radius: var(--qb-radius-lg);
  padding: 16px 20px;
  box-shadow: var(--qb-shadow-sm);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  transition: border-color var(--qb-transition-fast), box-shadow var(--qb-transition-fast);
}

.qb-kpi-card:hover, .kpi-card:hover, .snap-card:hover, .portal-kpi-card:hover, .ai-sol-kpi-card:hover, .auto-kpi-card:hover, .cal-kpi-card:hover, .fin-snap-card:hover, .analytics-kpi-card:hover {
  border-color: var(--qb-border-standard);
  box-shadow: var(--qb-shadow-md);
}

.kpi-top, .snap-top, .portal-kpi-top, .ai-sol-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kpi-label, .snap-label, .portal-kpi-label, .ai-sol-kpi-label {
  font-size: 0.75rem;
  font-weight: var(--qb-font-weight-semibold);
  color: var(--qb-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-icon, .snap-icon, .portal-kpi-icon, .ai-sol-kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--qb-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-value, .snap-val, .portal-kpi-value, .ai-sol-kpi-value {
  font-family: var(--qb-font-sans);
  font-size: 1.65rem;
  font-weight: var(--qb-font-weight-bold);
  color: var(--qb-text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.kpi-sub, .snap-sub, .portal-kpi-sub, .ai-sol-kpi-sub {
  font-size: 0.75rem;
  color: var(--qb-text-muted);
  margin-top: 4px;
}

/* Trend Semantic Colors */
.trend-up, .trend-success {
  color: var(--qb-semantic-success) !important;
  font-weight: 600;
}

.trend-down, .trend-danger {
  color: var(--qb-semantic-error) !important;
  font-weight: 600;
}

.trend-warn {
  color: var(--qb-semantic-warning) !important;
  font-weight: 600;
}

/* ========================================================
   COMPONENT PRIMITIVES: 6. TABLE SYSTEM
   ======================================================== */
.table-responsive,
.qubenix-table-wrapper,
.table-container,
.auto-table-container,
.payments-table-container,
.expenses-table-container,
.clients-table-container,
.leads-table-container,
.team-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--qb-surface-card);
  border: 1px solid var(--qb-border-subtle);
  border-radius: var(--qb-radius-lg);
  box-shadow: var(--qb-shadow-sm);
}

.qb-table, .qubenix-table, .table, .data-table, table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--qb-font-sans);
  font-size: 0.85rem;
  text-align: left;
}

.qb-table thead th, .table thead th, .data-table thead th, table thead th {
  background: var(--qb-surface-secondary);
  color: var(--qb-text-secondary);
  font-size: 0.75rem;
  font-weight: var(--qb-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  height: 40px;
  border-bottom: 1px solid var(--qb-border-subtle);
  white-space: nowrap;
  box-sizing: border-box;
}

.qb-table tbody tr, .table tbody tr, .data-table tbody tr, table tbody tr {
  background: var(--qb-surface-card);
  border-bottom: 1px solid #F1F5F9;
  transition: background-color var(--qb-transition-fast);
}

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

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

.qb-table tbody td, .table tbody td, .data-table tbody td, table tbody td {
  padding: 12px 16px;
  color: var(--qb-text-primary);
  vertical-align: middle;
  box-sizing: border-box;
}

.td-actions, .table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ========================================================
   COMPONENT PRIMITIVES: 7. TABS & SEGMENTED CONTROLS
   ======================================================== */
.qb-tabs, .tabs, .tab-nav, .portal-tabs, .fin-tabs, .wf-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--qb-border-subtle);
  padding-bottom: 0;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.qb-tab-btn, .tab-btn, .tab-item, .analytics-tab-btn, .settings-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--qb-font-sans);
  font-size: 0.85rem;
  font-weight: var(--qb-font-weight-medium);
  color: var(--qb-text-secondary);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--qb-transition-fast), border-color var(--qb-transition-fast);
}

.qb-tab-btn:hover, .tab-btn:hover, .tab-item:hover, .analytics-tab-btn:hover, .settings-tab-btn:hover {
  color: var(--qb-text-primary);
}

.qb-tab-btn.active, .tab-btn.active, .tab-item.active, .analytics-tab-btn.active, .settings-tab-btn.active {
  color: var(--qb-brand-700) !important;
  font-weight: var(--qb-font-weight-semibold);
  border-bottom-color: var(--qb-brand-700) !important;
}

.qb-segmented-control {
  display: inline-flex;
  align-items: center;
  background: var(--qb-surface-subtle);
  border: 1px solid var(--qb-border-subtle);
  border-radius: var(--qb-radius-md);
  padding: 3px;
  gap: 2px;
}

.qb-segment-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  font-family: var(--qb-font-sans);
  font-size: 0.78rem;
  font-weight: var(--qb-font-weight-medium);
  color: var(--qb-text-secondary);
  border-radius: var(--qb-radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--qb-transition-fast);
}

.qb-segment-btn:hover {
  color: var(--qb-text-primary);
}

.qb-segment-btn.active {
  background: #ffffff;
  color: var(--qb-brand-700);
  font-weight: var(--qb-font-weight-semibold);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* ========================================================
   COMPONENT PRIMITIVES: 8. DROPDOWNS & MENUS
   ======================================================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu, .actions-dropdown, .user-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid var(--qb-border-subtle);
  border-radius: var(--qb-radius-md);
  box-shadow: var(--qb-shadow-md);
  padding: 4px;
  z-index: 1050;
  display: none;
  flex-direction: column;
}

.dropdown-menu.active, .actions-dropdown.active, .user-dropdown.active, .dropdown:hover .dropdown-menu {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
  color: var(--qb-text-primary);
  border-radius: var(--qb-radius-sm);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  transition: background-color var(--qb-transition-fast);
}

.dropdown-item:hover {
  background: var(--qb-surface-secondary);
  color: var(--qb-brand-700);
}

.dropdown-divider {
  height: 1px;
  background: var(--qb-border-subtle);
  margin: 4px 0;
}

/* ========================================================
   COMPONENT PRIMITIVES: 9. TOOLTIPS
   ======================================================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--q-neutral-900);
  color: #ffffff;
  font-family: var(--qb-font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 2px 8px rgba(20, 18, 37, 0.2);
  z-index: 9999;
  transition: opacity var(--qb-transition-fast), transform var(--qb-transition-fast);
}

[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ========================================================
   COMPONENT PRIMITIVES: 10. AVATARS
   ======================================================== */
.avatar, .qb-avatar, .user-avatar, .member-avatar, .client-avatar, .topbar-avatar-btn, .t-avt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--qb-brand-50);
  color: var(--qb-brand-700);
  font-family: var(--qb-font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  border: 1px solid var(--qb-brand-200);
  box-sizing: border-box;
}

.avatar-sm, .avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 0.72rem;
}

.avatar-lg, .avatar.lg {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

.avatar-org {
  border-radius: var(--qb-radius-md);
}

/* ========================================================
   COMPONENT PRIMITIVES: 11. EMPTY STATES
   ======================================================== */
.empty-state, .qb-empty-state, .qubenix-empty-state, .notif-empty-state, .portal-empty-state, .task-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  box-sizing: border-box;
}

.empty-icon, .qubenix-empty-icon, .notif-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--qb-surface-secondary);
  color: var(--qb-brand-700);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.empty-title, .qubenix-empty-title, .notif-empty-title {
  font-size: 1rem;
  font-weight: var(--qb-font-weight-bold);
  color: var(--qb-text-primary);
  margin-bottom: 6px;
}

.empty-desc, .qubenix-empty-desc, .notif-empty-desc {
  font-size: 0.82rem;
  color: var(--qb-text-muted);
  max-width: 380px;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ========================================================
   COMPONENT PRIMITIVES: 12. LOADING STATES & SKELETONS
   ======================================================== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton, .skeleton-line, .skeleton-card, .skeleton-table-row {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--qb-radius-sm);
}

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
}

.skeleton-card {
  height: 120px;
  margin-bottom: 16px;
}

.spinner, .loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(60, 50, 163, 0.2);
  border-top-color: var(--qb-brand-700);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========================================================
   COMPONENT PRIMITIVES: 13. ERROR & ALERT BANNERS
   ======================================================== */
.alert-banner, .error-state, .inline-error, .qubenix-inline-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--qb-radius-md);
  font-size: 0.85rem;
  box-sizing: border-box;
  margin-bottom: 16px;
  background: var(--qb-semantic-error-light);
  border: 1px solid var(--qb-semantic-error-border);
  color: var(--qb-semantic-error-text);
}

.alert-banner.alert-warning {
  background: var(--qb-semantic-warning-light);
  border-color: var(--qb-semantic-warning-border);
  color: var(--qb-semantic-warning-text);
}

.alert-banner.alert-success {
  background: var(--qb-semantic-success-light);
  border-color: var(--qb-semantic-success-border);
  color: var(--qb-semantic-success-text);
}

.alert-banner.alert-info {
  background: var(--qb-semantic-info-light);
  border-color: var(--qb-semantic-info-border);
  color: var(--qb-semantic-info-text);
}

/* ========================================================
   COMPONENT PRIMITIVES: 14. TOAST NOTIFICATIONS
   ======================================================== */
.qubenix-toast-container, .toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast, .qb-toast, .qubenix-toast {
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 16px;
  background: #ffffff;
  color: var(--qb-text-primary);
  font-family: var(--qb-font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--qb-radius-md);
  border: 1px solid var(--qb-border-subtle);
  border-left: 4px solid var(--qb-brand-700);
  box-shadow: var(--qb-shadow-md);
  box-sizing: border-box;
  transform: translateY(12px);
  opacity: 0;
  visibility: hidden;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  transition: transform var(--qb-transition-normal), opacity var(--qb-transition-normal), visibility var(--qb-transition-normal);
}

.toast.show, .qb-toast.show, .qubenix-toast.show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.toast.toast-success, .qubenix-toast.toast-success {
  border-left-color: var(--qb-semantic-success);
}

.toast.toast-error, .qubenix-toast.toast-error {
  border-left-color: var(--qb-semantic-error);
}

.toast.toast-warning, .qubenix-toast.toast-warning {
  border-left-color: var(--qb-semantic-warning);
}

.toast.toast-info, .qubenix-toast.toast-info {
  border-left-color: var(--qb-semantic-info);
}

/* ========================================================
   COMPONENT PRIMITIVES: 15. CONFIRMATION MODALS
   ======================================================== */
.qubenix-confirm-overlay, .modal-overlay, .workspace-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--qb-transition-fast), visibility var(--qb-transition-fast);
}

.qubenix-confirm-overlay.active, .modal-overlay.active, .workspace-modal.active {
  opacity: 1;
  visibility: visible;
}

.qubenix-confirm-modal, .modal-card, .workspace-modal-card {
  background: #ffffff;
  border: 1px solid var(--qb-border-subtle);
  border-radius: var(--qb-radius-lg);
  box-shadow: var(--qb-shadow-xl);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  box-sizing: border-box;
  transform: scale(0.95);
  transition: transform var(--qb-transition-fast);
}

.qubenix-confirm-overlay.active .qubenix-confirm-modal, .modal-overlay.active .modal-card {
  transform: scale(1);
}

/* ========================================================
   COMPONENT PRIMITIVES: 16. DRAWERS & SLIDE-OVERS
   ======================================================== */
.drawer, .right-drawer, .outreach-right-drawer, .sol-drawer, .cal-right-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: #ffffff;
  border-left: 1px solid var(--qb-border-subtle);
  box-shadow: var(--qb-shadow-xl);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--qb-transition-normal), visibility var(--qb-transition-normal);
  box-sizing: border-box;
}

.drawer.active, .right-drawer.active, .outreach-right-drawer.active, .sol-drawer.active, .cal-right-drawer.active {
  transform: translateX(0);
  visibility: visible;
}

.drawer-header, .outreach-drawer-header, .sol-drawer-header, .cal-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--qb-border-subtle);
  background: var(--qb-surface-card);
  min-height: 64px;
  box-sizing: border-box;
}

.drawer-body, .outreach-drawer-body, .sol-drawer-body, .cal-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

.drawer-footer, .outreach-drawer-footer, .sol-drawer-footer, .cal-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--qb-border-subtle);
  background: var(--qb-surface-card);
  box-sizing: border-box;
}

/* ========================================================
   ACCESSIBILITY & RESPONSIVE HARDENING (PHASE 7)
   ======================================================== */

/* 1. Universal Focus Visibility */
:focus-visible {
  outline: 2px solid var(--qb-brand-700) !important;
  outline-offset: 2px !important;
}

/* 2. Skip to Main Content Link */
.qb-skip-link {
  position: absolute;
  top: -9999px;
  left: 16px;
  z-index: 10000;
  padding: 10px 18px;
  background: var(--qb-brand-700);
  color: #ffffff !important;
  font-family: var(--qb-font-sans);
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: var(--qb-radius-md);
  box-shadow: var(--qb-shadow-xl);
  text-decoration: none;
  transition: top var(--qb-transition-fast);
}

.qb-skip-link:focus {
  top: 16px;
}

/* 3. Screen Reader Only Utility */
.sr-only,
.qb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* 4. Universal Responsive Drawers & Breakpoint Layouts */
@media (max-width: 1024px) {
  .command-main-grid,
  .portal-main-grid,
  .dashboard-grid,
  .analytics-grid,
  .fin-summary-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .sidebar {
    position: fixed;
    z-index: 1000;
  }
}

@media (max-width: 768px) {
  .client-drawer-card,
  .auto-drawer-card,
  .wf-drawer-card,
  .fin-drawer-card,
  .doc-upload-drawer-card,
  .drawer-card,
  .auto-form-drawer-card,
  .clients-form-drawer-card,
  .cal-right-drawer,
  .lead-drawer-card,
  .task-drawer-card,
  .team-drawer-card,
  .intern-drawer-card,
  .settings-card,
  .modal-container,
  .drawer,
  .right-drawer,
  .outreach-right-drawer,
  .sol-drawer {
    width: 100% !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
  }

  /* Touch Targets */
  .qb-btn, .btn, .btn-icon, .qb-btn-icon, .sidebar-toggle, .mobile-menu-btn, .topbar-btn {
    min-height: 40px;
    min-width: 40px;
  }
}

@media (max-width: 480px) {
  .command-main-grid,
  .portal-main-grid,
  .dashboard-grid,
  .analytics-grid,
  .fin-summary-cards,
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .qb-page-header,
  .header-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .qubenix-toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
}

/* 6. Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================================
   7. GLOBAL LAYOUT & RESPONSIVE WIDTH ARCHITECTURE (PHASE 5)
   ======================================================== */

/* 7.1 Universal Workspace & Page Container Normalization */
.qubenix-page-container,
.q-page-container,
.dashboard-content,
.content-body,
.ai-sol-container,
.interns-container,
.cal-container,
.analytics-content,
.docs-container,
.team-container,
.portal-page-container,
.esign-page-container,
.outreach-page-container,
.settings-container,
.leads-container,
.clients-container,
.projects-container,
.tasks-container,
.automations-container,
.workflows-container,
.fin-container,
.finance-container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  flex: 1 1 auto;
}

/* 7.2 Universal Table & Data Grid Scroll Containers */
.qubenix-table-wrapper,
.table-responsive,
.portal-table-container,
.fin-table-container,
.leads-table-container,
.auto-table-container,
.team-table-container,
.esign-table-container,
.outreach-table-container,
.intern-table-container,
.client-table-container,
.tasks-table-container,
.docs-table-container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  box-sizing: border-box !important;
}

/* 7.3 Universal Kanban & Canvas Workspace Scroll Isolation */
.pipeline-kanban-workspace,
.auto-board,
.tasks-board-container,
.kanban-view-container,
.board-container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  box-sizing: border-box !important;
}

/* 7.4 Flex & Grid Content Safety Guardrails */
.main-content,
.content-body,
.dashboard-content,
.command-main-grid,
.portal-main-grid {
  min-width: 0 !important;
}

/* 7.5 Universal Drawer & Modal Overlay Visibility Isolation */
.lead-drawer-overlay,
.client-drawer-overlay,
.task-drawer-overlay,
.auto-drawer-overlay,
.wf-drawer-overlay,
.fin-drawer-overlay,
.drawer-overlay,
.modal-overlay,
.qubenix-modal-backdrop {
  overflow: hidden !important;
  visibility: hidden;
}

.lead-drawer-overlay.active,
.client-drawer-overlay.active,
.task-drawer-overlay.active,
.auto-drawer-overlay.active,
.wf-drawer-overlay.active,
.fin-drawer-overlay.active,
.drawer-overlay.active,
.modal-overlay.active,
.qubenix-modal-backdrop.active {
  visibility: visible !important;
}

/* ========================================================
   8. UNIFIED APP SHELL & NAVIGATION ARCHITECTURE
   ======================================================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width, 260px);
  background: var(--qb-surface-card, #FFFFFF);
  border-right: 1px solid var(--qb-border-subtle, #E2E8F0);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed, 72px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--qb-border-subtle, #E2E8F0);
  height: 64px;
  min-height: 64px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
  min-width: 0;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--qb-brand-700, #3C32A3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(60, 50, 163, 0.25);
  flex-shrink: 0;
  color: #FFFFFF;
}

.sidebar-brand-text-group {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.2;
}

.sidebar-logo-text {
  font-family: var(--qb-font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--qb-text-primary, #141225);
  letter-spacing: -0.015em;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar-logo-subtitle {
  font-size: 0.62rem;
  color: var(--qb-text-muted, #64748B);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-brand-text-group {
  opacity: 0;
  width: 0;
  display: none;
}

.sidebar-toggle {
  padding: 6px;
  border-radius: var(--qb-radius-sm, 6px);
  color: var(--qb-text-muted, #64748B);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--qb-transition-fast);
  min-width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--qb-surface-secondary, #F5F4FB);
  color: var(--qb-text-primary, #141225);
}

.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--qb-text-muted, #64748B);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 14px 12px 6px;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .nav-section-label {
  opacity: 0;
  height: 10px;
  padding: 0;
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--qb-radius-md, 8px);
  color: var(--qb-text-secondary, #475569);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--qb-transition-fast);
  white-space: nowrap;
  position: relative;
  margin-bottom: 2px;
}

.nav-item svg {
  min-width: 20px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--qb-surface-secondary, #F5F4FB);
  color: var(--qb-text-primary, #141225);
}

.nav-item.active {
  background: rgba(60, 50, 163, 0.08);
  color: var(--qb-brand-700, #3C32A3);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--qb-brand-700, #3C32A3);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--qb-brand-700, #3C32A3);
  border-radius: 0 3px 3px 0;
}

/* Expandable Parent Navigation */
.nav-item-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 2px;
}

.nav-parent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 8px 8px 8px 12px;
  position: relative;
}

.nav-parent-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.nav-chevron-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--qb-radius-sm, 6px);
  color: var(--qb-text-muted, #64748B);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--qb-transition-fast);
  flex-shrink: 0;
}

.nav-chevron-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: var(--qb-text-primary, #141225);
}

.nav-chevron {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--qb-text-muted, #64748B);
}

.nav-item-group.expanded .nav-chevron {
  transform: rotate(90deg);
  color: var(--qb-brand-700, #3C32A3);
}

.nav-parent-item.parent-active {
  color: var(--qb-brand-700, #3C32A3);
  font-weight: 600;
}

.nav-parent-item.parent-active svg:not(.nav-chevron) {
  color: var(--qb-brand-700, #3C32A3);
}

.nav-parent-item.parent-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--qb-brand-700, #3C32A3);
  border-radius: 0 3px 3px 0;
}

.nav-child-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 28px;
  padding-right: 4px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, margin 0.2s ease;
  margin: 0;
}

.nav-item-group.expanded .nav-child-list {
  max-height: 500px;
  opacity: 1;
  margin-top: 2px;
  margin-bottom: 6px;
}

.nav-child-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--qb-radius-sm, 6px);
  color: var(--qb-text-secondary, #475569);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--qb-transition-fast);
  white-space: nowrap;
  position: relative;
}

.nav-child-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--qb-text-muted, #64748B);
  opacity: 0.45;
  transition: all var(--qb-transition-fast);
  flex-shrink: 0;
}

.nav-child-item:hover {
  background: var(--qb-surface-secondary, #F5F4FB);
  color: var(--qb-text-primary, #141225);
}

.nav-child-item:hover .nav-child-dot {
  opacity: 0.8;
  background: var(--qb-brand-700, #3C32A3);
}

.nav-child-item.active {
  background: rgba(60, 50, 163, 0.08);
  color: var(--qb-brand-700, #3C32A3);
  font-weight: 600;
}

.nav-child-item.active .nav-child-dot {
  background: var(--qb-brand-700, #3C32A3);
  opacity: 1;
  transform: scale(1.4);
  box-shadow: 0 0 6px rgba(60, 50, 163, 0.4);
}

/* Sidebar Collapsed Overrides */
.sidebar.collapsed .nav-chevron-btn,
.sidebar.collapsed .nav-chevron,
.sidebar.collapsed .nav-child-list {
  display: none !important;
}

.sidebar.collapsed .nav-item-group {
  margin-bottom: 0;
}

.sidebar.collapsed .nav-parent-item,
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .nav-parent-main {
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  width: 0;
  display: none;
}

/* Sidebar Footer & User Profile */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--qb-border-subtle, #E2E8F0);
  background: var(--qb-surface-card, #FFFFFF);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--qb-radius-md, 8px);
  background: var(--qb-surface-secondary, #F5F4FB);
  border: 1px solid var(--qb-border-subtle, #E2E8F0);
  transition: all var(--qb-transition-fast);
}

.sidebar-user:hover {
  background: #EEECFB;
  border-color: var(--qb-border-standard, #CBD5E1);
}

.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding: 6px 0;
  background: transparent;
  border: none;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--qb-brand-700, #3C32A3);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
  display: none;
}

.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--qb-text-primary, #141225);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--qb-text-muted, #64748B);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: capitalize;
}

.sidebar-logout {
  color: var(--qb-text-muted, #64748B);
  padding: 4px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--qb-transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logout:hover {
  color: var(--qb-semantic-error, #DC3545);
  background: rgba(220, 53, 69, 0.1);
}

.sidebar.collapsed .sidebar-logout {
  display: none;
}

/* ========================================================
   9. TOPBAR HEADER & GLOBAL SEARCH
   ======================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height, 64px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--qb-border-subtle, #E2E8F0);
  box-sizing: border-box;
}

.mobile-menu-btn {
  display: none;
  color: var(--qb-text-secondary, #475569);
  padding: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--qb-surface-secondary, #F5F4FB);
  border: 1px solid var(--qb-border-subtle, #E2E8F0);
  border-radius: var(--qb-radius-md, 8px);
  transition: all var(--qb-transition-normal);
  box-sizing: border-box;
}

.topbar-search:focus-within {
  background: #FFFFFF;
  border-color: var(--qb-brand-700, #3C32A3);
  box-shadow: 0 0 0 3px rgba(60, 50, 163, 0.12);
}

.topbar-search svg {
  color: var(--qb-text-muted, #64748B);
  min-width: 16px;
}

.topbar-search input {
  flex: 1;
  background: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: var(--qb-text-primary, #141225);
  font-size: 0.88rem;
  font-family: inherit;
  padding: 0 !important;
  height: auto !important;
}

.topbar-search input::placeholder {
  color: var(--qb-text-muted, #64748B);
}

.topbar-search kbd {
  background: #FFFFFF;
  color: var(--qb-text-secondary, #475569);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.7rem;
  font-family: inherit;
  border: 1px solid var(--qb-border-subtle, #E2E8F0);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-btn {
  position: relative;
  padding: 8px;
  border-radius: var(--qb-radius-sm, 6px);
  color: var(--qb-text-secondary, #475569);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--qb-transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-btn:hover {
  background: var(--qb-surface-secondary, #F5F4FB);
  color: var(--qb-text-primary, #141225);
}

.notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: var(--qb-semantic-error, #DC3545);
  color: white;
  border-radius: 9px;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--qb-brand-700, #3C32A3);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ========================================================
   10. MAIN CONTENT & PAGE CONTAINERS
   ======================================================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width, 260px);
  transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: calc(100% - var(--sidebar-width, 260px));
  max-width: calc(100% - var(--sidebar-width, 260px));
  box-sizing: border-box;
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed, 72px);
  width: calc(100% - var(--sidebar-collapsed, 72px));
  max-width: calc(100% - var(--sidebar-collapsed, 72px));
}

.qubenix-page-container,
.content-body,
.dashboard-content {
  padding: 24px 28px;
  width: 100% !important;
  box-sizing: border-box !important;
  flex: 1;
}

/* Page Header System */
.qb-page-header,
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.qb-page-header-text h1,
.page-header-text h1 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--qb-text-primary, #141225);
  margin: 0 0 4px;
  letter-spacing: -0.015em;
}

.qb-page-header-text p,
.page-header-text p {
  font-size: 0.85rem;
  color: var(--qb-text-muted, #64748B);
  margin: 0;
  line-height: 1.4;
}

.qb-page-header-actions,
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Error State & Alert Banner */
.task-error-banner,
.error-state-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--qb-semantic-error-light, #FBEBEB);
  border: 1px solid var(--qb-semantic-error-border, #F5C6CB);
  border-radius: var(--qb-radius-md, 8px);
  color: var(--qb-semantic-error-text, #721C24);
  margin-bottom: 20px;
  gap: 12px;
}

.task-error-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-error-content strong {
  font-size: 0.88rem;
  display: block;
}

.task-error-content p {
  font-size: 0.8rem;
  margin: 0;
  color: var(--qb-semantic-error-text, #721C24);
}

/* Reusable Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  background: var(--qb-surface-card, #FFFFFF);
  border: 1px dashed var(--qb-border-subtle, #E2E8F0);
  border-radius: var(--qb-radius-lg, 14px);
  margin: 20px 0;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--qb-surface-secondary, #F5F4FB);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--qb-brand-700, #3C32A3);
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--qb-text-primary, #141225);
  margin: 0 0 6px;
}

.empty-state-description {
  font-size: 0.85rem;
  color: var(--qb-text-muted, #64748B);
  max-width: 420px;
  margin: 0 0 20px;
  line-height: 1.5;
}

/* ========================================================
   GLOBAL VISIBILITY & UTILITY CLASSES
   ======================================================== */
.hidden,
.is-hidden,
[hidden] {
  display: none !important;
}

/* Explicit Banner Hidden Selectors for Cross-Browser Specificity */
.alert-banner.hidden,
.error-state.hidden,
.inline-error.hidden,
.qubenix-inline-error.hidden,
.lead-error-banner.hidden,
.task-error-banner.hidden,
.client-error-banner.hidden,
.cal-error-banner.hidden,
.empty-state.hidden,
.qubenix-empty-workspace.hidden,
.notification-panel.hidden,
.qubenix-notif-popover.hidden {
  display: none !important;
}

/* ========================================================
   GLOBAL NOTIFICATION COMPONENT STYLES
   ======================================================== */
.notification-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notification-badge,
.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--qb-semantic-error, #EF4444);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 9999px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
  pointer-events: none;
  line-height: 1;
}

.notification-panel,
.qubenix-notif-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 400px;
  max-width: calc(100vw - 32px);
  background: #FFFFFF;
  border: 1px solid var(--qb-border-subtle, #E2E8F0);
  border-radius: var(--qb-radius-lg, 12px);
  box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.notification-panel.active,
.qubenix-notif-popover.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  display: flex !important;
}

.notification-panel-header,
.notif-popover-header {
  padding: 14px 18px;
  background: #FFFFFF;
  border-bottom: 1px solid #F1F5F9;
}

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

.notif-popover-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--qb-text-primary, #0F172A);
}

.notif-unread-count-pill {
  background: rgba(60, 50, 163, 0.08);
  color: var(--qb-brand-700, #3C32A3);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.btn-notif-mark-all {
  background: transparent;
  border: none;
  color: var(--qb-brand-700, #3C32A3);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-notif-mark-all:hover {
  background: rgba(60, 50, 163, 0.06);
}

.btn-notif-mark-all:disabled {
  color: #94A3B8;
  cursor: not-allowed;
  opacity: 0.6;
}

.notification-list,
.notif-popover-body {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #F8FAFC;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.notif-item:hover {
  background: #F8FAFC;
}

.notif-item.unread {
  background: #F8FAFC;
}

.notif-item.unread:hover {
  background: #F1F5F9;
}

.notif-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-item-icon.blue { background: #E8F1F8; color: #1F77B4; }
.notif-item-icon.green { background: #EAF7ED; color: #28A745; }
.notif-item-icon.purple { background: #F5F4FB; color: #3C32A3; }
.notif-item-icon.amber { background: #FFF9E6; color: #856404; }
.notif-item-icon.red { background: #FBEBEB; color: #DC3545; }
.notif-item-icon.indigo { background: #F5F4FB; color: #3C32A3; }

.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.notif-item-title {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--qb-text-primary, #0F172A);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item.unread .notif-item-title {
  color: var(--qb-brand-700, #3C32A3);
}

.notif-item-time {
  font-size: 0.72rem;
  color: #94A3B8;
  white-space: nowrap;
  flex-shrink: 0;
}

.notif-item-desc {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--qb-brand-700, #3C32A3);
  flex-shrink: 0;
  margin-top: 7px;
}

/* Empty State */
.notif-empty-state {
  padding: 40px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.notif-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #F1F5F9;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.notif-empty-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--qb-text-primary, #0F172A);
  margin: 0;
}

.notif-empty-desc {
  font-size: 0.8rem;
  color: #64748B;
  margin: 0;
}

/* Skeleton Loading State */
.notif-skeleton-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #F8FAFC;
}

.notif-skeleton-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #E2E8F0;
  animation: notifPulse 1.4s infinite ease-in-out;
  flex-shrink: 0;
}

.notif-skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notif-skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: #E2E8F0;
  animation: notifPulse 1.4s infinite ease-in-out;
}

@keyframes notifPulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.notification-panel-footer,
.notif-popover-footer {
  padding: 10px 18px;
  background: #F8FAFC;
  border-top: 1px solid #F1F5F9;
  text-align: center;
}

.notif-footer-text {
  font-size: 0.72rem;
  color: #94A3B8;
  font-weight: 600;
}




/* Logo toggle for collapsed sidebar */
.sidebar.collapsed .sidebar-logo-full { display: none !important; }
.sidebar.collapsed .sidebar-logo-icon-only { display: block !important; }
