:root {
  /* GymPulse Global Semantic Variables */
  --primary: #652dd8;
  --primary-light: #f3f0ff;
  --primary-dark: #4f20b3;
  --secondary: #111827;
  --accent: #0ea5e9;
  
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --surface-hover: #f8fafc;
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #8b5cf6;
  
  --success: #10b981;
  --success-light: #d1fae5;
  --success-dark: #059669;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --warning-dark: #d97706;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --danger-dark: #dc2626;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --info-dark: #2563eb;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 12px 24px -4px rgba(101, 45, 216, 0.15);
  --ring: 0 0 0 3px rgba(101, 45, 216, 0.15);
  
  /* Radii */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar: 280px;
  --sidebar-collapsed: 80px;

  /* Specifics */
  --badge-bg: #f1f5f9;
  --badge-color: #334155;
  --msg-bg: #f3f0ff;
  --msg-border: #e0d4fc;
  --msg-color: #4f20b3;
  --app-sidebar-bg: #ffffff;
  --app-sidebar-border: #e2e8f0;
  --sidebar-text: #475569;
  --sidebar-text-hover: #0f172a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #8c56fa;
    --primary-light: rgba(140, 86, 250, 0.15);
    --primary-dark: #a78bfa;
    --secondary: #ffffff;
    --accent: #38bdf8;
    
    --background: #0f172a;
    --surface: #1e293b;
    --surface-alt: #172033;
    --surface-hover: #26334a;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-soft: #64748b;
    
    --border: #334155;
    --border-strong: #475569;
    --border-focus: #a78bfa;
    
    --success: #34d399;
    --success-light: rgba(16, 185, 129, 0.15);
    --success-dark: #10b981;
    --warning: #fbbf24;
    --warning-light: rgba(245, 158, 11, 0.15);
    --warning-dark: #f59e0b;
    --danger: #f87171;
    --danger-light: rgba(239, 68, 68, 0.15);
    --danger-dark: #ef4444;
    --info: #60a5fa;
    --info-light: rgba(59, 130, 246, 0.15);
    --info-dark: #3b82f6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
    --ring: 0 0 0 3px rgba(140, 86, 250, 0.25);
    
    --badge-bg: #27272a;
    --badge-color: #e2e8f0;
    --msg-bg: rgba(140, 86, 250, 0.1);
    --msg-border: rgba(140, 86, 250, 0.3);
    --msg-color: #a78bfa;
    --app-sidebar-bg: #0b1120;
    --app-sidebar-border: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #f8fafc;
  }
}

/* Local storage overrides */
[data-theme="light"] {
  --primary: #652dd8; --primary-light: #f3f0ff; --primary-dark: #4f20b3; --secondary: #111827; --accent: #0ea5e9;
  --background: #f8fafc; --surface: #ffffff; --surface-alt: #f1f5f9; --surface-hover: #f8fafc;
  --text-primary: #0f172a; --text-secondary: #334155; --text-muted: #64748b; --text-soft: #94a3b8;
  --border: #e2e8f0; --border-strong: #cbd5e1; --border-focus: #8b5cf6;
  --success: #10b981; --success-light: #d1fae5; --success-dark: #059669; --warning: #f59e0b; --warning-light: #fef3c7; --warning-dark: #d97706; --danger: #ef4444; --danger-light: #fee2e2; --danger-dark: #dc2626; --info: #3b82f6; --info-light: #dbeafe; --info-dark: #2563eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05); --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); --shadow-hover: 0 12px 24px -4px rgba(101, 45, 216, 0.15); --ring: 0 0 0 3px rgba(101, 45, 216, 0.15);
  --badge-bg: #f1f5f9; --badge-color: #334155; --msg-bg: #f3f0ff; --msg-border: #e0d4fc; --msg-color: #4f20b3; --app-sidebar-bg: #ffffff; --app-sidebar-border: #e2e8f0; --sidebar-text: #475569; --sidebar-text-hover: #0f172a;
}
[data-theme="dark"] {
  --primary: #8c56fa; --primary-light: rgba(140, 86, 250, 0.15); --primary-dark: #a78bfa; --secondary: #ffffff; --accent: #38bdf8;
  --background: #0f172a; --surface: #1e293b; --surface-alt: #172033; --surface-hover: #26334a;
  --text-primary: #f8fafc; --text-secondary: #cbd5e1; --text-muted: #94a3b8; --text-soft: #64748b;
  --border: #334155; --border-strong: #475569; --border-focus: #a78bfa;
  --success: #34d399; --success-light: rgba(16, 185, 129, 0.15); --success-dark: #10b981; --warning: #fbbf24; --warning-light: rgba(245, 158, 11, 0.15); --warning-dark: #f59e0b; --danger: #f87171; --danger-light: rgba(239, 68, 68, 0.15); --danger-dark: #ef4444; --info: #60a5fa; --info-light: rgba(59, 130, 246, 0.15); --info-dark: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4); --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3); --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3); --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4); --shadow-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.6); --ring: 0 0 0 3px rgba(140, 86, 250, 0.25);
  --badge-bg: #27272a; --badge-color: #e2e8f0; --msg-bg: rgba(140, 86, 250, 0.1); --msg-border: rgba(140, 86, 250, 0.3); --msg-color: #a78bfa; --app-sidebar-bg: #0b1120; --app-sidebar-border: #1e293b; --sidebar-text: #94a3b8; --sidebar-text-hover: #f8fafc;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--text-secondary); font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.5; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* Focus Utility (A11y) */
:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--border-focus); border-radius: var(--radius); }

