@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Nunito:wght@400;500;600;700;800;900&family=DM+Mono:wght@400;500&family=Source+Sans+3:wght@300;400;600;700&display=swap');

/* Sticky Pages — Theme: aura */
/* Generated by assets/css/theme.php */

/* ── RESET & BASE ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --brand:         #4f46e5;
  --brand-dark:    #4338ca;
  --brand-light:   #818cf8;

  /* Backgrounds */
  --bg-base:       #f0f2f8;
  --bg-surface:    #ffffff;
  --bg-elevated:   #fafbff;
  --bg-overlay:    rgba(0,0,0,.6);
  --sidebar-bg:    #1e1b4b;
  --topbar-bg:     #ffffff;
  --active-nav:    rgba(79,70,229,.15);

  /* Borders */
  --border:        #e8eaf2;
  --border-muted:  #d4d8ee;

  /* Text */
  --text-primary:  #111827;
  --text-secondary:#4b5563;
  --text-muted:    #9ca3af;

  /* Status (legacy color aliases kept for backward compatibility) */
  --color-ok:     #22c55e;
  --color-low:    #f59e0b;
  --color-empty:  #ef4444;
  --color-free:   #3b82f6;
  --color-sale:   #4ade80;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Transitions */
  --transition: .15s ease;

  /* ── Spacing scale (4px base) ─────────────────────────────────────────── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-6:  24px;
  --space-8:  32px;
  --space-12: 48px;
  --space-16: 64px;

  /* ── Status colors — NEVER change with theme ──────────────────────────── */
  --status-success:    #22c55e;
  --status-success-bg: rgba(34,197,94,.12);
  --status-warning:    #f59e0b;
  --status-warning-bg: rgba(245,158,11,.12);
  --status-error:      #ef4444;
  --status-error-bg:   rgba(239,68,68,.12);
  --status-info:       #3b82f6;
  --status-info-bg:    rgba(59,130,246,.12);

  /* ── Typography ───────────────────────────────────────────────────────── */
  --font-size-xs:   11px;
  --font-size-sm:   12px;
  --font-size-base: 14px;
  --font-size-md:   15px;
  --font-size-lg:   18px;
  --font-size-xl:   24px;
  --font-weight-normal:    400;
  --font-weight-medium:    500;
  --font-weight-semibold:  600;
  --font-weight-bold:      700;
  --font-weight-extrabold: 800;
}

html, body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}




/* ══════════════════════════════════════════════════════════════
   AURA — Minimalist/Refined: floating cards, sidebar glow,
   Plus Jakarta Sans, pill buttons, accent lift on hover.
   ══════════════════════════════════════════════════════════════ */

/* ── Font ── */
html, body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  color: #111827 !important;
  background: #f0f2f8 !important;
}

/* ── Light-mode base overrides (same as lumina) ── */
:root {
  --shadow-sm: 0 1px 3px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.1),  0 4px 8px rgba(0,0,0,.06);
  --bg-overlay: rgba(15,23,42,.55);
  --status-success:    #16a34a;
  --status-success-bg: rgba(22,163,74,.1);
  --status-error:      #dc2626;
  --status-error-bg:   rgba(220,38,38,.1);
  --status-warning:    #d97706;
  --status-warning-bg: rgba(217,119,6,.1);
  --status-info:       #2563eb;
  --status-info-bg:    rgba(37,99,235,.1);
}

/* ── Sidebar: dark navy with top glow ── */
#crm-sidebar {
  box-shadow: 4px 0 24px rgba(0,0,0,.12) !important;
  border-right-color: rgba(255,255,255,.08) !important;
  overflow: hidden;
}
/* Radial glow at top of sidebar */
#crm-sidebar::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(99,102,241,.38) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
/* Grain overlay */
#crm-sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}
/* Sidebar content sits above pseudo-elements */
#crm-sidebar > * { position: relative; z-index: 2; }

/* Sidebar text colours */
#crm-sidebar { color: #e0e7ff; }
#crm-sidebar .sidebar-link,
#crm-sidebar .user-nav-link          { color: #c7d2fe !important; }
#crm-sidebar .sidebar-link:hover,
#crm-sidebar .user-nav-link:hover    { background: rgba(255,255,255,.08) !important; color: #ffffff !important; }

