/*
 * PureSurf Design System
 * Extracted from: apex-proto/index.html (Phase 3 restyle target)
 *                 apex-standalone/index.html (wired production app)
 *
 * The PROTO file defines the authoritative visual language (glassmorphism, tokens,
 * animations, brand blobs). The STANDALONE file defines the component vocabulary
 * (nav tabs, kanban, deal detail cards, tables, modals, badges).
 *
 * This file merges both into a single production-ready CSS foundation.
 * Include it ONCE at the top of your app, before any component-specific CSS.
 *
 * Theme: dark-first. Light mode via html[data-theme="light"].
 * CSS framework approach: custom properties + utility classes (no Tailwind, no BEM).
 */


/* ============================================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */

:root {
  /* --- Brand colors (invariant across themes) --- */
  --pure-blue:   #2a93c1;
  --pure-orange: #f1420b;
  --pure-dark:   #080a12;

  /* Pier Foundations authoritative brand accents */
  --pf-blue:    #2a93c1;
  --pf-orange:  #f1420b;
  --pf-green:   #10b981;
  --pf-gold:    #D4A574;
  --pf-red:     #ef4444;

  /* Accent aliases (used throughout components) */
  --accent:   #2a93c1;  /* primary brand blue  */
  --accent-2: #f1420b;  /* secondary brand orange */

  /* --- DARK MODE (default) --- */
  --bg:           #080a12;
  --bg-elevated:  #10131f;
  --bg-card:      #151827;
  --bg-secondary: #0D1320;
  --bg-input:     #1C2437;
  --bg-hover:     rgba(255,255,255,0.04);

  --border:       #232838;
  --border-light: #2D3748;

  --text:         #e2e8f0;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:   #5E6E82;

  --focus-ring:   #4db6e0;

  /* Semantic colors */
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --red:     #FB7185;
  --amber:   #FBBF24;
  --green:   #34D399;
  --blue:    #0479C2;
  --blue-light: #60A5FA;
  --cyan:    #22D3EE;
  --purple:  #C084FC;
  --gray-badge: #6B7280;

  /* --- Glassmorphism tokens (dark) --- */
  --glass-bg:     rgba(16,19,31,0.60);
  --glass-border: rgba(255,255,255,0.09);
  --glass-blur:   blur(18px) saturate(150%);
  --glass-shadow: 0 4px 32px rgba(0,0,0,0.50), inset 0 1px 0 rgba(255,255,255,0.07);
  --glass-radius: 14px;
  --glass-input-bg: rgba(8,10,18,0.70);

  /* --- Shadows / elevation --- */
  --shadow:       0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.40);
  --shadow-lg:    0 8px 24px rgba(0,0,0,0.40);

  /* --- Layout --- */
  --sidebar-width:  230px;
  --sidebar-collapsed: 64px;
  --topbar-height:  56px;

  /* --- Spacing scale --- */
  --sp1:  4px;
  --sp2:  8px;
  --sp3:  12px;
  --sp4:  16px;
  --sp5:  20px;
  --sp6:  24px;
  --sp8:  32px;

  /* --- Border radius scale --- */
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-2xl: 16px;
  --radius-full: 999px;

  /* --- Orange accent variants (from standalone) --- */
  --orange:       #EE6624;
  --orange-hover: #D95A1E;
  --orange-wash:  rgba(238,102,36,0.08);
}

/* Light mode override — flip surfaces, keep brand accents */
html[data-theme="light"],
body.light-mode {
  --bg:           #ffffff;
  --bg-elevated:  #f7f9fb;
  --bg-card:      #f7f9fb;
  --bg-secondary: #ffffff;
  --bg-input:     #ffffff;
  --bg-hover:     rgba(0,0,0,0.03);

  --border:       #e3e8ee;
  --border-light: #e3e8ee;

  --text:         #0b0f14;
  --text-primary: #0b0f14;
  --text-secondary: #5a6b7e;
  --text-muted:   #8895A7;

  --focus-ring:   #1d7ba8;
  --warning:      #c26a00;

  /* Glassmorphism tokens (light) */
  --glass-bg:     rgba(255,255,255,0.72);
  --glass-border: #e3e8ee;
  --glass-blur:   blur(16px) saturate(120%);
  --glass-shadow: 0 4px 20px rgba(11,15,20,0.08), inset 0 1px 0 rgba(255,255,255,0.90);
  --glass-input-bg: #ffffff;

  --shadow:     0 1px 3px rgba(11,15,20,0.08);
  --shadow-md:  0 4px 20px rgba(11,15,20,0.08);
  --shadow-lg:  0 8px 24px rgba(11,15,20,0.12);
}

/* Light mode surface-specific overrides */
html[data-theme="light"] {
  --pf-bg-light:     #ffffff;
  --pf-card-light:   #f7f9fb;
  --pf-border-light: #e3e8ee;
  --pf-text-light:   #0b0f14;
  --pf-muted-light:  #5a6b7e;
}