/* Layout */
.app-shell { min-height: 100vh; display: flex; }
.app-workspace { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.main { width: 100%; max-width: 1536px; margin: 0 auto; padding: 32px 32px 64px; flex: 1; animation: fade-in 0.3s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Footer */
.app-footer { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: center; padding: 24px 32px; color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border); background: var(--surface); box-shadow: 0 -1px 2px rgba(0,0,0,0.02); }
.app-footer a { color: var(--primary); font-weight: 600; transition: color 0.2s; }
.app-footer a:hover { color: var(--primary-dark); }
.footer-divider { width: 4px; height: 4px; background: var(--border-strong); border-radius: 50%; }

/* Sidebar */
.sidebar-toggle { position: absolute; opacity: 0; pointer-events: none; }
.app-sidebar { position: sticky; top: 0; height: 100vh; width: var(--sidebar); flex: 0 0 var(--sidebar); display: flex; flex-direction: column; padding: 20px 16px; background: var(--app-sidebar-bg); color: var(--sidebar-text); border-right: 1px solid var(--app-sidebar-border); transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1), width .3s cubic-bezier(0.4, 0, 0.2, 1), flex-basis .3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 40; }
.sidebar-head { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-md); background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-weight: 900; box-shadow: var(--shadow-md); font-size: 18px; }
.brand-copy { display: grid; min-width: 0; }
.brand strong { color: var(--text-primary); font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.brand small { color: var(--text-muted); font-size: 12px; font-weight: 600; }

.side-nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overflow-x: hidden; }
.side-nav::-webkit-scrollbar { width: 4px; }
.side-nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.nav-section { margin: 24px 12px 8px; color: var(--text-soft); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-md); color: var(--sidebar-text); font-weight: 600; transition: all .2s ease; border: 1px solid transparent; }
.side-nav a:hover, .side-nav a:focus-visible { background: var(--surface-alt); color: var(--text-primary); }
.side-nav a.active { background: var(--primary-light); color: var(--primary); font-weight: 700; border-color: rgba(101, 45, 216, 0.1); box-shadow: var(--shadow-sm); }
.side-nav a svg { color: var(--text-soft); transition: color .2s; }
.side-nav a:hover svg { color: var(--text-primary); }
.side-nav a.active svg { color: var(--primary); }

/* Toggle State (Desktop Only) */
@media (min-width: 901px) {
  .sidebar-toggle:checked ~ .app-sidebar { width: var(--sidebar-collapsed); flex-basis: var(--sidebar-collapsed); }
  .sidebar-toggle:checked ~ .app-sidebar .brand-copy, .sidebar-toggle:checked ~ .app-sidebar .side-nav span:not(.nav-section), .sidebar-toggle:checked ~ .app-sidebar .nav-section { display: none; }
  .sidebar-toggle:checked ~ .app-sidebar .side-nav a { justify-content: center; padding: 10px; }
  .sidebar-toggle:checked ~ .app-sidebar .side-nav a svg { margin: 0; }
}