/* Active link: left inset accent bar instead of filled pill */
#crm-sidebar .sidebar-link.active,
#crm-sidebar .user-nav-link.active   {
  background: rgba(79,70,229,.18) !important;
  color: #a5b4fc !important;
  box-shadow: inset 3px 0 0 #818cf8;
}
#crm-sidebar .sidebar-section-label  { color: rgba(199,210,254,.45) !important; }
#crm-sidebar [style*="color:var(--text-primary)"]   { color: #ffffff !important; }
#crm-sidebar [style*="color:var(--text-muted)"]     { color: rgba(199,210,254,.55) !important; }
#crm-sidebar [style*="color:var(--text-secondary)"] { color: #c7d2fe !important; }
#crm-sidebar [style*="var(--border)"]               { border-color: rgba(255,255,255,.08) !important; }
#crm-sidebar [style*="var(--bg-elevated)"]          { background: rgba(255,255,255,.08) !important; }

/* ── Topbar ── */
#crm-topbar { box-shadow: 0 1px 4px rgba(0,0,0,.06) !important; }
.crm-breadcrumb { border-bottom-color: var(--border) !important; background: #fff !important; }

/* Topbar logout button → soft red on light bg */
#crm-topbar button[onclick="doLogout()"] {
  background: #fee2e2 !important; color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}
#crm-topbar button[onclick="doLogout()"]:hover { background: #fecaca !important; }
#crm-topbar [style*="color:#4ade80"] { color: #16a34a !important; }

/* ── Cards: floating with lift-on-hover ── */
.crm-card {
  box-shadow: 0 1px 4px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.04) !important;
  border-color: #e8eaf2 !important;
  border-radius: 14px !important;
  transition: transform .22s cubic-bezier(.4,0,.2,1),
              box-shadow .22s cubic-bezier(.4,0,.2,1),
              border-color .22s !important;
}
.crm-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 28px rgba(79,70,229,.1), 0 2px 8px rgba(0,0,0,.06) !important;
  border-color: rgba(79,70,229,.18) !important;
}