/* ============================================================
   2. BRAND BACKDROP (atmospheric blob gradient)
   Applied to <html>, behind all glass surfaces.
   ============================================================ */

html {
  min-height: 100%;
  background:
    radial-gradient(ellipse 900px 650px at 8%  12%, rgba(42,147,193,0.20) 0%, transparent 65%),
    radial-gradient(ellipse 650px 750px at 90% 82%, rgba(241,66,11, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse 500px 400px at 60%  5%, rgba(42,147,193,0.08) 0%, transparent 55%),
    #080a12;
}

html[data-theme="light"] {
  background:
    radial-gradient(ellipse 900px 650px at 8%  12%, rgba(42,147,193,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 650px 750px at 90% 82%, rgba(241,66,11, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 500px 400px at 60%  5%, rgba(42,147,193,0.05) 0%, transparent 55%),
    #ffffff;
}


/* ============================================================
   3. RESET & BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: transparent;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1 { font-size: 28px; font-weight: 700; margin: 0 0 var(--sp4); }
h2 { font-size: 22px; font-weight: 700; margin: 0 0 var(--sp3); }
h3 { font-size: 18px; font-weight: 600; margin: 0 0 var(--sp2); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

code, .mono {
  font-family: "SF Mono", Consolas, Monaco, monospace;
}

/* Accessibility */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff;
  padding: var(--sp2) var(--sp4); z-index: 9999;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}


/* ============================================================
   4. LAYOUT SHELL
   Two-column (sidebar + main), sticky topbar.
   ============================================================ */

.app-shell,
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  grid-template-areas: "topbar topbar" "sidebar main";
  min-height: 100vh;
}

/* Collapsed desktop sidebar */
.shell.nav-collapsed,
.app-shell.nav-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}
.shell.nav-collapsed .sidebar,
.app-shell.nav-collapsed .sidebar { display: none; }

/* Collapsed icon-only sidebar */
@media (max-width: 900px) {
  .app-shell, .shell {
    grid-template-columns: var(--sidebar-collapsed) 1fr;
  }
  .nav-item span, .nav-sub, .wordmark { display: none; }
  .nav-item { justify-content: center; }
}

/* Mobile: sidebar goes off-canvas */
@media (max-width: 600px) {
  .app-shell, .shell {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0; bottom: 0;
    width: var(--sidebar-width);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.25s;
  }
  .sidebar.open { transform: none; }
  .sidebar .nav-item span,
  .sidebar .nav-sub,
  .sidebar .wordmark { display: inline; }
  .sidebar .nav-item { justify-content: flex-start; }
}

/* Content container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--sp6);
}

.main-content,
.main {
  grid-area: main;
  padding: var(--sp6);
  overflow-x: hidden;
}

@media (max-width: 600px) {
  .main-content, .main { padding: var(--sp4); }
}


/* ============================================================
   5. TOPBAR
   ============================================================ */

.topbar,
.header {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: var(--sp4);
  padding: 0 var(--sp6);
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  /* Glass surface */
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 0;
}

.topbar-brand,
.header-left {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  background: none;
  border: none;
  color: var(--text);
}

.topbar-actions,
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp2);
  position: relative;
}

.search-box {
  flex: 1;
  max-width: 420px;
}

/* Branding / wordmark */
.wordmark { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; }
.wordmark .a { color: var(--accent); }
.wordmark .b { color: var(--accent-2); }

/* Icon button in topbar */
.icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 6px;
  color: var(--text);
  font-size: 16px;
  position: relative;
  display: inline-flex;
}
.icon-btn:hover { border-color: var(--border); }

/* Notification dot on icon-btn */
.badge-dot {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--accent-2);
  color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* User avatar circle */
.avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  border: none;
}


/* ============================================================
   6. SIDEBAR (LEFT NAVIGATION)
   ============================================================ */

.sidebar {
  grid-area: sidebar;
  padding: var(--sp3);
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  /* Glass surface */
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  border-radius: 0;
}

/* Navigation items */
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  padding: var(--sp2) var(--sp3);
  border-radius: var(--radius);
  color: var(--text-muted);
  border: none;
  border-left: 3px solid transparent;
  background: none;
  width: 100%;
  margin-bottom: 2px;
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text);
}

html[data-theme="dark"] .nav-item:hover,
:not([data-theme]) .nav-item:hover {
  background: rgba(255,255,255,0.06);
}

.nav-item[aria-current="page"],
.nav-item.active {
  background: rgba(42,147,193,0.10);
  color: var(--text);
  border-left-color: var(--accent);
}

html[data-theme="dark"] .nav-item[aria-current="page"],
:not([data-theme]) .nav-item.active {
  background: rgba(42,147,193,0.12);
}

.nav-item svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
}

/* Sub-navigation (nested items) */
.nav-sub {
  margin: 2px 0 var(--sp2) 30px;
  padding-left: var(--sp2);
  border-left: 1px solid var(--border);
}