/* Header Topbar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 12px 32px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: background 0.3s; }
[data-theme="dark"] .topbar { background: rgba(30, 41, 59, 0.85); }
.sidebar-menu-btn { display: inline-grid; }
.global-search { position: relative; flex: 1; max-width: 560px; }
.global-search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.global-search input { width: 100%; height: 44px; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface-alt); padding: 0 16px 0 48px; outline: none; transition: all .2s ease; color: var(--text-primary); font-size: 14px; }
.global-search input:hover { border-color: var(--border-strong); }
.global-search input:focus { border-color: var(--primary); box-shadow: var(--ring); background: var(--surface); }

/* UI Elements */
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); color: var(--text-secondary); padding: 0; transition: all .2s ease; }
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-alt); color: var(--text-primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: translateY(0); }

.user-chip { display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 6px; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); min-width: 0; transition: all .2s ease; cursor: pointer; }
.user-chip:hover { border-color: var(--border-strong); background: var(--surface-alt); box-shadow: var(--shadow-sm); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-light), #dbeafe); color: var(--primary-dark); font-weight: 800; border: 1px solid var(--border); font-size: 14px; }
.user-chip strong, .user-chip small { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: 14px; color: var(--text-primary); font-weight: 700; line-height: 1.2; }
.user-chip small { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.logout { margin: 0; }

/* Typography Hierarchy */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 0 0 32px; flex-wrap: wrap; }
.page-title-group { display: flex; flex-direction: column; gap: 6px; }
.page-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; background: var(--primary-light); padding: 4px 12px; border-radius: var(--radius-full); width: max-content; }
.page-head h1 { margin: 0; color: var(--text-primary); font-size: 32px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
.page-head p { margin: 0; color: var(--text-muted); font-size: 15px; }
.top-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

h1, h2, h3, h4, h5, h6 { color: var(--text-primary); font-weight: 700; margin-top: 0; }

/* Buttons System */
.btn, .quick-actions a, .action-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-secondary); padding: 8px 18px; font-weight: 600; font-size: 14px; white-space: nowrap; transition: all .2s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; box-shadow: var(--shadow-sm); }
.btn:hover, .quick-actions a:hover, .action-button:hover { border-color: var(--border-strong); background: var(--surface-alt); color: var(--text-primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active, .quick-actions a:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: 0.6; pointer-events: none; }

.btn.primary { background: var(--primary); border-color: var(--primary-dark); color: #fff; box-shadow: 0 1px 2px rgba(101, 45, 216, 0.3), inset 0 1px 0 rgba(255,255,255,0.1); }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 6px 16px rgba(101, 45, 216, 0.4), inset 0 1px 0 rgba(255,255,255,0.1); transform: translateY(-2px); }
.btn.primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(101, 45, 216, 0.3); }
.btn.secondary { background: var(--surface-alt); border-color: var(--border); color: var(--text-primary); }
.btn.danger { color: var(--danger); border-color: var(--danger-light); background: rgba(239, 68, 68, 0.05); }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger-dark); }
.btn.success { color: var(--success); border-color: var(--success-light); background: rgba(16, 185, 129, 0.05); }
.btn.success:hover { background: var(--success); color: #fff; border-color: var(--success-dark); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-alt); border-color: transparent; }

/* Panels & Cards */
.panel, .form-card, .table-panel, .lead-card, .stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); transition: all .3s cubic-bezier(0.4, 0, 0.2, 1); }
.panel:hover, .stat-card:hover, .lead-card:hover { box-shadow: var(--shadow-hover); border-color: var(--border-strong); transform: translateY(-2px); }
.panel, .form-card { padding: 24px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.panel h2, .panel-head h2 { margin: 0; color: var(--text-primary); font-size: 18px; font-weight: 800; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.split { display: grid; grid-template-columns: 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }

/* Stats Widgets */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-bottom: 32px; }
.stat-card { position: relative; overflow: hidden; padding: 24px; display: flex; flex-direction: column; justify-content: center; }
.stat-card:after { content: ""; position: absolute; right: 0; bottom: 0; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%); opacity: 0.5; pointer-events: none; transform: translate(30%, 30%); }
.stat-card span { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card strong { display: block; margin-top: 16px; color: var(--text-primary); font-size: 36px; line-height: 1; font-weight: 900; }
.stat-card small { display: block; margin-top: 10px; color: var(--text-muted); font-weight: 600; font-size: 13px; }

/* Forms */
.filters { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-primary); padding: 12px 16px; outline: none; transition: all .2s ease; font-size: 14px; box-shadow: var(--shadow-sm); }
textarea { resize: vertical; min-height: 100px; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); background: var(--surface); }
label { display: grid; gap: 8px; color: var(--text-primary); font-weight: 600; font-size: 14px; }
.stack-form { display: grid; gap: 20px; }
.errorlist { margin: 0 0 16px; padding: 16px; border: 1px solid var(--danger-light); border-radius: var(--radius-md); background: rgba(239,68,68,0.05); color: var(--danger); font-weight: 600; font-size: 14px; list-style: none; display: flex; flex-direction: column; gap: 8px; }

