/* ============================================================================
   JIVANTA GLOBAL REVENUE OS — Design System
   Version 2.0.0 | Premium Dark Theme
   ============================================================================
   A comprehensive design system for the Revenue OS CRM built with
   CSS custom properties, glassmorphism, and modern layout primitives.
   ============================================================================ */


/* ============================================================================
   §1 — CSS RESET & BASE
   Modern reset based on Josh Comeau's approach + box-sizing normalization.
   ============================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  font-size: 16px;
  height: 100%;
}

body {
  min-height: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

dialog {
  padding: 0;
  border: none;
}

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}


/* ============================================================================
   §2 — DESIGN TOKENS (CSS Custom Properties)
   Single source of truth for colour, spacing, typography, and elevation.
   ============================================================================ */

:root {
  /* ---- Colour — Backgrounds ---- */
  --bg-primary:       #030712;
  --bg-secondary:     #090d16;
  --bg-card:          #0e131f;
  --bg-card-hover:    #151c2d;
  --bg-elevated:      #1c2436;
  --bg-glass:         rgba(14, 19, 31, 0.75);
  --bg-glass-hover:   rgba(21, 28, 45, 0.85);
  --bg-input:         #070a10;
  --bg-sidebar:       #090d16;
  --bg-overlay:       rgba(0, 0, 0, 0.70);
  --bg-tooltip:       #111827;

  /* ---- Colour — Borders ---- */
  --border:           rgba(255, 255, 255, 0.08);
  --border-light:     rgba(255, 255, 255, 0.04);
  --border-glow:      #3b82f6;

  /* ---- Colour — Text ---- */
  --text-primary:     #f1f5f9;
  --text-secondary:   #94a3b8;
  --text-muted:       #64748b;
  --text-inverse:     #0a0e17;
  --text-link:        #60a5fa;

  /* ---- Colour — Accents ---- */
  --accent-blue:      #3b82f6;
  --accent-blue-hover:#2563eb;
  --accent-blue-muted:rgba(59, 130, 246, 0.15);
  --accent-cyan:      #06b6d4;
  --accent-cyan-muted:rgba(6, 182, 212, 0.15);
  --accent-emerald:   #10b981;
  --accent-emerald-muted:rgba(16, 185, 129, 0.15);
  --accent-amber:     #f59e0b;
  --accent-amber-muted:rgba(245, 158, 11, 0.15);
  --accent-rose:      #f43f5e;
  --accent-rose-muted:rgba(244, 63, 94, 0.15);
  --accent-violet:    #8b5cf6;
  --accent-violet-muted:rgba(139, 92, 246, 0.15);

  /* ---- Gradients ---- */
  --gradient-1:       linear-gradient(135deg, #3b82f6, #06b6d4);
  --gradient-2:       linear-gradient(135deg, #8b5cf6, #ec4899);
  --gradient-3:       linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-4:       linear-gradient(135deg, #f59e0b, #f43f5e);
  --gradient-sidebar:  linear-gradient(180deg, #0d1320 0%, #0a0e17 100%);
  --gradient-hero:     linear-gradient(135deg, #0a0e17 0%, #111827 50%, #0d1a2d 100%);
  --gradient-login:    linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --gradient-glow:     radial-gradient(circle at 50% 0%, rgba(59,130,246,0.12) 0%, transparent 60%);

  /* ---- Typography ---- */
  --font-primary:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:        'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.8125rem;  /* 13px */
  --text-base: 0.875rem;   /* 14px */
  --text-md:   1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  3rem;       /* 48px */

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-extrabold:800;

  --leading-tight:   1.25;
  --leading-snug:    1.375;
  --leading-normal:  1.6;
  --leading-relaxed: 1.75;

  --tracking-tight:  -0.025em;
  --tracking-normal:  0;
  --tracking-wide:    0.025em;
  --tracking-wider:   0.05em;
  --tracking-widest:  0.1em;

  /* ---- Spacing ---- */
  --space-1:  0.25rem;   /* 4px  */
  --space-2:  0.5rem;    /* 8px  */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */

  /* ---- Border Radius ---- */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* ---- Shadows & Elevation ---- */
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:       0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md:    0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:    0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl:    0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow:  0 0 20px rgba(59, 130, 246, 0.25);
  --shadow-glow-lg: 0 0 40px rgba(59, 130, 246, 0.3);
  --shadow-inner: inset 0 1px 4px rgba(0, 0, 0, 0.3);

  /* ---- Transitions ---- */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ---- Z-index Scale ---- */
  --z-base:     1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
  --z-tooltip:  600;

  /* ---- Layout Constants ---- */
  --sidebar-width:     280px;
  --sidebar-collapsed:  72px;
  --header-height:      64px;
  --page-max-width:    1440px;
}


/* ============================================================================
   §3 — TYPOGRAPHY SCALE
   Semantic heading & body styles anchored to the type-scale tokens.
   ============================================================================ */

h1, .text-h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h2, .text-h2 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h3, .text-h3 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  color: var(--text-primary);
}

h4, .text-h4 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  color: var(--text-primary);
}

h5, .text-h5 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  color: var(--text-primary);
}

h6, .text-h6 {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
}

.text-body {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
}

.text-body-lg {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.text-caption {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

.text-overline {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-muted);
}

.text-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.text-gradient {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Utility colours */
.text-blue    { color: var(--accent-blue); }
.text-cyan    { color: var(--accent-cyan); }
.text-emerald { color: var(--accent-emerald); }
.text-amber   { color: var(--accent-amber); }
.text-rose    { color: var(--accent-rose); }
.text-violet  { color: var(--accent-violet); }
.text-muted   { color: var(--text-muted); }
/* Vector icons base size & styling */
.icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: stroke 150ms ease, fill 150ms ease;
}

.sidebar-item-icon svg.icon {
  width: 18px;
  height: 18px;
}

.stat-card-icon svg.icon {
  width: 22px;
  height: 22px;
}

span.funnel-icon svg.icon {
  width: 14px;
  height: 14px;
}

span.product-dist-icon svg.icon {
  width: 16px;
  height: 16px;
}

.btn svg.icon {
  width: 14px;
  height: 14px;
}


/* ============================================================================
   §4 — APP LAYOUT
   Two-column layout: fixed sidebar + scrollable main area.
   ============================================================================ */

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--gradient-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-base), min-width var(--transition-base);
  position: relative;
  z-index: var(--z-sticky);
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  pointer-events: none;
  opacity: 0.5;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
  position: relative;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand-name {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-brand-tagline {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar-toggle {
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  z-index: 10;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--accent-blue);
  color: #fff;
}

/* ---- Sidebar Navigation ---- */
.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav-section {
  margin-bottom: var(--space-4);
}

.sidebar-nav-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  white-space: nowrap;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.sidebar-item:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--accent-blue-muted);
  color: var(--accent-blue);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-blue);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.sidebar-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-lg);
}