/* ── Buttons ── */
/* Primary: pill shape with glow */
.crm-btn--primary {
  border-radius: 9999px !important;
  box-shadow: 0 4px 14px rgba(79,70,229,.3) !important;
}
.crm-btn--primary:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 8px 24px rgba(79,70,229,.4) !important;
}
/* nav.php topbar btn */
.btn-primary, #crm-topbar button.topbar-btn,
#crm-topbar button[style*="background:var(--brand)"] {
  border-radius: 9999px !important;
}
/* Danger: light red */
.crm-btn--danger, .btn-danger { background: #dc2626 !important; color: #fff !important; }
.crm-btn--success, .btn-success { background: #16a34a !important; color: #fff !important; }

/* ── Badges → pill with leading dot ── */
.badge {
  border-radius: 9999px !important;
  padding: 3px 10px !important;
}

/* ── Dark badge colour overrides (same as lumina) ── */
.badge[style*="background:#14532d"], span[style*="background:#14532d"], div[style*="background:#14532d"] {
  background: #dcfce7 !important; color: #16a34a !important; border: 1px solid #86efac !important;
}
.badge[style*="background:#7f1d1d"], span[style*="background:#7f1d1d"], div[style*="background:#7f1d1d"] {
  background: #fee2e2 !important; color: #dc2626 !important; border: 1px solid #fca5a5 !important;
}
.badge[style*="background:#1e3a5f"], span[style*="background:#1e3a5f"], div[style*="background:#1e3a5f"] {
  background: #dbeafe !important; color: #2563eb !important; border: 1px solid #93c5fd !important;
}
.badge[style*="background:#92400e"], span[style*="background:#92400e"], div[style*="background:#92400e"],
.badge[style*="background:#78350f"], span[style*="background:#78350f"], div[style*="background:#78350f"] {
  background: #fef9c3 !important; color: #b45309 !important; border: 1px solid #fde68a !important;
}
.badge[style*="background:#581c87"], span[style*="background:#581c87"], div[style*="background:#581c87"] {
  background: #f5f3ff !important; color: #7c3aed !important; border: 1px solid #ddd6fe !important;
}

/* Dark text overrides */
#crm-main [style*="color:#4ade80"], #crm-content [style*="color:#4ade80"],
.crm-card [style*="color:#4ade80"], td[style*="color:#4ade80"] { color: #16a34a !important; }
[style*="color:#cbd5e1"] { color: var(--text-secondary) !important; }

/* ── Legacy badge classes ── */
.crm-badge--free  { background: #eff6ff !important; color: #2563eb !important; border: 1px solid #bfdbfe !important; }
.crm-badge--ok    { background: #f0fdf4 !important; color: #16a34a !important; border: 1px solid #bbf7d0 !important; }
.crm-badge--low   { background: #fffbeb !important; color: #d97706 !important; border: 1px solid #fde68a !important; }
.crm-badge--empty { background: #fef2f2 !important; color: #dc2626 !important; border: 1px solid #fecaca !important; }

/* ── Alerts ── */
.crm-alert--error   { background: #fef2f2 !important; color: #dc2626 !important; border-color: #fecaca !important; }
.crm-alert--success { background: #f0fdf4 !important; color: #16a34a !important; border-color: #bbf7d0 !important; }
.crm-alert--warning { background: #fffbeb !important; color: #d97706 !important; border-color: #fde68a !important; }
.crm-alert--info    { background: #eff6ff !important; color: #2563eb !important; border-color: #bfdbfe !important; }

/* ── Disposition buttons ── */
.crm-disp--sale           { background: #dcfce7 !important; color: #16a34a !important; border-color: #86efac !important; }
.crm-disp--followup       { background: #dbeafe !important; color: #2563eb !important; border-color: #93c5fd !important; }
.crm-disp--not-interested { background: #f1f5f9 !important; color: #64748b !important; border-color: #cbd5e1 !important; }
.crm-disp--callback       { background: #fefce8 !important; color: #ca8a04 !important; border-color: #fde68a !important; }
.crm-disp--dnc            { background: #fef2f2 !important; color: #dc2626 !important; border-color: #fecaca !important; }

/* ── Toast icons ── */
.crm-toast--success .crm-toast-icon { color: #16a34a !important; }
.crm-toast--error   .crm-toast-icon { color: #dc2626 !important; }
.crm-toast--warning .crm-toast-icon { color: #d97706 !important; }
.crm-toast--info    .crm-toast-icon { color: #2563eb !important; }
.crm-toast--success { border-color: #bbf7d0 !important; }
.crm-toast--error   { border-color: #fecaca !important; }
.crm-toast--warning { border-color: #fde68a !important; }
.crm-toast--info    { border-color: #bfdbfe !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar-thumb { background: #d4d8ee !important; }
::-webkit-scrollbar-thumb:hover { background: #b8c0dc !important; }

/* ── Disposition class badges ── */
.disp-Sale           { background: #dcfce7 !important; color: #16a34a !important; }
.disp-Followup       { background: #dbeafe !important; color: #2563eb !important; }
.disp-Not_Interested,
.disp-Not-Interested { background: #f1f5f9 !important; color: #64748b !important; }
.disp-Callback       { background: #fefce8 !important; color: #ca8a04 !important; }
.disp-DNC            { background: #fee2e2 !important; color: #dc2626 !important; }
.disp-Surrender      { background: #f5f3ff !important; color: #7c3aed !important; }

/* ── Modal backdrop z-index stays above TeamChat ── */
.modal-backdrop { z-index: 99999 !important; }

/* ── TeamChat light theme (same as lumina) ── */
#crm-chat-panel { background: #ffffff !important; border-color: #e8eaf2 !important; box-shadow: 0 -4px 20px rgba(0,0,0,.07) !important; }
#crm-chat-panel-hdr:hover { background: #fafbff !important; }
.crm-u-row { background: #ffffff !important; border-bottom-color: #f0f2f8 !important; }
.crm-u-row:hover { background: #fafbff !important; }
.crm-chat-win { background: #ffffff !important; border-color: #e8eaf2 !important; }
.crm-cwin-hdr { background: #fafbff !important; }
.crm-cwin-hdr:hover { background: #f0f2f8 !important; }
.crm-cwin-msgs { background: #f8fafc !important; }
.crm-bubble-them { background: #ffffff !important; color: #111827 !important; border-color: #e8eaf2 !important; }
.crm-bubble-me { background: #4f46e5 !important; }
.crm-cwin-foot { background: #ffffff !important; border-top-color: #e8eaf2 !important; }
.crm-chat-input { background: #fafbff !important; border-color: #e8eaf2 !important; color: #111827 !important; }
.crm-chat-input:focus { border-color: #4f46e5 !important; }
.crm-chat-send-btn { background: #4f46e5 !important; border-radius: 9999px !important; }
.crm-chat-send-btn:hover { background: #4338ca !important; }
.crm-doc-link { background: #f0f2f8 !important; border-color: #e8eaf2 !important; color: #2563eb !important; }


/* ── FOCUS MANAGEMENT ──────────────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

/* ── SCROLLBAR ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar          { width: 6px; height: 6px; }
::-webkit-scrollbar-track    { background: var(--bg-base); }
::-webkit-scrollbar-thumb    { background: var(--border-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── CARD ──────────────────────────────────────────────────────────────────── */
.crm-card {
  background:    var(--bg-surface);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:    var(--shadow-sm);
}

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.crm-btn {
  display:        inline-flex;
  align-items:    center;
  justify-content:center;
  gap:            6px;
  padding:        8px 18px;
  border:         none;
  border-radius:  var(--radius-md);
  font-size:      .875rem;
  font-weight:    600;
  cursor:         pointer;
  transition:     background var(--transition), transform 80ms ease, box-shadow var(--transition);
  white-space:    nowrap;
  text-decoration:none;
}
.crm-btn:disabled { opacity: .45; cursor: not-allowed; }
.crm-btn:active { transform: scale(0.98); }
.crm-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-md); }

.crm-btn--primary   { background: var(--brand);     color: #fff; }
.crm-btn--primary:hover { background: var(--brand-dark); box-shadow: 0 2px 8px rgba(0,0,0,.3); }

.crm-btn--secondary { background: var(--bg-elevated); color: var(--text-secondary);
                       border: 1px solid var(--border-muted); }
.crm-btn--secondary:hover { background: var(--border-muted); color: var(--text-primary); }

.crm-btn--danger    { background: #7f1d1d; color: #fff; }
.crm-btn--danger:hover  { background: #6b1919; }

.crm-btn--success   { background: #166534; color: #fff; }
.crm-btn--success:hover { background: #14532d; }

.crm-btn--sm  { padding: 5px 12px; font-size: .8rem; }
.crm-btn--lg  { padding: 12px 28px; font-size: 1rem; }
.crm-btn--full{ width: 100%; }

/* ── FORM ELEMENTS ────────────────────────────────────────────────────────── */
.crm-input, .crm-select, .crm-textarea {
  background:    var(--bg-elevated);
  border:        1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding:       9px 12px;
  color:         var(--text-primary);
  font-size:     .875rem;
  width:         100%;
  outline:       none;
  transition:    border-color var(--transition);
  font-family:   inherit;
}
.crm-input:focus, .crm-select:focus, .crm-textarea:focus {
  border-color: var(--brand);
}
.crm-textarea { resize: vertical; min-height: 80px; }
.crm-label {
  display:      block;
  margin-bottom:4px;
  font-size:    .8rem;
  font-weight:  500;
  color:        var(--text-secondary);
}

/* Form group helpers */
.crm-form-group { margin-bottom: var(--space-4); }
.crm-form-hint  { font-size: var(--font-size-xs); color: var(--text-muted); margin-top: 4px; }
.crm-form-error { font-size: var(--font-size-xs); color: var(--status-error); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.crm-input.error, .crm-select.error, .crm-textarea.error { border-color: var(--status-error); }
.crm-input.success { border-color: var(--status-success); }

/* ── BADGE ────────────────────────────────────────────────────────────────── */
.crm-badge {
  display:       inline-flex;
  align-items:   center;
  padding:       2px 8px;
  border-radius: 9999px;
  font-size:     .7rem;
  font-weight:   700;
  line-height:   1.6;
}
/* Legacy variants */
.crm-badge--free  { background: #1d4ed822; color: #60a5fa; border: 1px solid #1d4ed8; }
.crm-badge--ok    { background: #16653422; color: #4ade80; border: 1px solid #166534; }
.crm-badge--low   { background: #92400e22; color: #fcd34d; border: 1px solid #92400e; }
.crm-badge--empty { background: #7f1d1d22; color: #fca5a5; border: 1px solid #7f1d1d; }
/* Status-variable-based variants */
.crm-badge--success { background: var(--status-success-bg); color: var(--status-success); border: 1px solid rgba(34,197,94,.25); }
.crm-badge--warning { background: var(--status-warning-bg); color: var(--status-warning); border: 1px solid rgba(245,158,11,.25); }
.crm-badge--error   { background: var(--status-error-bg);   color: var(--status-error);   border: 1px solid rgba(239,68,68,.25); }
.crm-badge--info    { background: var(--status-info-bg);    color: var(--status-info);    border: 1px solid rgba(59,130,246,.25); }

/* ── TABLE ────────────────────────────────────────────────────────────────── */
.crm-table { width: 100%; border-collapse: collapse; }
.crm-table th {
  padding: 10px 14px; text-align: left;
  font-size: .75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.crm-table td {
  padding: 11px 14px; font-size: .875rem; color: var(--text-secondary);
  border-bottom: 1px solid var(--bg-base);
}
.crm-table tr:hover td { background: var(--bg-elevated); }

/* Sticky header + transitions */
.crm-table thead th { position: sticky; top: 0; background: var(--bg-surface); z-index: 1; }
.crm-table tbody tr { transition: background 80ms ease; }
.crm-table-wrap { overflow-x: auto; overflow-y: auto; max-height: 70vh; }

/* Row action reveal on hover */
.crm-table .row-actions { opacity: 0; pointer-events: none; transition: opacity 100ms ease; }
.crm-table tr:hover .row-actions { opacity: 1; pointer-events: auto; }

/* Sortable column indicators */
.crm-table th[data-sort] { cursor: pointer; user-select: none; }
.crm-table th[data-sort]:hover { color: var(--text-primary); }
.crm-table th[data-sort-dir="asc"]::after  { content: ' ↑'; color: var(--brand); }
.crm-table th[data-sort-dir="desc"]::after { content: ' ↓'; color: var(--brand); }

/* Checkbox column */
.crm-table .col-check { width: 40px; }
.crm-table input[type="checkbox"] { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.crm-modal-backdrop {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
}
.crm-modal {
  background:    var(--bg-surface);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:       24px;
  width:         480px;
  max-width:     95vw;
  max-height:    90vh;
  overflow-y:    auto;
  position:      relative;
  box-shadow:    var(--shadow-lg);
}

/* ── ALERT BANNERS ────────────────────────────────────────────────────────── */
.crm-alert {
  padding: 10px 14px; border-radius: var(--radius-md);
  font-size: .875rem; margin-bottom: 12px;
}
.crm-alert--error   { background: #7f1d1d22; color: #fca5a5; border: 1px solid #7f1d1d; }
.crm-alert--success { background: #14532d22; color: #bbf7d0; border: 1px solid #166534; }
.crm-alert--warning { background: #78350f22; color: #fcd34d; border: 1px solid #92400e; }
.crm-alert--info    { background: #1e3a5f22; color: #93c5fd; border: 1px solid #1e3a5f; }

/* ── PROGRESS BAR ─────────────────────────────────────────────────────────── */
.crm-progress {
  background: var(--bg-elevated);
  border-radius: 9999px;
  height: 6px;
  overflow: hidden;
}
.crm-progress-bar {
  height: 100%;
  border-radius: 9999px;
  background: var(--brand);
  transition: width .4s ease;
}

/* ── DISPOSITION BUTTONS ──────────────────────────────────────────────────── */
.crm-disp-btn {
  flex: 1; min-width: 120px;
  padding: 10px 14px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-size: .85rem; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
  text-align: center;
}
.crm-disp-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.crm-disp--sale          { background: #14532d;   color: #4ade80;  border-color: #166534; }
.crm-disp--followup      { background: #1e3a5f;   color: #60a5fa;  border-color: #1d4ed8; }
.crm-disp--not-interested{ background: #1e293b;   color: #94a3b8;  border-color: #334155; }
.crm-disp--callback      { background: #78350f22; color: #fcd34d;  border-color: #92400e; }
.crm-disp--dnc           { background: #7f1d1d22; color: #fca5a5;  border-color: #7f1d1d; }
.crm-disp--surrender     { background: #581c87;   color: #d8b4fe;  border-color: #6d28d9; }

/* ── UTILITY ──────────────────────────────────────────────────────────────── */
.crm-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

[x-cloak] { display: none !important; }

/* ── TOPBAR LOGOUT BUTTON (themed) ───────────────────────────────────────── */
.crm-topbar-logout {
  background: #7f1d1d; color: #fca5a5; border: none; border-radius: 7px;
  padding: 5px 12px; font-size: .75rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.crm-topbar-logout:hover { background: #6b1919; }

/* ── LAYOUT (sidebar pages) ───────────────────────────────────────────────── */
.crm-layout { min-height: 100vh; }

#crm-sidebar {
  background: var(--sidebar-bg) !important;
  border-right-color: var(--border) !important;
}

#crm-topbar {
  background: var(--topbar-bg) !important;
  border-bottom-color: var(--border) !important;
}

/* ── SIDEBAR 3-STATE SUPPORT ──────────────────────────────────────────────── */
#crm-sidebar { transition: width 200ms cubic-bezier(.4,0,.2,1); }
#crm-sidebar.collapsed { width: 56px !important; }
#crm-sidebar.collapsed .sidebar-link-text    { display: none; }
#crm-sidebar.collapsed .sidebar-section-label{ display: none; }
#crm-sidebar.collapsed .sidebar-logo-text   { display: none; }
#crm-sidebar.collapsed .sidebar-link        { justify-content: center; padding: 9px; }
#crm-main { transition: margin-left 200ms cubic-bezier(.4,0,.2,1); }
.sidebar-section-label {
  padding: 8px 16px 2px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted);
}

/* ── SKELETON SCREENS ─────────────────────────────────────────────────────── */
@keyframes crm-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.crm-skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-muted) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: crm-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
.crm-skeleton-text   { height: 14px; border-radius: 4px; }
.crm-skeleton-title  { height: 24px; border-radius: 4px; }
.crm-skeleton-circle { border-radius: 50%; }

/* ── TOAST NOTIFICATIONS ──────────────────────────────────────────────────── */
#crm-toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 99999;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 380px; width: 100%;
  pointer-events: none;
}
.crm-toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: crm-toast-in 200ms cubic-bezier(.4,0,.2,1);
  position: relative; overflow: hidden;
}
.crm-toast.removing { animation: crm-toast-out 200ms cubic-bezier(.4,0,.2,1) forwards; }
@keyframes crm-toast-in  { from { opacity:0; transform: translateX(100%); } to { opacity:1; transform:translateX(0); } }
@keyframes crm-toast-out { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(100%); } }
.crm-toast--success { border-left: 3px solid var(--status-success); }
.crm-toast--error   { border-left: 3px solid var(--status-error); }
.crm-toast--warning { border-left: 3px solid var(--status-warning); }
.crm-toast--info    { border-left: 3px solid var(--status-info); }
.crm-toast-icon  { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.crm-toast-body  { flex: 1; min-width: 0; }
.crm-toast-title { font-size: .875rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.crm-toast-msg   { font-size: .8rem; color: var(--text-secondary); }
.crm-toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 0; flex-shrink: 0; }
.crm-toast-progress { position: absolute; bottom: 0; left: 0; height: 2px; background: var(--brand); transition: width linear; border-radius: 0 0 0 var(--radius-md); }

/* ── SLIDE-OVER PANEL ─────────────────────────────────────────────────────── */
.crm-slideover-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px); z-index: 8500;
  opacity: 0; pointer-events: none; transition: opacity 250ms ease;
}
.crm-slideover-backdrop.open { opacity: 1; pointer-events: auto; }
.crm-slideover {
  position: fixed; top: 0; right: 0; height: 100vh;
  width: min(480px, 100vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(0,0,0,.3);
  z-index: 8600;
  transform: translateX(100%);
  transition: transform 250ms cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  overflow: hidden;
  padding-bottom: 68px; /* clear TeamChat minimised bar */
}
.crm-slideover.open { transform: translateX(0); }
.crm-slideover-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.crm-slideover-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.crm-slideover-close {
  background: var(--bg-elevated); border: none; color: var(--text-secondary);
  border-radius: var(--radius-sm); width: 32px; height: 32px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: background var(--transition);
}
.crm-slideover-close:hover { background: var(--border-muted); color: var(--text-primary); }
.crm-slideover-body   { flex: 1; overflow-y: auto; padding: 24px; }
.crm-slideover-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0;
}

/* ── COMMAND PALETTE ──────────────────────────────────────────────────────── */
#crm-palette-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px); z-index: 99000;
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 15vh;
}
#crm-palette-backdrop.open { display: flex; }
#crm-palette {
  background: var(--bg-surface); border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: min(560px, 95vw); overflow: hidden;
  animation: crm-palette-in 150ms ease;
}
@keyframes crm-palette-in { from { opacity:0; transform:translateY(-8px) scale(.97); } to { opacity:1; transform:translateY(0) scale(1); } }
#crm-palette-input {
  width: 100%; background: transparent; border: none; padding: 18px 20px;
  font-size: 1rem; color: var(--text-primary); outline: none; font-family: inherit;
  border-bottom: 1px solid var(--border);
}
#crm-palette-results  { max-height: 360px; overflow-y: auto; padding: 8px 0; }
.crm-palette-section  { padding: 4px 12px 2px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.crm-palette-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer; font-size: .875rem;
  color: var(--text-secondary); transition: background 80ms ease;
}
.crm-palette-item:hover,
.crm-palette-item.selected { background: var(--bg-elevated); color: var(--text-primary); }
.crm-palette-item-icon  { width: 20px; flex-shrink: 0; text-align: center; opacity: .7; }
.crm-palette-item-label { flex: 1; }
.crm-palette-item-kbd   {
  font-size: 10px; color: var(--text-muted); background: var(--bg-elevated);
  border: 1px solid var(--border-muted); border-radius: 4px;
  padding: 2px 6px; font-family: monospace; flex-shrink: 0;
}
#crm-palette-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: .875rem; }

/* ── BREADCRUMB ───────────────────────────────────────────────────────────── */
.crm-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--font-size-sm); color: var(--text-muted);
  padding: 8px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.crm-breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color var(--transition); }
.crm-breadcrumb a:hover { color: var(--text-primary); text-decoration: underline; }
.crm-breadcrumb-sep     { color: var(--border-muted); }
.crm-breadcrumb-current { color: var(--text-secondary); font-weight: 500; }

/* ── FLOATING BULK ACTION BAR ─────────────────────────────────────────────── */
.crm-bulk-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg); padding: 10px 16px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px;
  z-index: 5000; animation: crm-bulk-in 200ms ease;
  white-space: nowrap;
}
@keyframes crm-bulk-in {
  from { opacity:0; transform: translateX(-50%) translateY(12px); }
  to   { opacity:1; transform: translateX(-50%) translateY(0); }
}
.crm-bulk-count   { font-size: .875rem; font-weight: 600; color: var(--text-primary); }
.crm-bulk-divider { width: 1px; height: 20px; background: var(--border-muted); }

/* ── PAGE ENTRY ANIMATION ─────────────────────────────────────────────────── */
@keyframes crm-page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#crm-content, main {
  animation: crm-page-enter 150ms ease-out;
}

/* ── INLINE CELL EDIT ─────────────────────────────────────────────────────── */
.crm-cell-edit { cursor: text; border-radius: 4px; padding: 2px 4px; margin: -2px -4px; transition: background 80ms ease; }
.crm-cell-edit:hover   { background: var(--bg-elevated); }
.crm-cell-edit.editing { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 4px; background: var(--bg-elevated); }

/* ── AUTO-SAVE INDICATOR ──────────────────────────────────────────────────── */
.crm-autosave        { font-size: var(--font-size-xs); color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.crm-autosave.saving { color: var(--status-warning); }
.crm-autosave.saved  { color: var(--status-success); }
.crm-autosave.error  { color: var(--status-error); }

/* ── KEYBOARD SHORTCUT BADGE ──────────────────────────────────────────────── */
.crm-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border-muted);
  border-radius: 4px; padding: 2px 6px; font-size: 10px;
  font-family: monospace; color: var(--text-muted); white-space: nowrap;
}

/* ── REDUCED MOTION ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