/* Input Groups */
.input-group { position: relative; display: flex; align-items: center; }
.input-group svg.prefix { position: absolute; left: 16px; color: var(--text-muted); pointer-events: none; }
.input-group input.has-prefix { padding-left: 48px; }

/* Lists & Feed Rows */
.rows { display: flex; flex-direction: column; }
.row { 
  display: flex; align-items: center; justify-content: space-between; 
  padding: 16px; border-bottom: 1px solid var(--border);
  transition: background .2s ease;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-hover); }
.link-row { 
  text-decoration: none; color: var(--text-primary); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.link-row:hover { background: var(--surface-alt); }
.link-row span { font-weight: 600; font-size: 14px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.link-row strong { font-size: 13px; color: var(--text-muted); }

/* Tables */
.table-panel { overflow-x: auto; max-width: 100vw; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }
.crm-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 900px; }
.crm-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-alt); color: var(--text-secondary); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.crm-table th, .crm-table td { text-align: left; border-bottom: 1px solid var(--border); padding: 16px 24px; vertical-align: middle; font-size: 14px; color: var(--text-secondary); }
.crm-table tbody tr { transition: background .2s ease; }
.crm-table tbody tr:hover { background: var(--surface-alt); }
.crm-table tbody tr:last-child td { border-bottom: 0; }
.primary-cell { display: grid; gap: 6px; }
.primary-cell a, .primary-cell strong { font-weight: 700; color: var(--text-primary); font-size: 15px; }
.primary-cell a:hover { color: var(--primary); text-decoration: underline; }
td small, .cell-sub { display: block; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.table-actions { display: flex; gap: 8px; justify-content: flex-end; opacity: 0.7; transition: opacity 0.2s; }
.crm-table tbody tr:hover .table-actions { opacity: 1; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; border-radius: var(--radius-full); padding: 4px 12px; background: var(--badge-bg); color: var(--badge-color); font-size: 12px; font-weight: 700; border: 1px solid var(--border); white-space: nowrap; }
.badge.status-new { background: var(--info-light); color: var(--info-dark); border-color: rgba(59,130,246,0.2); }
.badge.status-customer, .badge.status-interested, .badge.status-veryinterested { background: var(--success-light); color: var(--success-dark); border-color: rgba(16,185,129,0.2); }
.badge.status-demoscheduled, .badge.status-democompleted, .badge.status-trialstarted { background: rgba(139,92,246,0.1); color: #8b5cf6; border-color: rgba(139,92,246,0.2); }
.badge.status-rejected, .badge.status-wrongnumber, .badge.status-notreachable { background: var(--danger-light); color: var(--danger-dark); border-color: rgba(239,68,68,0.2); }
.badge.priority-high { background: var(--danger-light); color: var(--danger-dark); border-color: rgba(239,68,68,0.2); }
.badge.priority-medium { background: var(--warning-light); color: var(--warning-dark); border-color: rgba(245,158,11,0.2); }
.badge.priority-low { background: var(--success-light); color: var(--success-dark); border-color: rgba(16,185,129,0.2); }

/* Notifications System */
.notification-wrapper { position: relative; }
.notif-badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; background: var(--danger); color: #fff; border-radius: var(--radius-full); font-size: 11px; font-weight: 900; display: flex; align-items: center; justify-content: center; padding: 0 6px; border: 2px solid var(--surface); box-shadow: var(--shadow-sm); }
.notif-dropdown { position: absolute; right: 0; top: calc(100% + 12px); width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); z-index: 50; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all .2s cubic-bezier(0.16, 1, 0.3, 1); }
.notif-btn:focus ~ .notif-dropdown, .notif-dropdown:hover, .notif-dropdown:focus-within, .notif-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.notif-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.notif-body { max-height: 400px; overflow-y: auto; }
.notif-item { display: flex; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); transition: background .2s ease; text-decoration: none; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-alt); }
.notif-item.unread { background: var(--primary-light); }
.notif-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--surface); color: var(--primary); flex-shrink: 0; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.notif-text strong { display: block; font-size: 14px; color: var(--text-primary); margin-bottom: 4px; font-weight: 700; }
.notif-text p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.notif-text small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 6px; font-weight: 600; }
.notif-foot { padding: 14px; text-align: center; border-top: 1px solid var(--border); background: var(--surface-alt); border-radius: 0 0 var(--radius-xl) var(--radius-xl); display: flex; justify-content: space-between; align-items: center; }