.sidebar-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: var(--accent-rose);
  color: #fff;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

/* ---- Sidebar Footer ---- */
.sidebar-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---- Sidebar Collapsed ---- */
.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar-collapsed .sidebar-brand,
.sidebar-collapsed .sidebar-nav-label,
.sidebar-collapsed .sidebar-item-label,
.sidebar-collapsed .sidebar-item-badge,
.sidebar-collapsed .sidebar-user-info,
.sidebar-collapsed .sidebar-brand-tagline {
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-item {
  justify-content: center;
  padding: var(--space-2) 0;
}

.sidebar-collapsed .sidebar-item.active::before {
  display: none;
}

.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: var(--space-5) var(--space-2);
}

.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding: var(--space-3) var(--space-2);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg-primary);
}

.main-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 300px;
  background: var(--gradient-glow);
  pointer-events: none;
  z-index: 0;
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 23, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
  min-width: 0;
}

.page-header-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.page-header-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ---- Content Grid ---- */
.content-area {
  padding: var(--space-6);
  max-width: var(--page-max-width);
}

.content-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.content-grid-2 {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(2, 1fr);
}

.content-grid-3 {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(3, 1fr);
}

.content-grid-4 {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(4, 1fr);
}

.content-grid-fluid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}


/* ============================================================================
   §5 — COMPONENTS
   ============================================================================ */