.nav-sub a {
  display: block;
  padding: 5px var(--sp2);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.nav-sub a:hover { color: var(--text); text-decoration: none; }
.nav-sub a[aria-current="page"] { color: var(--accent); font-weight: 700; }


/* ============================================================
   7. TOPBAR NAVIGATION TABS (alternative to sidebar)
   Used in the standalone app: horizontal tab bar below topbar.
   ============================================================ */

.nav-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp6);
  position: sticky;
  top: var(--topbar-height);
  z-index: 49;
  overflow-x: auto;
}

.nav-tab {
  padding: 14px 24px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  user-select: none;
}

.nav-tab:hover {
  color: var(--text-secondary);
  background: var(--orange-wash);
  border-bottom-color: rgba(238,102,36,0.3);
}

.nav-tab.active {
  color: #fff;
  background: var(--orange-wash);
  border-bottom-color: var(--orange);
}


/* ============================================================
   8. CARDS & PANELS
   ============================================================ */

/* Standard card — glass surface */
.card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  padding: var(--sp6);
}

/* Glass card variant (dashboard widgets) */
.gcard {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--glass-radius);
  padding: var(--sp5);
}

.gcard h3 { margin: 0 0 14px; font-size: 15px; }
.gcard h3 .sub { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-left: 8px; }

/* Deal / MEDDPICC section card */
.deal-card,
.sc {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: var(--sp4);
  overflow: hidden;
}

/* Section card header with accent left border */
.sc-head,
.deal-card h3 {
  padding: var(--sp3) var(--sp4);
  border-bottom: 1px solid var(--glass-border);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

.sc-head.oa { border-left-color: var(--accent-2); }
.sc-head.ba { border-left-color: var(--accent); }
.sc-head.pa { border-left-color: #8b5cf6; }

.sc-body { padding: var(--sp4); }

/* Panel with section title (standalone pattern) */
.panel,
.dash-panel {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  padding: 20px;
}

.panel h3,
.dash-panel h3 {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 16px;
  font-weight: 600;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

/* Summary/KPI card with colored left accent (standalone pattern) */
.summary-card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  padding: 20px;
  border-left: 4px solid var(--border);
}

.summary-card:nth-child(1) { border-left-color: var(--accent-2); }
.summary-card:nth-child(2) { border-left-color: var(--blue-light); }
.summary-card:nth-child(3) { border-left-color: var(--success); }
.summary-card:nth-child(4) { border-left-color: var(--cyan); }
.summary-card:nth-child(5) { border-left-color: var(--purple); }

.summary-card:hover {
  background: var(--bg-elevated);
  transition: background 0.2s;
}

.summary-card .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.summary-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.summary-card .value.orange { color: var(--accent-2); }
.summary-card .value.green  { color: var(--success); }
.summary-card .value.blue   { color: var(--blue-light); }

.summary-card .sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}


/* ============================================================
   9. KPI WIDGETS
   ============================================================ */

/* Large KPI display */
.kpi { display: flex; flex-direction: column; gap: var(--sp1); }
.kpi-label {
  color: var(--text-muted); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.kpi-value { font-size: 28px; font-weight: 800; }
.kpi-delta { font-size: 12px; font-weight: 700; }
.up   { color: var(--success); }
.down { color: var(--danger); }

/* Hero KPI (dashboard widget) */
.hkpi { position: relative; overflow: hidden; }
.hkpi .hk-label {
  font-size: 12px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.hkpi .hk-value { font-size: 26px; font-weight: 800; line-height: 1.1; margin: 6px 0 2px; }
.hkpi .hk-goalbar {
  height: 6px; border-radius: 4px;
  background: rgba(148,163,184,0.2); overflow: hidden; margin: 8px 0 6px;
}
.hkpi .hk-goalfill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #5bc0e8);
  border-radius: 4px;
}
.hkpi .hk-goaltxt { font-size: 11px; color: var(--text-muted); }

.hk-delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--radius-full);
  margin-top: 8px;
}
.hk-delta.up   { color: var(--success); background: rgba(34,197,94,0.14); }
.hk-delta.down { color: var(--danger);  background: rgba(239,68,68,0.14); }
.hk-delta.flat { color: var(--text-muted); background: rgba(148,163,184,0.14); }

/* CRO/Forecast card */
.cro-card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  padding: 20px 18px 16px;
  position: relative;
  overflow: hidden;
}

.cro-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--accent-2));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.cro-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px;
}
.cro-value {
  font-size: 36px; font-weight: 800; line-height: 1;
  margin-bottom: 6px; letter-spacing: -0.02em;
}
.cro-sub { font-size: 12px; color: var(--text-secondary); }


/* ============================================================
   10. BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp2);
  padding: var(--sp2) var(--sp4);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  font-size: 14px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, filter 0.15s, opacity 0.15s;
  /* Light glass base */
  background: #ffffff;
  color: var(--text);
}