/* Empty States & Loading Skeletons */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 32px; text-align: center; border: 2px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.empty-state-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--surface-alt); color: var(--text-muted); display: grid; place-items: center; margin-bottom: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.empty-state-icon svg { width: 32px; height: 32px; }
.empty-state h3 { font-size: 18px; font-weight: 800; color: var(--text-primary); margin: 0 0 8px; }
.empty-state p { font-size: 14px; color: var(--text-muted); margin: 0 0 24px; max-width: 400px; line-height: 1.6; }
.empty-state .actions { display: flex; gap: 12px; justify-content: center; }

/* Legacy Muted Fallbacks for unedited templates */
.panel > .muted:only-child, .rows > .muted:only-child, .pipeline-bars > .muted:only-child { padding: 48px 24px; text-align: center; border: 2px dashed var(--border); border-radius: var(--radius-lg); font-weight: 600; color: var(--text-muted); display: block; background: var(--surface-alt); margin: 16px 0; }
.crm-table tbody tr td p.muted { padding: 32px; text-align: center; border: 2px dashed var(--border); border-radius: var(--radius-lg); display: block; margin: 16px auto; max-width: 600px; background: var(--surface-alt); font-weight: 600; }

/* Skeletons */
.skeleton { background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%); background-size: 400% 100%; animation: skeleton-loading 1.5s infinite; border-radius: var(--radius); }
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade-in 0.2s ease-out; }
.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; position: relative; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1); padding: 32px; }
@keyframes slide-up { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-close { position: absolute; top: 20px; right: 20px; background: var(--surface-alt); border: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.modal-close:hover { background: var(--border); color: var(--text-primary); transform: rotate(90deg); }

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1); width: var(--sidebar); flex-basis: var(--sidebar); z-index: 100; box-shadow: var(--shadow-lg); }
  .sidebar-toggle:checked ~ .app-sidebar { transform: translateX(0); }
  .sidebar-toggle:checked ~ .app-sidebar .side-nav a { justify-content: flex-start; }
  .topbar { gap: 12px; padding: 12px 20px; flex-wrap: wrap; }
  .global-search { max-width: 100%; flex: 1 1 100%; order: 3; margin-top: 8px; }
  .user-chip { padding: 4px; }
  .user-chip span:not(.avatar) { display: none; }
  .page-head { display: grid; gap: 16px; }
  .top-actions { justify-content: flex-start; flex-wrap: wrap; }
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .main { padding: 24px 16px 48px; }
  .topbar { padding: 12px 16px; }
  .global-search input { height: 40px; padding-left: 40px; }
  .page-head h1 { font-size: 26px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card strong { font-size: 32px; }
  .panel, .form-card { padding: 20px; }
  .app-footer { justify-content: flex-start; padding: 20px; }
  .topbar .logout { display: none; }
}