/* ---- 5.1 Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
  line-height: 1.5;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.45);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-outline {
  background: transparent;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.btn-outline:hover {
  background: var(--accent-blue-muted);
}

.btn-danger {
  background: var(--accent-rose);
  color: #fff;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: #e11d48;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.45);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-success {
  background: var(--accent-emerald);
  color: #fff;
}

.btn-success:hover {
  filter: brightness(1.1);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-md);
  border-radius: var(--radius);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

.btn-icon.btn-lg {
  width: 44px;
  height: 44px;
}

/* Ripple effect container */
.btn .btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0);
  animation: ripple 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}


/* ---- 5.2 Cards ---- */
.card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
  overflow: hidden;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(59, 130, 246, 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  gap: var(--space-3);
}

.card-header-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-5);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
}

/* ---- 5.3 Stat Cards ---- */
.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-1);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card--cyan::before    { background: var(--accent-cyan); }
.stat-card--emerald::before { background: var(--accent-emerald); }
.stat-card--amber::before   { background: var(--accent-amber); }
.stat-card--rose::before    { background: var(--accent-rose); }
.stat-card--violet::before  { background: var(--gradient-2); }

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.stat-card-title {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  background: var(--accent-blue-muted);
  color: var(--accent-blue);
}

.stat-card-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  margin-top: var(--space-2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-card-change--up {
  color: var(--accent-emerald);
  background: var(--accent-emerald-muted);
}

.stat-card-change--down {
  color: var(--accent-rose);
  background: var(--accent-rose-muted);
}


/* ---- 5.4 Forms ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.form-label-required::after {
  content: ' *';
  color: var(--accent-rose);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.5;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), var(--shadow-glow);
}

.form-input:invalid:not(:placeholder-shown) {
  border-color: var(--accent-rose);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11.5l-5-5h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--accent-rose);
}

.form-row {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.form-checkbox input,
.form-radio input {
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
}


/* ---- 5.5 Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.6;
}

.badge-blue {
  background: var(--accent-blue-muted);
  color: var(--accent-blue);
}

.badge-high,
.badge-danger {
  background: var(--accent-rose-muted);
  color: var(--accent-rose);
}

.badge-medium,
.badge-warning {
  background: var(--accent-amber-muted);
  color: var(--accent-amber);
}

.badge-low,
.badge-info {
  background: var(--accent-cyan-muted);
  color: var(--accent-cyan);
}

.badge-won,
.badge-success {
  background: var(--accent-emerald-muted);
  color: var(--accent-emerald);
}

.badge-lost {
  background: var(--accent-rose-muted);
  color: var(--accent-rose);
}

.badge-neutral {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
}

.badge-violet {
  background: var(--accent-violet-muted);
  color: var(--accent-violet);
}

/* ---- 5.6 Tags ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.tag-removable {
  cursor: pointer;
}

.tag-removable:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}


/* ---- 5.7 Tables ---- */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.table-container table {
  min-width: 600px;
}

.table-container th {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.5);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-container td {
  font-size: var(--text-base);
  color: var(--text-secondary);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.table-container tr:last-child td {
  border-bottom: none;
}

.table-container tr:hover td {
  background: rgba(59, 130, 246, 0.04);
}

.table-container tr.selected td {
  background: var(--accent-blue-muted);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.table-sort {
  cursor: pointer;
  user-select: none;
}

.table-sort:hover {
  color: var(--text-primary);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.table-pagination button,
.table-pagination .pagination__btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-pagination button:hover:not(:disabled),
.table-pagination .pagination__btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.table-pagination button:disabled,
.table-pagination .pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.table-pagination .pagination__pages {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.table-pagination .pagination__page {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-pagination .pagination__page--active {
  background: var(--gradient-1) !important;
  color: #fff !important;
  border-color: transparent !important;
  font-weight: var(--weight-bold);
  cursor: default;
}

.table-pagination .pagination__ellipsis {
  padding: 0 var(--space-1);
  color: var(--text-muted);
}

.table-container th[data-action="sort"] {
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.table-container th[data-action="sort"]:hover {
  background: rgba(59, 130, 246, 0.08) !important;
  color: var(--text-primary);
}

.table-container th[data-action="sort"]:hover .sort-icon {
  opacity: 0.8 !important;
}


/* ---- 5.8 Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s var(--transition-spring);
}

.modal-lg {
  max-width: 720px;
}

.modal-xl {
  max-width: 960px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
  font-size: var(--text-lg);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
}


/* ---- 5.9 Toasts ---- */
.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-width: 320px;
  max-width: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.35s var(--transition-spring);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.toast-success::before { background: var(--accent-emerald); }
.toast-error::before   { background: var(--accent-rose); }
.toast-warning::before { background: var(--accent-amber); }
.toast-info::before    { background: var(--accent-blue); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-success .toast-icon { color: var(--accent-emerald); }
.toast-error   .toast-icon { color: var(--accent-rose); }
.toast-warning .toast-icon { color: var(--accent-amber); }
.toast-info    .toast-icon { color: var(--accent-blue); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast-dismiss {
  color: var(--text-muted);
  padding: var(--space-1);
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.toast-dismiss:hover {
  color: var(--text-primary);
}

.toast-exit {
  animation: fadeOut 0.25s ease-in forwards;
}


/* ---- 5.10 Dropdowns ---- */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  z-index: var(--z-dropdown);
  animation: slideUp 0.2s ease-out;
  display: none;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.dropdown-item:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-primary);
}

.dropdown-item--danger:hover {
  background: var(--accent-rose-muted);
  color: var(--accent-rose);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-1) 0;
}


/* ---- 5.11 Tabs ---- */
.tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-item {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  margin-bottom: -1px;
}

.tab-item:hover {
  color: var(--text-secondary);
}

.tab-item.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.tab-content {
  padding: var(--space-5) 0;
}

.tabs-pill {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: var(--space-1);
  gap: var(--space-1);
  border-bottom: none;
}

.tabs-pill .tab-item {
  border-radius: var(--radius-sm);
  border-bottom: none;
  margin-bottom: 0;
}

.tabs-pill .tab-item.active {
  background: var(--accent-blue-muted);
  color: var(--accent-blue);
}


/* ---- 5.12 Search Bar ---- */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 400px;
  width: 100%;
}

.search-bar-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-muted);
  pointer-events: none;
  font-size: var(--text-md);
  display: flex;
  align-items: center;
}

.search-bar-input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) 40px;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), width var(--transition-base);
}

.search-bar-input::placeholder {
  color: var(--text-muted);
}

.search-bar-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-bar-clear {
  position: absolute;
  right: var(--space-3);
  color: var(--text-muted);
  display: none;
  cursor: pointer;
}

.search-bar-input:not(:placeholder-shown) ~ .search-bar-clear {
  display: flex;
}

.search-bar-kbd {
  position: absolute;
  right: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}


/* ---- 5.13 Avatars ---- */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  text-transform: uppercase;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: var(--text-xs);
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: var(--text-md);
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: var(--text-xl);
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-primary);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