.btn:hover {
  background: #eef2f6;
  border-color: var(--accent);
}

html[data-theme="dark"] .btn,
:not([data-theme]) .btn {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border);
}

html[data-theme="dark"] .btn:hover,
:not([data-theme]) .btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: var(--accent);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

/* Primary CTA — blue */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.10); background: var(--accent); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

/* Orange primary (standalone app style) */
.btn-primary-orange {
  background: var(--accent-2);
  color: #fff;
  border-color: var(--accent-2);
}
.btn-primary-orange:hover:not(:disabled) { background: var(--orange-hover); }

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Ghost / secondary */
.btn-ghost,
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover,
.btn-secondary:hover {
  border-color: var(--accent-2);
  color: var(--text);
}

/* Size variants */
.btn-sm { padding: var(--sp1) var(--sp3); font-size: 12px; }
.btn-lg { padding: 12px var(--sp6); font-size: 15px; }
.btn-full { width: 100%; }

/* Icon-only button */
.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  font-size: 16px;
  cursor: pointer;
}
.btn-icon:hover { color: var(--text); }


/* ============================================================
   11. FORM ELEMENTS
   ============================================================ */

label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--sp1);
}

input, select, textarea {
  width: 100%;
  background: var(--glass-input-bg);
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: var(--sp2) var(--sp3);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  /* No backdrop-filter on inputs — WCAG legibility */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }
select option { background: var(--bg-card); }

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--bg);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
input.error { border-color: var(--danger); }

/* Form group + field */
.form-group,
.field { margin-bottom: var(--sp4); }

.form-group label,
.filter-group label {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.field-error { color: var(--danger); font-size: 12px; margin-top: var(--sp1); }
.help        { color: var(--text-muted); font-size: 12px; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp3);
  align-items: flex-end;
  margin-bottom: 20px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group select,
.filter-group input {
  padding: 7px 12px;
  min-width: 140px;
}

.filter-actions {
  display: flex;
  gap: var(--sp2);
  align-items: flex-end;
  margin-left: auto;
}

/* Password strength */
.pw-strength { margin-top: 6px; font-size: 12px; }
.pw-strength-bar {
  height: 3px; border-radius: 2px;
  background: var(--border); margin-bottom: 4px; overflow: hidden;
}
.pw-strength-fill { height: 100%; border-radius: 2px; transition: width 0.2s, background 0.2s; width: 0; }
.pw-strength-fill.weak   { background: var(--red);    width: 33%; }
.pw-strength-fill.fair   { background: var(--amber);  width: 66%; }
.pw-strength-fill.strong { background: var(--green);  width: 100%; }
.pw-strength-label.weak   { color: var(--red); }
.pw-strength-label.fair   { color: var(--amber); }
.pw-strength-label.strong { color: var(--green); }


/* ============================================================
   12. TABLES
   ============================================================ */

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: var(--sp3) var(--sp4);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover { color: var(--text-secondary); }
th.nosort { cursor: default; }
th.sorted .sort-arrow { opacity: 1; color: var(--accent-2); }
.sort-arrow { margin-left: 4px; opacity: 0.5; }

tbody tr:hover {
  background: rgba(238,102,36,0.06);
  cursor: pointer;
}

tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

.table-wrapper {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.table-header h2 {
  font-size: 19px; font-weight: 700;
  padding-left: 10px;
  border-left: 3px solid var(--accent-2);
}


/* ============================================================
   13. MODALS / DIALOGS
   ============================================================ */

.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp4);
}

.modal-overlay { display: none; }
.modal-overlay.active { display: flex; }

.modal {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-head,
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp4) var(--sp6);
  border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 { font-size: 18px; font-weight: 600; }

.modal-body { padding: var(--sp6); }

.modal-foot,
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp2);
  padding: var(--sp4) var(--sp6);
  border-top: 1px solid var(--glass-border);
}

.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 24px; cursor: pointer;
  padding: 4px; line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* Modal form layout */
.modal-body .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.modal-body .form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.modal-body .form-row.full  { grid-template-columns: 1fr; }


/* ============================================================
   14. DROPDOWNS / POPOVERS
   ============================================================ */

.dropdown,
.settings-dropdown,
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  min-width: 240px;
  padding: var(--sp2);
  z-index: 100;
}

.settings-dropdown { display: none; padding: 4px 0; min-width: 180px; }
.settings-dropdown.open { display: block; }

.dropdown-item,
.settings-dropdown a {
  display: block;
  width: 100%; text-align: left;
  background: none; border: none;
  color: var(--text);
  padding: var(--sp2) var(--sp3);
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.dropdown-item:hover,
.settings-dropdown a:hover {
  background: rgba(0,0,0,0.04);
}

html[data-theme="dark"] .dropdown-item:hover,
:not([data-theme]) .dropdown-item:hover,
:not([data-theme]) .settings-dropdown a:hover {
  background: rgba(255,255,255,0.07);
}


/* ============================================================
   15. TOAST / NOTIFICATIONS
   ============================================================ */

.toast-wrap {
  position: fixed;
  bottom: var(--sp6); right: var(--sp6);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
}

.toast {
  background: rgba(255,255,255,0.95);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: var(--sp3) var(--sp4);
  box-shadow: var(--glass-shadow);
  max-width: 340px;
  animation: toast-in 0.2s ease;
}

html[data-theme="dark"] .toast,
:not([data-theme]) .toast {
  background: rgba(16,19,31,0.88);
  border-color: var(--glass-border);
  border-left-color: var(--accent);
}

.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}