.avatar-status {
  position: relative;
}

.avatar-status::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-primary);
  background: var(--accent-emerald);
}

.avatar-status--offline::after { background: var(--text-muted); }
.avatar-status--busy::after    { background: var(--accent-rose); }
.avatar-status--away::after    { background: var(--accent-amber); }


/* ---- 5.14 Progress Bar ---- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-1);
  transition: width var(--transition-slow);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s infinite;
}

.progress-bar-lg {
  height: 10px;
}

.progress-bar--emerald .progress-bar-fill { background: var(--accent-emerald); }
.progress-bar--amber .progress-bar-fill   { background: var(--accent-amber); }
.progress-bar--rose .progress-bar-fill    { background: var(--accent-rose); }


/* ---- 5.15 Tooltips ---- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  background: var(--bg-tooltip);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-tooltip);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tooltip--bottom::after {
  bottom: auto;
  top: calc(100% + 8px);
}

.tooltip--left::after {
  bottom: auto;
  left: auto;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
}

.tooltip--left:hover::after {
  transform: translateY(-50%) translateX(0);
}


/* ---- 5.16 Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  min-height: 300px;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: var(--accent-blue-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  color: var(--accent-blue);
  margin-bottom: var(--space-5);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--text-base);
  color: var(--text-muted);
  max-width: 360px;
  margin-bottom: var(--space-5);
}


/* ============================================================================
   §6 — PIPELINE / KANBAN
   ============================================================================ */

.kanban-board {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  overflow-x: auto;
  min-height: 0;
  flex: 1;
}

.kanban-column {
  min-width: 300px;
  max-width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.kanban-column-header {
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 3px solid var(--accent-blue);
  background: rgba(15, 23, 42, 0.6);
}

.kanban-column-header--cyan    { border-top-color: var(--accent-cyan); }
.kanban-column-header--emerald { border-top-color: var(--accent-emerald); }
.kanban-column-header--amber   { border-top-color: var(--accent-amber); }
.kanban-column-header--violet  { border-top-color: var(--accent-violet); }
.kanban-column-header--rose    { border-top-color: var(--accent-rose); }

.kanban-column-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.kanban-column-count {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.1);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}

.kanban-column-total {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.kanban-cards {
  flex: 1;
  padding: var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  cursor: grab;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.kanban-card:active {
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.kanban-card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.kanban-card-company {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.kanban-card-value {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--accent-emerald);
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-light);
}

.kanban-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Drop zone indicator */
.kanban-column.drag-over .kanban-cards {
  background: rgba(59, 130, 246, 0.04);
  border: 2px dashed rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
}


/* ============================================================================
   §7 — DASHBOARD CHART CONTAINERS
   ============================================================================ */

.chart-container {
  position: relative;
  width: 100%;
  padding: var(--space-4);
  min-height: 280px;
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.chart-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Card titles and subtitles */
.card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Dashboard grid layouts */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.dashboard-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.dashboard-details-grid {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: var(--space-6);
}

/* KPI Stat Cards extensions */
.stat-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
}

.stat-card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Sales Funnel styling */
.funnel-row {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-4);
  gap: var(--space-4);
}

.funnel-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 140px;
  min-width: 140px;
  flex-shrink: 0;
}

.funnel-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.funnel-name {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel-bar-container {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-full);
  height: 24px;
  overflow: hidden;
  display: flex;
  align-items: center;
  border: 1px solid var(--border-light);
}

.funnel-bar {
  height: 100%;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--space-3);
  min-width: 24px;
  transition: width var(--transition-slow) ease;
  position: relative;
}

.funnel-bar-count {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Product Focus distribution styling */
.product-distribution-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.product-dist-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}

.product-dist-item:last-child {
  border-bottom: none;
}

.product-dist-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-dist-name {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

.product-dist-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.product-dist-pct {
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}

/* Dynamic form layout extensions */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.form-field-full {
  grid-column: span 2;
}

.form-field-half {
  grid-column: span 1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

.form-tags-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  margin-left: 2px;
}

.tag button:hover {
  background: var(--accent-rose-muted);
  color: var(--accent-rose);
}


/* ============================================================================
   §8 — NOTIFICATION BELL & DROPDOWN
   ============================================================================ */

.notification-bell {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.notification-bell:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.notification-bell-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: #fff;
  background: var(--accent-rose);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
  line-height: 1;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-height: 460px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  overflow: hidden;
  display: none;
  animation: slideUp 0.2s ease-out;
}

.notification-dropdown.open {
  display: flex;
  flex-direction: column;
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.notification-list {
  overflow-y: auto;
  flex: 1;
}

.notification-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notification-item:hover {
  background: rgba(59, 130, 246, 0.04);
}

.notification-item.unread {
  background: rgba(59, 130, 246, 0.06);
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--accent-blue);
}

.notification-item-content {
  flex: 1;
}

.notification-item-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-snug);
}

.notification-item-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}


/* ============================================================================
   §9 — ACTIVITY TIMELINE
   ============================================================================ */