/* ============================================================
   16. BADGES / PILLS / STATUS
   ============================================================ */

/* Generic pill */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
  border: 1px solid transparent;
}
.pill-blue  { background: rgba(42,147,193,0.15);  color: var(--accent); }
.pill-green { background: rgba(34,197,94,0.15);   color: var(--success); }
.pill-amber { background: rgba(245,158,11,0.15);  color: var(--warning); }
.pill-red   { background: rgba(239,68,68,0.15);   color: var(--danger); }
.pill-muted { background: var(--bg-elevated);     color: var(--text-muted); }

/* Stage badge (pipeline stages) */
.stage-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}

/* Stage-specific colors */
.stage-Suspect            { background: rgba(148,163,184,0.15); color: #94A3B8; }
.stage-Pipeline           { background: rgba(96,165,250,0.15);  color: #60A5FA; }
.stage-Qualified          { background: rgba(45,212,191,0.15);  color: #2DD4BF; }
.stage-Proposal-Submitted { background: rgba(245,158,11,0.15);  color: #F59E0B; }
.stage-Proposal-Finalised { background: rgba(251,146,60,0.15);  color: #FB923C; }
.stage-Sponsor-Commitment { background: rgba(244,114,182,0.15); color: #F472B6; }
.stage-Proposal-Accepted  { background: rgba(163,230,53,0.15);  color: #A3E635; }
.stage-Closed-Won         { background: rgba(52,211,153,0.15);  color: #34D399; }
.stage-Closed-Lost        { background: rgba(251,113,133,0.15); color: #FB7185; }

/* Inline chip (AI query suggestions, etc.) */
.chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 12px; color: var(--text);
  margin: 0 var(--sp2) var(--sp2) 0;
  display: inline-block;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }

/* Type badge */
.type-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: rgba(4,121,194,0.15);
  color: var(--blue-light);
}

/* Priority badges */
.pri { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 5px; flex-shrink: 0; }
.pri.P1 { background: rgba(239,68,68,0.18);   color: var(--danger); }
.pri.P2 { background: rgba(245,158,11,0.18);  color: var(--warning); }
.pri.P3 { background: rgba(148,163,184,0.20); color: var(--text-muted); }

/* Health badge */
.health-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
}
.health-green { background: rgba(52,211,153,0.15); color: #34D399; }
.health-amber { background: rgba(251,191,36,0.15); color: #FBBF24; }
.health-red   { background: rgba(251,113,133,0.15); color: #FB7185; }

/* Health circle (ring) */
.health-circle,
.health-ring {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border: 3px solid; flex-shrink: 0;
  font-weight: 800;
}
.health-circle.green,
.health-ring          { border-color: var(--success); color: var(--success); }
.health-circle.amber,
.health-ring.hr-amber { border-color: var(--warning); color: var(--warning); }
.health-circle.red,
.health-ring.hr-red   { border-color: var(--danger); color: var(--danger); }
.health-circle .hc-score { font-size: 22px; font-weight: 800; line-height: 1; }
.health-circle .hc-label,
.health-ring .hl {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8;
}

/* Note/timeline type badges */
.tl-badge, .tl-type-badge {
  display: inline-block;
  padding: 1px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
}
.tl-NOTE,  .tl-type-note    { background: rgba(42,147,193,0.18);  color: var(--accent); }
.tl-CALL,  .tl-type-call    { background: rgba(74,222,128,0.15);  color: #4ADE80; }
.tl-EMAIL, .tl-type-email   { background: rgba(52,211,153,0.15);  color: #34D399; }
.tl-STAGE, .tl-type-stage   { background: rgba(251,146,60,0.15);  color: #FB923C; }
.tl-MEETING,.tl-type-meeting { background: rgba(192,132,252,0.15); color: #C084FC; }
.tl-type-general             { background: rgba(107,114,128,0.15); color: #9CA3AF; }

/* Note type badges */
.note-type-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.note-type-meeting { background: rgba(168,85,247,0.15); color: #C084FC; }
.note-type-call    { background: rgba(34,197,94,0.15);  color: #4ADE80; }
.note-type-email   { background: rgba(59,130,246,0.15); color: #60A5FA; }
.note-type-general { background: rgba(107,114,128,0.15); color: #9CA3AF; }

/* Proposal status badges */
.proposal-status-badge { padding: 2px 9px; border-radius: var(--radius-full); font-size: 11px; font-weight: 700; }
.ps-Draft    { background: rgba(107,114,128,0.15); color: #9CA3AF; }
.ps-Sent     { background: rgba(96,165,250,0.15);  color: #60A5FA; }
.ps-Viewed   { background: rgba(251,191,36,0.15);  color: #FBBF24; }
.ps-Accepted { background: rgba(52,211,153,0.15);  color: #34D399; }
.ps-Rejected { background: rgba(251,113,133,0.15); color: #FB7185; }

/* Connection/status dot */
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.connected    { background: var(--success); box-shadow: 0 0 6px rgba(52,211,153,0.5); }
.status-dot.disconnected { background: var(--danger); }


/* ============================================================
   17. KANBAN BOARD
   ============================================================ */

.kanban-board,
.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: var(--sp4);
  min-height: 400px;
}

.kanban-col,
.kan-col {
  flex: 0 0 220px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

.kanban-col-header,
.kan-head {
  padding: var(--sp3) var(--sp4);
  border-bottom: 1px solid var(--glass-border);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between; align-items: center;
  flex-shrink: 0;
}

.kanban-col-header .col-count,
.kan-head .cnt {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
}

.kanban-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 60px;
}

.kanban-col-body.drag-over,
.kan-col.dragover {
  background: rgba(42,147,193,0.15);
  border-color: var(--accent);
}

.kanban-card,
.kan-card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 2px 10px rgba(11,15,20,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s;
}

html[data-theme="dark"] .kanban-card,
:not([data-theme]) .kanban-card,
:not([data-theme]) .kan-card {
  box-shadow: 0 2px 12px rgba(0,0,0,0.30);
}

.kanban-card:hover,
.kan-card:hover {
  border-color: rgba(42,147,193,0.45);
  box-shadow: 0 4px 20px rgba(42,147,193,0.18);
}

.kanban-card.dragging,
.kan-card.dragging { opacity: 0.4; }

.kanban-card .kc-company,
.kan-card .name {
  font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.kanban-card .kc-value { color: var(--success); font-weight: 600; }
.kanban-card .kc-date  { color: var(--text-muted); }


/* ============================================================
   18. ACTIVITY / TIMELINE FEED
   ============================================================ */

.stream, .activity-list, .sp-list { list-style: none; margin: 0; padding: 0; }

/* Stream item */
.stream-item {
  display: flex; gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--glass-border);
}
.stream-item:last-child { border-bottom: none; }

.stream-ico {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.si-call    { background: rgba(42,147,193,0.16); }
.si-email   { background: rgba(245,158,11,0.16); }
.si-meeting { background: rgba(132,204,22,0.16); }
.si-deal    { background: rgba(34,197,94,0.16); }

.stream-txt  { font-size: 13px; flex: 1; }
.stream-when { font-size: 11px; color: var(--text-muted); }

/* Timeline item */
.timeline-item {
  display: flex; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(45,55,72,0.5);
  align-items: flex-start;
}
.timeline-item:last-child { border-bottom: none; }

.tl-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.tl-icon.note    { background: rgba(96,165,250,0.15); }
.tl-icon.stage   { background: rgba(251,146,60,0.15); }
.tl-icon.email   { background: rgba(52,211,153,0.15); }
.tl-icon.meeting { background: rgba(192,132,252,0.15); }

.tl-body     { flex: 1; min-width: 0; }
.tl-actor    { font-size: 12px; font-weight: 600; color: var(--accent-2); }
.tl-text     { font-size: 13px; color: var(--text-secondary); line-height: 1.4; margin-top: 2px; white-space: pre-wrap; }
.tl-time     { font-size: 11px; color: var(--text-muted); }
.tl-meta     { display: flex; align-items: center; gap: 8px; margin-top: 3px; }

/* Timeline filter chips */
.timeline-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tl-filter-btn {
  padding: 5px 12px; border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.tl-filter-btn:hover { border-color: var(--text-secondary); color: var(--text-secondary); }
.tl-filter-btn.active { background: var(--orange-wash); border-color: var(--accent-2); color: var(--accent-2); }


/* ============================================================
   19. EMAIL LIST
   ============================================================ */

.email-list {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.email-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(45,55,72,0.6);
  cursor: pointer;
  transition: background 0.12s;
}
.email-row:last-child { border-bottom: none; }
.email-row:hover { background: var(--bg-elevated); }
.email-row.unread { background: rgba(238,102,36,0.04); }
.email-row.unread .email-row-subject { font-weight: 700; color: var(--text); }

.email-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.email-avatar.sent     { background: rgba(238,102,36,0.15); color: var(--accent-2); }
.email-avatar.received { background: rgba(52,211,153,0.12);  color: var(--success); }

.email-row-main { flex: 1; min-width: 0; }
.email-row-from    { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.email-row-subject { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-row-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-row-time    { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

.email-item { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; }
.email-item.received { border-left: 3px solid var(--blue-light); }
.email-item.sent     { border-left: 3px solid var(--success); }


/* ============================================================
   20. DASHBOARD TAB BAR (glass pill tabs)
   ============================================================ */

.dash-tabs {
  display: flex; gap: 6px;
  margin-bottom: 22px; padding: 6px;
  overflow-x: auto;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--glass-radius);
}

.dash-tab {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: none;
  background: transparent; color: var(--text-muted);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border-radius: 10px;
  transition: all 0.15s; white-space: nowrap;
}

.dash-tab:hover { color: var(--text); background: rgba(42,147,193,0.08); }
.dash-tab.active { color: #fff; background: var(--accent); box-shadow: 0 4px 16px rgba(42,147,193,0.35); }
.dash-tab .tnum { font-size: 11px; opacity: 0.65; font-weight: 700; }

/* Segment / view toggle */
.view-toggle,
.thresh,
.lb-toggle,
.period-toggle,
.billing-toggle {
  display: inline-flex; gap: 4px;
  background: rgba(148,163,184,0.12);
  padding: 4px; border-radius: var(--radius);
  border: 1px solid var(--border);
}

.view-toggle button,
.thresh button,
.lb-toggle button,
.period-toggle button,
.billing-toggle button {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}

.view-toggle button.active,
.thresh button.active,
.lb-toggle button.active,
.period-toggle button.active,
.billing-toggle button.active {
  background: var(--accent); color: #fff;
}

/* Tab sets (underline style) */
.tabs, .det-tabs, .settings-tabs {
  display: flex; gap: var(--sp2);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp6);
}

.tab, .det-tab, .settings-tab {
  flex: 1; background: none; border: none;
  color: var(--text-muted);
  padding: var(--sp3);
  font-weight: 700; font-size: 13px;
  border-bottom: 2px solid transparent;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}

.tab.active, .det-tab.active, .settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}


/* ============================================================
   21. PROGRESS BAR
   ============================================================ */

.progress {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: var(--sp3) 0 var(--sp6);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-full);
  transition: width 0.3s;
}


/* ============================================================
   22. QUICK ACTIONS BAR
   ============================================================ */

.qa-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.qa-btn {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 16px 8px; cursor: pointer;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--glass-radius);
  color: var(--text); font-weight: 600; font-size: 13px;
  transition: all 0.15s;
}

.qa-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.qa-btn .qa-ico { font-size: 20px; }

@media (max-width: 640px) {
  .qa-bar { grid-template-columns: repeat(2,1fr); }
}


/* ============================================================
   23. GRIDS (layout helpers)
   ============================================================ */

.grid   { display: grid; gap: var(--sp4); }
.grid-4 { grid-template-columns: repeat(4,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }

.summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 16px; margin-bottom: 24px;
}

.cro-dashboard {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 16px; margin-bottom: 28px;
}

@media (max-width: 900px) {
  .grid-4   { grid-template-columns: repeat(2,1fr); }
  .cro-dashboard { grid-template-columns: repeat(2,1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .cro-dashboard { grid-template-columns: 1fr; }
}

/* Deal detail two-column */
.deal-columns {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 24px; align-items: start;
}

@media (max-width: 900px) {
  .deal-columns { grid-template-columns: 1fr; }
}

/* Accounts grid */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px,1fr));
  gap: 16px;
}


/* ============================================================
   24. AUTH / ONBOARDING SCREENS
   ============================================================ */

.center-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp6);
}

.auth-card,
.login-box,
.wizard-box {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  padding: 40px 40px;
  width: 100%;
  max-width: 420px;
}

.wizard-box { max-width: 480px; }

/* Logo row */
.logo-row {
  display: flex; align-items: center; gap: var(--sp3);
  margin-bottom: var(--sp6); justify-content: center;
}

/* Auth mode toggle (login / signup) */
.auth-mode-toggle {
  display: flex; gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius); padding: 4px;
  margin-bottom: 24px;
}

.auth-mode-btn {
  flex: 1; padding: 8px; border: none;
  border-radius: 6px;
  background: transparent; color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}

.auth-mode-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Divider with label */
.divider,
.auth-divider {
  display: flex; align-items: center; gap: var(--sp3);
  color: var(--text-muted); margin: var(--sp4) 0; font-size: 12px;
}
.divider::before, .divider::after,
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Wizard dots */
.wizard-progress {
  display: flex; justify-content: center; gap: 10px; margin-bottom: 32px;
}
.wizard-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: background 0.2s, transform 0.2s;
}
.wizard-dot.active { background: var(--accent-2); transform: scale(1.3); }
.wizard-dot.done   { background: var(--success); }


/* ============================================================
   25. EMPTY STATES
   ============================================================ */

.empty, .empty-state {
  text-align: center;
  padding: var(--sp8);
  color: var(--text-muted);
}

.empty .ico, .empty-state .icon { font-size: 40px; margin-bottom: var(--sp3); }
.empty-state p { font-size: 15px; }


/* ============================================================
   26. AI PANEL
   ============================================================ */

.ai-output {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  padding: var(--sp6);
  min-height: 120px;
}

.ai-insight {
  background: rgba(247,249,251,0.92);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  display: flex; gap: var(--sp3);
  padding: var(--sp3);
  border-radius: 10px; margin-bottom: var(--sp3);
}

html[data-theme="dark"] .ai-insight,
:not([data-theme]) .ai-insight {
  background: rgba(16,19,31,0.70);
}

.ai-head   { display: flex; align-items: center; gap: var(--sp2); }
.ai-badge  { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2); font-weight: 700; margin-top: var(--sp4); animation: fadein 0.4s; }
.spark     { color: var(--accent-2); font-size: 18px; }

/* Loading spinner */
.spinner { display: inline-block; animation: spin 1s linear infinite; font-size: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes dashfade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.dash-panel.active { animation: dashfade 0.25s ease; }


/* ============================================================
   27. BAR CHARTS / DATA VISUALIZATIONS
   ============================================================ */

/* Horizontal bar */
.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 90px;
  align-items: center; gap: var(--sp3); margin-bottom: var(--sp3);
}
.bar-track {
  background: var(--bg-elevated);
  border-radius: var(--radius-full); height: 20px; overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-full);
}
.bar-val { text-align: right; font-weight: 700; font-size: 13px; }

/* Pipeline bar (stacked horizontal) */
.pipeline-bar {
  display: flex; height: 32px;
  border-radius: 6px; overflow: hidden;
  background: var(--bg-input);
}
.pipeline-bar .segment {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; min-width: 2px;
  transition: width 0.3s;
}

/* Funnel row */
.funnel-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 12px; align-items: center; margin-bottom: 10px;
}
.funnel-row .fn-label { font-size: 13px; font-weight: 600; }
.funnel-bar {
  height: 26px; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), #5bc0e8);
  display: flex; align-items: center; padding: 0 10px;
  color: #fff; font-size: 11px; font-weight: 700; min-width: 24px;
}
.funnel-conv { font-size: 11px; color: var(--warning); font-weight: 700; }


/* ============================================================
   28. PRICING CARDS
   ============================================================ */

.pricing-card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-2xl);
  padding: var(--sp6);
  display: flex; flex-direction: column; gap: var(--sp4);
  position: relative;
  transition: box-shadow 0.2s;
}

.pricing-card.recommended {
  border-color: rgba(42,147,193,0.55);
  box-shadow: 0 0 0 1px rgba(42,147,193,0.40), 0 8px 40px rgba(42,147,193,0.22), var(--glass-shadow);
}

.recommended-ribbon {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 16px; border-radius: var(--radius-full);
  white-space: nowrap; letter-spacing: 0.3px;
}


/* ============================================================
   29. FALLBACK (no backdrop-filter support)
   ============================================================ */

@supports not (backdrop-filter: blur(1px)) {
  .card, .gcard, .pricing-card, .deal-card, .sc,
  .panel, .dash-panel, .summary-card, .cro-card,
  .ai-output, .ai-insight, .email-list, .kanban-col,
  .kan-col, .kanban-card, .kan-card, .toast,
  .filter-bar, .qa-btn, .auth-card, .login-box, .wizard-box,
  .dropdown, .modal, .sidebar, .topbar, .header {
    background: var(--bg-elevated);
    border-color: var(--border);
    box-shadow: var(--shadow);
  }

  .modal, .dropdown { background: var(--bg-card); }
  .topbar, .header, .sidebar { background: var(--bg-secondary); }
  html { background: var(--bg); }

  input, select, textarea {
    background: var(--bg-card);
    border-color: var(--border);
  }

  .btn { background: var(--bg-card); border-color: var(--border); }
}


/* ============================================================
   30. PAGE HEAD / SECTION HEADER
   ============================================================ */

.page-head {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp6);
  gap: var(--sp4); flex-wrap: wrap;
}
.page-head .sub { color: var(--text-muted); font-size: 14px; margin-top: -8px; }


/* ============================================================
   31. MISCELLANEOUS UTILITIES
   ============================================================ */

/* Unread dot */
.unread-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--accent);
  display: inline-block;
}

/* Monospace text block */
.bcc-addr {
  flex: 1;
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 11px;
  word-break: break-all;
}

/* Collapsible section */
.collapsible-section { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.collapsible-toggle {
  display: flex; align-items: center;
  justify-content: space-between;
  cursor: pointer; user-select: none; padding: 4px 0;
}
.collapsible-body { display: none; margin-top: 12px; }
.collapsible-body.open { display: block; }

/* Views (tab content panels) */
.view { display: none; }
.view.active { display: block; }

/* Text helpers */
.text-muted    { color: var(--text-muted); }
.text-accent   { color: var(--accent); }
.text-accent-2 { color: var(--accent-2); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }

/* Tabular numbers */
.tabular { font-variant-numeric: tabular-nums; }