.timeline {
  position: relative;
  padding-left: var(--space-8);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-5);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-8) + 3px);
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 2px solid var(--accent-blue);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-dot--emerald { border-color: var(--accent-emerald); }
.timeline-dot--amber   { border-color: var(--accent-amber); }
.timeline-dot--rose    { border-color: var(--accent-rose); }
.timeline-dot--violet  { border-color: var(--accent-violet); }
.timeline-dot--cyan    { border-color: var(--accent-cyan); }

.timeline-dot-inner {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--accent-blue);
}

.timeline-dot--emerald .timeline-dot-inner { background: var(--accent-emerald); }
.timeline-dot--amber   .timeline-dot-inner { background: var(--accent-amber); }
.timeline-dot--rose    .timeline-dot-inner { background: var(--accent-rose); }

.timeline-content {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}

.timeline-title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.timeline-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.timeline-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
}


/* ============================================================================
   §10 — DOCUMENT GRID
   ============================================================================ */

.doc-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.doc-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  text-align: center;
}

.doc-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.doc-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  background: var(--accent-blue-muted);
  color: var(--accent-blue);
}

.doc-card-icon--pdf  { background: var(--accent-rose-muted); color: var(--accent-rose); }
.doc-card-icon--xls  { background: var(--accent-emerald-muted); color: var(--accent-emerald); }
.doc-card-icon--doc  { background: var(--accent-blue-muted); color: var(--accent-blue); }
.doc-card-icon--img  { background: var(--accent-violet-muted); color: var(--accent-violet); }

.doc-card-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.doc-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}


/* ============================================================================
   §11 — IMPORT WIZARD STEPS
   ============================================================================ */

.wizard-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.wizard-step-number {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.wizard-step.active .wizard-step-number {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.wizard-step.completed .wizard-step-number {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
}

.wizard-step-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

.wizard-step.active .wizard-step-label {
  color: var(--text-primary);
}

.wizard-step.completed .wizard-step-label {
  color: var(--accent-emerald);
}

.wizard-step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 var(--space-2);
  min-width: 24px;
}

.wizard-step.completed + .wizard-step-connector,
.wizard-step-connector.completed {
  background: var(--accent-emerald);
}

.wizard-body {
  padding: var(--space-6);
}

.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
}


/* ============================================================================
   §12 — LOGIN PAGE
   ============================================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-login);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,0.12) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.08) 0%, transparent 70%);
  bottom: -200px;
  left: -100px;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: var(--space-8);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s var(--transition-spring);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  text-align: center;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: #fff;
}

.login-logo-text {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.login-logo-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.login-footer a {
  color: var(--accent-blue);
  font-weight: var(--weight-medium);
}

.login-footer a:hover {
  text-decoration: underline;
}


/* Demo quick login styling */
.demo-accounts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.demo-account-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.demo-account-card:hover {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
}

.demo-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  flex-shrink: 0;
  color: var(--accent-blue);
}

.demo-avatar svg.icon {
  width: 14px;
  height: 14px;
}

.demo-info {
  min-width: 0;
  flex: 1;
}

.demo-name {
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-role {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}


/* ============================================================================
   §13 — RESPONSIVE BREAKPOINTS
   ============================================================================ */

/* Tablet — ≤ 1024px */
@media (max-width: 1024px) {
  .content-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .kanban-column {
    min-width: 260px;
  }

  .page-header {
    padding: var(--space-4);
  }

  .content-area {
    padding: var(--space-4);
  }
}

/* Mobile — ≤ 768px */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    max-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    transition: max-height var(--transition-slow);
  }

  .sidebar.mobile-open {
    max-height: 80vh;
    overflow-y: auto;
  }

  .sidebar-toggle {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .content-grid,
  .content-grid-2,
  .content-grid-3,
  .content-grid-4,
  .dashboard-kpi-grid,
  .dashboard-charts-grid,
  .dashboard-details-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .page-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .kanban-board {
    padding: var(--space-3);
    gap: var(--space-3);
  }

  .kanban-column {
    min-width: 280px;
  }

  .modal {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
  }

  .notification-dropdown {
    width: calc(100vw - 32px);
    right: -60px;
  }

  .search-bar {
    max-width: 100%;
  }

  .wizard-steps {
    overflow-x: auto;
    padding: var(--space-3);
  }

  .wizard-step-label {
    display: none;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  h1, .text-h1 { font-size: var(--text-3xl); }
  h2, .text-h2 { font-size: var(--text-2xl); }
  h3, .text-h3 { font-size: var(--text-xl); }
}

/* Small mobile — ≤ 480px */
@media (max-width: 480px) {
  .content-area {
    padding: var(--space-3);
  }

  .card-body {
    padding: var(--space-3);
  }

  .login-card {
    padding: var(--space-5);
  }

  .stat-card {
    padding: var(--space-3);
  }

  .stat-card-value {
    font-size: var(--text-2xl);
  }

  .doc-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
}


/* ============================================================================
   §14 — CUSTOM SCROLLBAR
   ============================================================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.3);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.15) transparent;
}


/* ============================================================================
   §15 — ANIMATIONS & KEYFRAMES
   ============================================================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-8px); }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(59, 130, 246, 0.2); }
  50%      { box-shadow: 0 0 24px rgba(59, 130, 246, 0.4); }
}

/* Animation utility classes */
.animate-fadeIn  { animation: fadeIn 0.3s ease-out; }
.animate-slideIn { animation: slideIn 0.35s var(--transition-spring); }
.animate-slideUp { animation: slideUp 0.35s var(--transition-spring); }
.animate-scaleIn { animation: scaleIn 0.25s ease-out; }
.animate-pulse   { animation: pulse 2s infinite; }
.animate-shimmer { animation: shimmer 2s infinite; }
.animate-spin    { animation: spin 1s linear infinite; }
.animate-bounce  { animation: bounce 1s ease infinite; }
.animate-float   { animation: float 3s ease-in-out infinite; }
.animate-glow    { animation: glow-pulse 2s ease-in-out infinite; }

/* Staggered entry */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
.stagger-6 { animation-delay: 300ms; }

/* 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;
  }
}


/* ============================================================================
   §16 — PRINT STYLES
   ============================================================================ */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    overflow: visible;
  }

  .sidebar,
  .page-header-actions,
  .notification-bell,
  .toast-container,
  .modal-overlay,
  .btn-icon,
  .sidebar-toggle,
  .search-bar {
    display: none !important;
  }

  .app-layout {
    display: block;
  }

  .main-content {
    overflow: visible;
  }

  .main-scroll {
    overflow: visible;
  }

  .card {
    border: 1px solid #ddd;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  table {
    border: 1px solid #ddd;
  }

  th, td {
    border: 1px solid #ddd;
    padding: 6px 10px;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }

  .kanban-board {
    display: block;
  }

  .kanban-column {
    page-break-inside: avoid;
    margin-bottom: 16px;
  }
}


/* ============================================================================
   §17 — SIDEBAR COLLAPSED STATE (Desktop media-query variant)
   ============================================================================ */

@media (min-width: 769px) and (max-width: 1200px) {
  .sidebar-auto-collapse .sidebar {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
  }

  .sidebar-auto-collapse .sidebar-brand,
  .sidebar-auto-collapse .sidebar-nav-label,
  .sidebar-auto-collapse .sidebar-item-label,
  .sidebar-auto-collapse .sidebar-item-badge,
  .sidebar-auto-collapse .sidebar-user-info {
    display: none;
  }

  .sidebar-auto-collapse .sidebar-item {
    justify-content: center;
    padding: var(--space-2) 0;
  }

  .sidebar-auto-collapse .sidebar-header {
    justify-content: center;
  }

  .sidebar-auto-collapse .sidebar-footer {
    justify-content: center;
  }
}


/* ============================================================================
   §18 — LOADING SKELETON
   ============================================================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.06) 25%,
    rgba(148, 163, 184, 0.12) 50%,
    rgba(148, 163, 184, 0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  pointer-events: none;
  user-select: none;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-heading {
  height: 24px;
  width: 50%;
  margin-bottom: var(--space-4);
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 160px;
  border-radius: var(--radius);
}

.skeleton-stat {
  height: 110px;
  border-radius: var(--radius);
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.skeleton-line {
  height: 12px;
  flex: 1;
  border-radius: var(--radius-xs);
}

.skeleton-btn {
  height: 36px;
  width: 100px;
  border-radius: var(--radius-sm);
}


/* ============================================================================
   §19 — STATUS DOT INDICATORS
   ============================================================================ */

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot--active,
.status-dot--online {
  background: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-dot--warning,
.status-dot--away {
  background: var(--accent-amber);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.status-dot--danger,
.status-dot--error,
.status-dot--offline {
  background: var(--accent-rose);
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.4);
}

.status-dot--info {
  background: var(--accent-blue);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.status-dot--neutral,
.status-dot--inactive {
  background: var(--text-muted);
}

.status-dot--pulse {
  animation: pulse 2s infinite;
}

.status-dot-lg {
  width: 10px;
  height: 10px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}


/* ============================================================================
   §20 — UTILITIES
   General-purpose helpers that don't fit neatly into a component.
   ============================================================================ */

/* ---- Display ---- */
.d-flex         { display: flex; }
.d-inline-flex  { display: inline-flex; }
.d-grid         { display: grid; }
.d-block        { display: block; }
.d-none         { display: none; }

/* ---- Flex utilities ---- */
.flex-col       { flex-direction: column; }
.flex-wrap      { flex-wrap: wrap; }
.flex-1         { flex: 1; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.gap-1          { gap: var(--space-1); }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }
.gap-5          { gap: var(--space-5); }
.gap-6          { gap: var(--space-6); }

/* ---- Spacing ---- */
.m-0  { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.p-0  { padding: 0; }
.p-2  { padding: var(--space-2); }
.p-3  { padding: var(--space-3); }
.p-4  { padding: var(--space-4); }
.p-5  { padding: var(--space-5); }
.p-6  { padding: var(--space-6); }

/* ---- Text alignment ---- */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ---- Overflow ---- */
.overflow-hidden  { overflow: hidden; }
.overflow-auto    { overflow: auto; }
.truncate         { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Positioning ---- */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky   { position: sticky; }

/* ---- Width ---- */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.min-h-0 { min-height: 0; }

/* ---- Borders ---- */
.border       { border: 1px solid var(--border); }
.border-top   { border-top: 1px solid var(--border); }
.border-bottom{ border-bottom: 1px solid var(--border); }
.rounded      { border-radius: var(--radius); }
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* ---- Visibility ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Cursor ---- */
.cursor-pointer { cursor: pointer; }
.cursor-grab    { cursor: grab; }
.select-none    { user-select: none; }

/* ---- Divider ---- */
.divider {
  height: 1px;
  width: 100%;
  background: var(--border);
  margin: var(--space-4) 0;
}

/* ---- Loading Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* ---- Glassmorphism Card Variant ---- */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-heavy {
  background: rgba(26, 35, 50, 0.80);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---- Gradient Borders ---- */
.gradient-border {
  position: relative;
  border: none;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient-1);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ---- Focus Ring ---- */
.focus-ring:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ---- Backdrop ---- */
.backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
}

/* ---- Mobile menu button ---- */
.mobile-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
}

/* ---- Highlight / selection ---- */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

/* ---- Revenue-specific colour bar helpers ---- */
.border-top-blue    { border-top: 3px solid var(--accent-blue); }
.border-top-cyan    { border-top: 3px solid var(--accent-cyan); }
.border-top-emerald { border-top: 3px solid var(--accent-emerald); }
.border-top-amber   { border-top: 3px solid var(--accent-amber); }
.border-top-rose    { border-top: 3px solid var(--accent-rose); }
.border-top-violet  { border-top: 3px solid var(--accent-violet); }

/* ---- Transition helpers ---- */
.transition-fast { transition: all var(--transition-fast); }
.transition-base { transition: all var(--transition-base); }
.transition-slow { transition: all var(--transition-slow); }

/* ---- Opacity helpers ---- */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-100 { opacity: 1; }

/* ---- Pointer events ---- */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }
