/* =============================================================================
   ARES OS — command.css
   Multi-page app shell · Token-based theming · Larger typography
   ============================================================================= */

/* ── DESIGN TOKENS ──────────────────────────────────────────────────────────── */
:root {
  /* Layout */
  --strip-h:    32px;
  --nav-h:      56px;
  --sidebar-w:  240px;
  --composer-h: 86px;

  /* Type scale — readable at normal viewing distance */
  --text-2xs:  0.7rem;    /* 11.2px — only for badges/chips */
  --text-xs:   0.75rem;   /* 12px   — timestamps, meta */
  --text-sm:   0.85rem;   /* 13.6px — secondary body */
  --text-base: 0.9rem;    /* 14.4px — primary body */
  --text-md:   1rem;      /* 16px   — card titles */
  --text-lg:   1.125rem;  /* 18px   — section titles */
  --text-xl:   1.375rem;  /* 22px   — page titles */
  --kpi-md:    1.75rem;   /* 28px   — medium KPIs */
  --kpi-lg:    2.25rem;   /* 36px   — large KPIs */

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;

  /* Brand */
  --magenta:   #e040fb;
  --purple:    #7c4dff;
  --cyan:      #00d4ff;
  --positive:  #4ade80;
  --warn:      #fbbf24;
  --negative:  #f87171;
  --info:      #38bdf8;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 100px;

  /* Transitions */
  --ease: 0.18s ease;
  --ease-slow: 0.3s ease;

  /* Mode color (overridden by JS) */
  --mode-color: #e040fb;

  /* ── DARK THEME (default) ────────────────────────────────────────────────── */
  --bg:          #03030d;
  --bg-1:        #06061a;
  --bg-2:        #0a0a22;
  --surface:     #10102c;
  --surface-2:   #181840;
  --glass:       rgba(10, 10, 34, 0.7);
  --glass-b:     rgba(255, 255, 255, 0.055);

  --text-primary:   #f0f0fa;
  --text-secondary: #b8b8d8;
  --text-muted:     #7070a0;
  --text-dim:       #404066;

  --border:     rgba(255, 255, 255, 0.07);
  --border-accent: rgba(224, 64, 251, 0.2);

  --input-bg:   rgba(6, 6, 24, 0.9);
  --blur:       blur(20px);

  /* Semantic accent assignments */
  --accent-command:     var(--magenta);     /* command, intelligence */
  --accent-execution:   var(--cyan);        /* agents, campaigns, workflows */
  --accent-data:        var(--text-muted);  /* CRM, analytics, contacts */

  --gradient:       linear-gradient(135deg, var(--magenta), var(--purple));
  --gradient-exec:  linear-gradient(135deg, var(--cyan), var(--purple));
  --surface-hover:  rgba(255, 255, 255, 0.04);
  --bg-panel:       #0d0d2a;
}

/* ── LIGHT THEME ─────────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f4f4f8;
  --bg-1:        #ffffff;
  --bg-2:        #eeeeF4;
  --surface:     #ffffff;
  --surface-2:   #f0f0f8;
  --glass:       rgba(255, 255, 255, 0.85);
  --glass-b:     rgba(0, 0, 0, 0.06);

  --text-primary:   #0a0a20;
  --text-secondary: #30304c;
  --text-muted:     #5c5c80;
  --text-dim:       #a0a0c0;

  --border:     rgba(0, 0, 0, 0.08);
  --border-accent: rgba(224, 64, 251, 0.25);

  --input-bg:      #ffffff;
  --blur:          blur(20px);
  --surface-hover: rgba(0, 0, 0, 0.04);
  --bg-panel:      #ffffff;
}

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

html {
  height: 100%;
  overflow: hidden;
}
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Ambient background depth (dark mode only) */
[data-theme="dark"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 5%,  rgba(124,77,255,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 95%, rgba(224,64,251,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { text-decoration: none; }


/* ── STATUS STRIP ────────────────────────────────────────────────────────────── */
.v4-status-strip {
  position: relative;
  z-index: 200;
  height: var(--strip-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
  overflow: hidden;
}

.ss-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}
.ss-logo-mark {
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(224,64,251,0.75));
}
.ss-brand {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.ss-sep { color: var(--text-dim); font-size: var(--text-2xs); }
.ss-online {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--positive);
}
.ss-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 7px var(--positive);
  animation: pulse 2s ease-in-out infinite;
}

.ss-metrics {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  overflow: hidden;
}
.ss-metric-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 var(--space-md);
  border-left: 1px solid var(--border);
  white-space: nowrap;
}
.ss-metric-item:first-child { border-left: none; }
.ss-metric-val { font-weight: 600; color: var(--text-secondary); }
.ss-metric-val.up   { color: var(--positive); }
.ss-metric-val.warn { color: var(--warn); }
.ss-metric-val.exec { color: var(--cyan); }
.ss-metric-val.intel{ color: var(--magenta); }
.ss-metric-arrow { font-size: 0.6rem; }

.ss-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.ss-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-2xs);
  color: var(--text-dim);
}


/* ── TOP NAV ─────────────────────────────────────────────────────────────────── */
.v4-nav {
  position: relative;
  z-index: 150;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
}

.v4-nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.v4-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}
.v4-sidebar-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--surface);
}

.v4-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
/* SVG wordmark replaces ◆ + text spans */
.v4-logo-svg {
  display: block;
  /* filter controlled by diamond state animation; static value is fallback only */
  filter: drop-shadow(0 0 8px rgba(224,64,251,0.3));
  transition: transform var(--ease);
}
.v4-logo:hover .v4-logo-svg {
  /* transform instead of filter — avoids conflict with state glow animation */
  transform: scale(1.015);
}
/* Legacy text-char selectors kept for reference — no longer rendered */
.v4-logo-mark  { display: none; }
.v4-logo-text  { display: none; }
.v4-logo-accent { display: none; }

.v4-page-context {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.v4-page-sep   { color: var(--text-dim); font-size: var(--text-sm); }
.v4-page-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-secondary);
}

.v4-nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

.v4-nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}
.v4-nav-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
  background: var(--surface);
}
.v4-owner-link {
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  width: auto;
  padding: 0 10px;
  color: #c060f8;
  border-color: rgba(192,96,248,0.3);
}
.v4-owner-link:hover {
  color: #e040fb;
  border-color: rgba(224,64,251,0.6);
  background: rgba(192,96,248,0.08);
}

/* Theme button: shows moon in dark, sun in light */
.v4-theme-btn .icon-sun  { display: none; }
.v4-theme-btn .icon-moon { display: block; }
[data-theme="light"] .v4-theme-btn .icon-sun  { display: block; }
[data-theme="light"] .v4-theme-btn .icon-moon { display: none; }

.v4-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--warn);
  color: #000;
  font-size: 0.5rem;
  font-weight: 800;
  min-width: 15px; height: 15px;
  padding: 1px 3px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.v4-nav-link {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  transition: color var(--ease);
}
.v4-nav-link:hover { color: var(--text-muted); }

.v4-user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px 10px 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}
.v4-user-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: var(--text-2xs);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.v4-user-email { font-size: var(--text-xs); color: var(--text-muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v4-signout {
  font-size: var(--text-xs);
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--ease);
}
.v4-signout:hover { color: var(--negative); }


/* ── APP SHELL ────────────────────────────────────────────────────────────────── */
.v4-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: calc(100vh - var(--strip-h) - var(--nav-h) - var(--composer-h));
  overflow: hidden;
}


/* ── LEFT SIDEBAR ─────────────────────────────────────────────────────────────── */
.v4-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--ease-slow), opacity var(--ease-slow);
  scrollbar-width: none;
}
.v4-sidebar::-webkit-scrollbar { display: none; }
.v4-sidebar.collapsed { width: 0; opacity: 0; pointer-events: none; }

.v4-nav-group {
  padding: var(--space-md) var(--space-sm) var(--space-sm);
}
.v4-nav-group + .v4-nav-group { padding-top: var(--space-sm); }

.v4-nav-group-label {
  font-family: 'Inter', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-xs);
}

.v4-nav-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--ease), background var(--ease), border-color var(--ease);
  position: relative;
}
.v4-nav-link-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity var(--ease); }
.v4-nav-link-item span:not(.v4-nav-badge) { flex: 1; }

.v4-nav-link-item:hover {
  color: var(--text-primary);
  background: var(--surface);
  border-color: var(--border);
}
.v4-nav-link-item:hover svg { opacity: 1; }

.v4-nav-link-item.active {
  color: var(--text-primary);
  background: var(--surface);
  border-color: var(--border);
  font-weight: 600;
}
.v4-nav-link-item.active svg { opacity: 1; }

/* Active left accent bar */
.v4-nav-link-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--mode-color);
}

.v4-nav-badge {
  font-family: 'Inter', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}
.v4-nav-badge.cyan    { color: var(--cyan);    background: rgba(0,212,255,0.1);   border: 1px solid rgba(0,212,255,0.2); }
.v4-nav-badge.warn    { color: var(--warn);    background: rgba(251,191,36,0.1);  border: 1px solid rgba(251,191,36,0.2); }
.v4-nav-badge.magenta { color: var(--magenta); background: rgba(224,64,251,0.1);  border: 1px solid rgba(224,64,251,0.2); }

.v4-nav-spacer { flex: 1; }

.v4-nav-group-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}

.v4-header-profile { position: relative; }
.v4-sidebar-user-inner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.v4-sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}


/* ── MAIN WORKSPACE ──────────────────────────────────────────────────────────── */
.v4-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: rgba(224,64,251,0.12) transparent;
}
.v4-main::-webkit-scrollbar       { width: 5px; }
.v4-main::-webkit-scrollbar-thumb { background: rgba(224,64,251,0.15); border-radius: 3px; }


/* ── PAGE CONTAINER ──────────────────────────────────────────────────────────── */
.v4-page {
  padding: var(--space-lg) var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
  animation: pageIn 0.2s ease both;
}
@keyframes pageIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.v4-page-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}
.v4-page-header-text {}
.v4-page-h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}
.v4-page-desc {
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.65;
}
.v4-page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Shared section label */
.v4-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--space-md);
  margin-top: var(--space-lg);
}
.v4-section-label:first-child { margin-top: 0; }


/* ── SHARED BUTTONS ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: 'Inter', sans-serif;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--r-sm);
  padding: 8px 16px;
  cursor: pointer;
  transition: var(--ease);
  border: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 2px 16px rgba(224,64,251,0.28);
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 24px rgba(224,64,251,0.42); }
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-accent); color: var(--text-primary); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); }


/* ── STATUS / PILL SYSTEM ────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  border: 1px solid;
  white-space: nowrap;
}
.pill-sending  { color: var(--cyan);     border-color: rgba(0,212,255,0.35);  background: rgba(0,212,255,0.09); }
.pill-approved { color: var(--positive); border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.09); }
.pill-draft    { color: var(--text-muted); border-color: var(--border);       background: transparent; }
.pill-queued   { color: var(--warn);     border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.09); }
.pill-complete { color: var(--purple);   border-color: rgba(124,77,255,0.35); background: rgba(124,77,255,0.09); }
.pill-running  { color: var(--cyan);     border-color: rgba(0,212,255,0.35);  background: rgba(0,212,255,0.09); }
.pill-idle     { color: var(--text-dim); border-color: var(--border);         background: transparent; }
.pill-waiting  { color: var(--warn);     border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.09); }
.pill-active   { color: var(--positive); border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.09); }
.pill-paused   { color: var(--warn);     border-color: rgba(251,191,36,0.3);  background: rgba(251,191,36,0.07); }
.pill-connected    { color: var(--positive); border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.09); }
.pill-awaiting     { color: var(--warn);     border-color: rgba(251,191,36,0.3);  background: rgba(251,191,36,0.07); }
.pill-not-connected{ color: var(--text-dim); border-color: var(--border);         background: transparent; }
/* Wave 2: 'unknown' is its own truth state, distinct from not-connected.
   ARES has not probed the integration, so the row carries no claim
   either way. Neutral muted styling — calmer than not-connected, never
   the alarming awaiting amber. */
.pill-unknown      { color: var(--text-muted); border-color: var(--border);       background: transparent; }


/* ── CARD SYSTEM ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
}
.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.card-title-accent { width: 3px; height: 16px; border-radius: 2px; flex-shrink: 0; }
.card-title-accent.magenta { background: var(--magenta); }
.card-title-accent.cyan    { background: var(--cyan); }
.card-title-accent.neutral { background: var(--text-dim); }
.card-actions { display: flex; align-items: center; gap: var(--space-sm); }
.card-body    { padding: var(--space-md) var(--space-lg); }


/* ── OVERVIEW PAGE ───────────────────────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-top: 0;
}
.overview-grid .card-full { grid-column: 1 / -1; }

/* Agent row on overview */
.agent-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
}
.agent-cell {
  background: var(--surface);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  transition: background var(--ease);
}
.agent-cell:hover { background: var(--bg-2); }

.agent-cell-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.ind-running   { background: var(--cyan);     box-shadow: 0 0 8px var(--cyan);   animation: pulse 1.6s infinite; }
.ind-idle      { background: var(--text-dim); }
.ind-waiting   { background: var(--warn);     box-shadow: 0 0 6px var(--warn); }
.ind-completed { background: var(--positive); }
.ind-blocked   { background: var(--negative); }

.agent-cell-body { flex: 1; min-width: 0; }
.agent-cell-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-cell-task {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
}
.agent-cell-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-sm);
  gap: var(--space-sm);
}
.agent-cell-runtime {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-xs);
  color: var(--text-dim);
}
.agent-progress {
  height: 2px;
  background: var(--surface-2);
  border-radius: 1px;
  overflow: hidden;
  margin-top: var(--space-sm);
}
.agent-progress-fill {
  height: 100%;
  border-radius: 1px;
  background: var(--gradient-exec);
  transition: width 1.5s ease;
}

/* Campaign list */
.campaign-list { display: flex; flex-direction: column; }
.campaign-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
  cursor: default;
}
.campaign-item:last-child { border-bottom: none; }
.campaign-item:hover { background: var(--bg-2); }
.campaign-item-stripe {
  width: 3px; height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}
.stripe-sending  { background: var(--cyan); }
.stripe-approved { background: var(--positive); }
.stripe-queued   { background: var(--warn); }
.stripe-draft    { background: var(--text-dim); }
.stripe-complete { background: var(--purple); }
.campaign-item-info { flex: 1; min-width: 0; }
.campaign-item-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.campaign-item-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.campaign-item-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.campaign-stat-val { font-family: 'JetBrains Mono', monospace; font-size: var(--text-sm); color: var(--text-secondary); font-weight: 500; }
.campaign-stat-lbl { font-size: var(--text-xs); color: var(--text-muted); }

/* Intelligence feed */
.intel-list { display: flex; flex-direction: column; }
.intel-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}
.intel-item:last-child { border-bottom: none; }
.intel-item:hover { background: var(--bg-2); }
.intel-item.unread { background: rgba(224,64,251,0.025); }

.intel-priority-tag {
  font-family: 'Inter', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: var(--r-sm);
  border: 1px solid;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
  white-space: nowrap;
}
.tag-high    { color: var(--negative); border-color: rgba(248,113,113,0.4);  background: rgba(248,113,113,0.09); }
.tag-medium  { color: var(--warn);     border-color: rgba(251,191,36,0.4);   background: rgba(251,191,36,0.09); }
.tag-low     { color: var(--text-muted); border-color: var(--border);        background: transparent; }
.tag-insight { color: var(--cyan);     border-color: rgba(0,212,255,0.35);   background: rgba(0,212,255,0.08); }

.intel-body { flex: 1; min-width: 0; }
.intel-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 4px;
}
.intel-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: var(--space-sm);
}
.intel-footer {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.intel-time { font-family: 'JetBrains Mono', monospace; font-size: var(--text-xs); color: var(--text-dim); }
.intel-action-btn {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--magenta);
  background: rgba(224,64,251,0.08);
  border: 1px solid rgba(224,64,251,0.2);
  border-radius: var(--r-sm);
  padding: 4px 12px;
  cursor: pointer;
  transition: var(--ease);
}
.intel-action-btn:hover { background: rgba(224,64,251,0.15); border-color: rgba(224,64,251,0.4); }


/* ── ANALYTICS / PERFORMANCE PAGE ───────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-lg);
}
.kpi-label  { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--space-sm); }
.kpi-value  { font-family: 'Orbitron', sans-serif; font-size: var(--kpi-lg); font-weight: 700; color: var(--text-primary); line-height: 1.1; margin-bottom: var(--space-xs); }
.kpi-delta  { font-size: var(--text-sm); font-weight: 600; }
.delta-up   { color: var(--positive); }
.delta-down { color: var(--negative); }

/* Sparkline (inline SVG, generated by JS) */
.sparkline-wrap {
  margin-top: var(--space-md);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-2);
  padding: var(--space-sm) 0 var(--space-xs);
}
.sparkline-label { font-size: var(--text-xs); color: var(--text-muted); padding: 0 var(--space-md); margin-bottom: var(--space-sm); }
.sparkline-svg { width: 100%; height: 56px; display: block; }

/* Funnel */
.funnel-wrap { display: flex; flex-direction: column; gap: var(--space-xs); }
.funnel-step {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.funnel-bar-label { font-size: var(--text-sm); color: var(--text-muted); width: 100px; flex-shrink: 0; }
.funnel-bar-track { flex: 1; height: 28px; background: var(--bg-2); border-radius: var(--r-sm); overflow: hidden; }
.funnel-bar-fill  { height: 100%; border-radius: var(--r-sm); display: flex; align-items: center; padding-left: var(--space-sm); }
.funnel-bar-val   { font-family: 'JetBrains Mono', monospace; font-size: var(--text-sm); font-weight: 600; color: #fff; }
.funnel-bar-pct   { font-size: var(--text-xs); color: var(--text-muted); width: 40px; text-align: right; flex-shrink: 0; }

/* AB test */
.ab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.ab-variant {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-md);
}
.ab-variant.winner { border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.04); }
.ab-variant-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--space-sm); }
.ab-variant-subject { font-size: var(--text-sm); color: var(--text-secondary); font-style: italic; margin-bottom: var(--space-sm); }
.ab-variant-val { font-family: 'Orbitron', sans-serif; font-size: var(--kpi-md); font-weight: 700; color: var(--text-primary); }
.ab-variant.winner .ab-variant-val { color: var(--positive); }
.ab-winner-badge { font-size: var(--text-xs); font-weight: 700; color: var(--positive); margin-top: var(--space-xs); }


/* ── INTELLIGENCE PAGE (feed + context merged) ───────────────────────────────── */
.intelligence-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-md);
  align-items: start;
}

/* Context card */
.context-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: sticky;
  top: 0;
}
.context-field {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.context-field:last-child { border-bottom: none; }
.context-field-key {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--space-xs);
}
.context-field-val {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.55;
}
.context-field-val.quote {
  font-style: italic;
  color: var(--text-muted);
  border-left: 2px solid var(--magenta);
  padding-left: var(--space-sm);
}
/* ICP tags */
.icp-tags { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: 2px; }
.icp-tag {
  font-size: var(--text-xs);
  color: var(--magenta);
  background: rgba(224,64,251,0.08);
  border: 1px solid rgba(224,64,251,0.2);
  border-radius: var(--r-pill);
  padding: 2px 9px;
}
/* Memory timeline */
.memory-timeline { display: flex; flex-direction: column; gap: var(--space-sm); }
.memory-event {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}
.memory-event-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); flex-shrink: 0; margin-top: 5px; }
.memory-event-text { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; }
.memory-event-time { font-family: 'JetBrains Mono', monospace; font-size: var(--text-xs); color: var(--text-dim); flex-shrink: 0; }


/* ── INTEGRATIONS PAGE ───────────────────────────────────────────────────────── */
.int-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-md);
}
.int-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  transition: border-color var(--ease);
}
.int-card:hover { border-color: var(--border-accent); }
.int-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--text-muted);
}
.int-card-body { flex: 1; min-width: 0; }
.int-card-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.int-card-detail { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-sm); }


/* ── COMMAND PAGE ────────────────────────────────────────────────────────────── */
.command-page-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-md);
  height: calc(100vh - var(--strip-h) - var(--nav-h) - var(--composer-h) - var(--space-xl) * 2);
  min-height: 400px;
}
.command-output-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.command-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.command-mode-tag {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--mode-color);
  border: 1px solid;
  border-color: var(--border-accent);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  transition: color 0.3s, border-color 0.3s;
}
.command-output-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-sm);
  line-height: 1.85;
  scrollbar-width: thin;
  scrollbar-color: rgba(224,64,251,0.1) transparent;
  display: flex;
  flex-direction: column;
}
.command-output-scroll::-webkit-scrollbar       { width: 3px; }
.command-output-scroll::-webkit-scrollbar-thumb { background: rgba(224,64,251,0.15); border-radius: 2px; }
.command-sidebar-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* ── TERMINAL LINE TYPES ─────────────────────────────────────────────────────── */
.t-line       { display: block; white-space: pre-wrap; word-break: break-word; animation: lineIn 0.14s ease both; }
.t-blank      { height: 0.9em; }
.t-system     { color: var(--text-muted); font-style: italic; font-size: var(--text-xs); }
.t-divider    { color: var(--text-dim); }
.t-header     { color: var(--text-primary); font-weight: 600; font-size: var(--text-base); }
.t-label      { color: var(--mode-color); font-size: var(--text-xs); letter-spacing: 0.18em; text-transform: uppercase; margin: 5px 0 1px; transition: color 0.3s; }
.t-item       { color: var(--text-secondary); }
.t-row        { color: var(--text-secondary); opacity: 0.85; }
.t-note       { color: var(--text-muted); font-style: italic; font-size: var(--text-xs); }
.t-success    { color: var(--positive); }
.t-warn       { color: var(--warn); }
.t-error      { color: var(--negative); }
.t-cmd        { color: var(--mode-color); font-weight: 500; margin: 8px 0 2px; transition: color 0.3s; }
.t-processing { color: var(--purple); display: flex; align-items: center; gap: 10px; font-style: italic; }
.t-processing::before {
  content: '';
  width: 8px; height: 8px;
  border: 1.5px solid var(--purple); border-top-color: transparent;
  border-radius: 50%; animation: spin 0.65s linear infinite; display: block; flex-shrink: 0;
}
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes lineIn  { from { opacity:0; transform:translateY(3px); } to { opacity:1; transform:translateY(0); } }


/* ── COMPOSER (always pinned) ────────────────────────────────────────────────── */
.v4-composer {
  position: relative;
  z-index: 100;
  height: var(--composer-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: 10px var(--space-lg) 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
}
.v4-composer-inner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
}

.v4-mode-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}
.v4-mode-indicator:hover { border-color: var(--border-accent); background: var(--bg-2); }
.v4-mode-glyph  { color: var(--mode-color); font-size: 0.85rem; line-height: 1; transition: color 0.3s; }
.v4-mode-label  { font-family: 'Orbitron', sans-serif; font-size: var(--text-2xs); font-weight: 600; letter-spacing: 0.08em; color: var(--text-muted); }
.v4-mode-chevron { color: var(--text-dim); flex-shrink: 0; transition: transform var(--ease); }
.v4-mode-indicator[aria-expanded="true"] .v4-mode-chevron { transform: rotate(180deg); }

.v4-mode-picker {
  position: absolute;
  bottom: calc(100% + var(--space-sm));
  left: 0;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border-accent);
  border-radius: var(--r-md);
  padding: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
  min-width: 160px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity var(--ease), transform var(--ease);
}
.v4-mode-picker.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.v4-mode-opt {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: left;
  transition: color var(--ease), background var(--ease);
}
.v4-mode-opt:hover { color: var(--text-primary); background: var(--surface); }
.v4-mode-opt.active { color: var(--mode-color); background: rgba(224,64,251,0.08); }

.v4-input-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--input-bg);
  border: 1px solid rgba(224,64,251,0.2);
  border-radius: var(--r-md);
  padding: 9px 16px;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.v4-input-field:focus-within {
  border-color: var(--mode-color);
  box-shadow: 0 0 0 1px var(--mode-color), 0 0 24px rgba(224,64,251,0.07), inset 0 0 8px rgba(224,64,251,0.03);
}
.v4-prompt-symbol {
  color: var(--mode-color);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  flex-shrink: 0;
  user-select: none;
  transition: color 0.3s;
  filter: drop-shadow(0 0 5px var(--mode-color));
}
.v4-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-base);
  caret-color: var(--mode-color);
}
.v4-input::placeholder { color: var(--text-dim); }
.v4-input:disabled     { opacity: 0.45; }

.v4-exec-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'Inter', sans-serif;
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  background: var(--gradient);
  border: none;
  border-radius: var(--r-sm);
  padding: 9px 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: 0 2px 18px rgba(224,64,251,0.28);
}
.v4-exec-btn:hover  { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 26px rgba(224,64,251,0.44); }
.v4-exec-btn:active { transform: translateY(0); }
.v4-exec-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }

.v4-output-toggle {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--ease), border-color var(--ease);
}
.v4-output-toggle:hover { color: var(--text-primary); border-color: var(--border-accent); }

.v4-composer-hints {
  font-size: var(--text-2xs);
  color: var(--text-dim);
  padding: 6px 2px 0;
  margin-top: 5px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
  white-space: normal;
}
.v4-composer-hints em  { font-style: normal; color: var(--text-muted); }
.v4-hint-keys { color: var(--text-dim); margin-left: var(--space-md); }


/* ── OUTPUT DRAWER ───────────────────────────────────────────────────────────── */
.v4-output-drawer {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: var(--composer-h);
  height: 0;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
  z-index: 80;
  display: flex;
  flex-direction: column;
  transition: height 0.28s cubic-bezier(0.4,0,0.2,1);
}
.v4-output-drawer.open { height: 340px; }
.v4-sidebar.collapsed ~ .v4-main + .v4-output-drawer,
.v4-output-drawer { /* drawer width updates via JS class */ }

.v4-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: var(--space-md);
}
.v4-drawer-title { display: flex; align-items: center; gap: var(--space-md); }
.v4-drawer-mode-tag {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--mode-color);
  border: 1px solid var(--border-accent);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  transition: color 0.3s, border-color 0.3s;
}
.v4-drawer-echo { font-family: 'JetBrains Mono', monospace; font-size: var(--text-xs); color: var(--text-muted); }
.v4-drawer-controls { display: flex; align-items: center; gap: var(--space-md); }
.v4-drawer-counter { font-family: 'JetBrains Mono', monospace; font-size: var(--text-xs); color: var(--text-dim); }
.v4-drawer-btn {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px 9px;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}
.v4-drawer-btn:hover { color: var(--text-muted); border-color: rgba(255,255,255,0.1); }
.v4-drawer-output {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-sm);
  line-height: 1.85;
  scrollbar-width: thin;
  scrollbar-color: rgba(224,64,251,0.1) transparent;
}
.v4-drawer-output::-webkit-scrollbar       { width: 3px; }
.v4-drawer-output::-webkit-scrollbar-thumb { background: rgba(224,64,251,0.15); border-radius: 2px; }


/* ── ANIMATIONS ──────────────────────────────────────────────────────────────── */
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.3;transform:scale(.6)} }


/* ── CRM / WORKFLOW / SETTINGS PAGE STUBS ────────────────────────────────────── */
.crm-metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--space-md); margin-bottom: var(--space-lg); }
.crm-metric  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--space-lg); }
.crm-metric-val { font-family: 'Orbitron', sans-serif; font-size: var(--kpi-md); font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.crm-metric-val.positive { color: var(--positive); }
.crm-metric-val.warn     { color: var(--warn); }
.crm-metric-lbl { font-size: var(--text-xs); color: var(--text-muted); }

.lead-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.lead-row {
  display: grid;
  grid-template-columns: 48px 1fr 140px 100px 80px;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}
.lead-row:last-child { border-bottom: none; }
.lead-row:hover { background: var(--bg-2); }
.lead-row.header { background: var(--bg-2); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.lead-score { font-family: 'JetBrains Mono', monospace; font-size: var(--text-sm); font-weight: 700; text-align: center; }
.score-hot  { color: var(--negative); }
.score-warm { color: var(--warn); }
.score-cool { color: var(--info); }
.lead-name  { font-size: var(--text-base); font-weight: 500; color: var(--text-primary); }
.lead-stage { font-size: var(--text-sm); color: var(--text-muted); }
.lead-val   { font-family: 'JetBrains Mono', monospace; font-size: var(--text-sm); color: var(--positive); font-weight: 600; }

.workflow-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--space-md); }
.workflow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-lg);
  transition: border-color var(--ease);
}
.workflow-card:hover { border-color: var(--border-accent); }
.workflow-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-sm); }
.workflow-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.workflow-trigger { font-size: var(--text-sm); color: var(--text-muted); font-style: italic; margin-bottom: var(--space-md); }
.workflow-meta { display: flex; align-items: center; justify-content: space-between; }
.workflow-runs { font-family: 'JetBrains Mono', monospace; font-size: var(--text-xs); color: var(--text-dim); }

.settings-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--space-md); }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--space-lg); }
.settings-card-title { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-sm); }
.settings-card-desc  { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.6; margin-bottom: var(--space-md); }


/* ── COMMAND EMPTY STATE ─────────────────────────────────────────────────────── */
.cmd-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-lg);
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  animation: fadeUp 0.3s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cmd-empty-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-sm);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.cmd-empty-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 8px rgba(74,222,128,0.5);
  flex-shrink: 0;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(74,222,128,0.5); }
  50%       { opacity: 0.55; box-shadow: 0 0 3px rgba(74,222,128,0.2); }
}
.cmd-empty-tagline {
  color: var(--text-secondary);
}

/* Suggestion cards */
.cmd-suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  width: 100%;
  max-width: 560px;
}
.cmd-suggestion-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: 14px var(--space-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--ease), background var(--ease), transform var(--ease), box-shadow var(--ease);
}
.cmd-suggestion-card:hover {
  border-color: var(--mode-color);
  background: var(--surface);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.cmd-suggestion-glyph {
  font-size: 1rem;
  color: var(--mode-color);
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  transition: color 0.3s;
  margin-top: 1px;
}
.cmd-suggestion-body {
  flex: 1;
  min-width: 0;
}
.cmd-suggestion-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.cmd-suggestion-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
}
.cmd-suggestion-arrow {
  color: var(--text-dim);
  font-size: 0.85rem;
  flex-shrink: 0;
  align-self: center;
  transition: color var(--ease), transform var(--ease);
}
.cmd-suggestion-card:hover .cmd-suggestion-arrow {
  color: var(--mode-color);
  transform: translateX(3px);
}

/* Recent command chips */
.cmd-recent {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
  max-width: 560px;
  width: 100%;
}
.cmd-recent-label {
  font-size: var(--text-2xs);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.cmd-recent-chip {
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  transition: border-color var(--ease), color var(--ease);
  white-space: nowrap;
}
.cmd-recent-chip:hover {
  border-color: var(--mode-color);
  color: var(--mode-color);
}

/* cmd-suggestion-grid single-column at ≤480px — see main responsive section */


/* ── COMMAND PAGE — body[data-page="command"] overrides ──────────────────────── */

/* Hide global composer on the Command page — it has its own integrated input */
body[data-page="command"] .v4-composer { display: none; }

/* Expand the shell to fill full remaining height without composer */
body[data-page="command"] .v4-shell {
  height: calc(100vh - var(--strip-h) - var(--nav-h));
}

/* Make the page fill the workspace and suppress page-level scroll */
body[data-page="command"] .v4-main   { overflow: hidden; }
body[data-page="command"] .v4-page   { height: 100%; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }

/* Let the command layout stretch to fill whatever height remains */
body[data-page="command"] .command-page-layout { flex: 1; height: auto; min-height: 0; }


/* ── CMD PAGE INPUT BAR ───────────────────────────────────────────────────────── */
.cmd-page-input-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.cmd-mode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  pointer-events: none;
  user-select: none;
}
.cmd-page-input-field {
  flex: 1;
}
.cmd-session-info {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-2xs);
  color: var(--text-muted);
}
.cmd-clear-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--ease), border-color var(--ease);
}
.cmd-clear-btn:hover { color: var(--negative); border-color: var(--negative); }


/* ── RESPONSIVE ──────────────────────────────────────────────────────────────── */

/* ─ 1200px — tablet landscape ───────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kpi-row             { grid-template-columns: repeat(2, 1fr); }
  .overview-grid       { grid-template-columns: 1fr; }
  .intelligence-layout { grid-template-columns: 1fr; }
  .context-card        { position: static; }
  .crm-metrics         { grid-template-columns: repeat(2, 1fr); }
}

/* ─ 900px — tablet portrait, collapse sidebar ───────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .v4-sidebar           { display: none; }
  .kpi-row              { grid-template-columns: 1fr 1fr; }
  .agent-strip          { grid-template-columns: repeat(2, 1fr); }
  .settings-grid        { grid-template-columns: 1fr; }
  .workflow-grid        { grid-template-columns: 1fr; }
  .ab-row               { grid-template-columns: 1fr; }
  .v4-output-drawer     { left: 0; }
  .v4-nav-link          { display: none; }
  /* Command page: single-column, hide mode/chip sidebar panel */
  .command-page-layout  { grid-template-columns: 1fr; }
  .command-sidebar-pane { display: none; }
}

/* ─ 600px — phone landscape / large phone portrait ──────────────────────────── */
@media (max-width: 600px) {
  /* Layout */
  .v4-page              { padding: var(--space-md); }
  .kpi-row              { grid-template-columns: 1fr; }
  .agent-strip          { grid-template-columns: 1fr; }
  .crm-metrics          { grid-template-columns: 1fr 1fr; }
  .v4-page-header       { flex-direction: column; }
  .lead-row             { grid-template-columns: 40px 1fr 80px; }
  .lead-row > .lead-stage { display: none; }

  /* Status strip: hide metrics area, keep brand + online + version */
  .ss-metrics           { display: none; }

  /* Onboarding: hide step labels so progress dots don't overflow */
  .ob-step-label        { display: none; }
  .ob-progress          { gap: 4px; align-items: center; }
  /* Reset line's bottom margin — only needed when labels are visible */
  .ob-step-line         { margin-bottom: 0; min-width: 16px; }
  .ob-heading           { font-size: var(--text-lg); }
}

/* ─ 480px — phone portrait (primary mobile target) ──────────────────────────── */
@media (max-width: 480px) {

  /* ── Status strip: minimal brand + online only ────────────────────────────── */
  .ss-version           { display: none; }
  .ss-right             { display: none; }

  /* ── Nav: hide breadcrumb to prevent crowding with action buttons ─────────── */
  .v4-page-context      { display: none; }

  /* ── Page padding ─────────────────────────────────────────────────────────── */
  .v4-page              { padding: var(--space-sm) var(--space-md); }

  /* ── Global composer: 2-row layout ───────────────────────────────────────── */
  /*    Row 1: full-width input field                                           */
  /*    Row 2: mode indicator · execute button · output toggle                  */
  :root                 { --composer-h: 98px; }
  .v4-composer          { padding: 8px var(--space-md) env(safe-area-inset-bottom, 6px); gap: 0; }
  .v4-composer-inner    { flex-wrap: wrap; gap: 6px; align-items: center; }
  .v4-input-field       { order: -1; flex: 1 0 100%; } /* full-width, first row */
  .v4-mode-label        { display: none; }
  .v4-mode-chevron      { display: none; }
  .v4-exec-btn          { flex: 1; justify-content: center; min-width: 0; }
  .v4-composer-hints    { display: none; }

  /* ── Command page integrated input bar: same 2-row treatment ─────────────── */
  .cmd-page-input-bar       { flex-wrap: wrap; gap: 6px; padding: 8px var(--space-sm); }
  .cmd-page-input-field     { order: -1; flex: 1 0 100%; }
  .cmd-mode-pill .v4-mode-label { display: none; }
  .cmd-session-info         { display: none; }

  /* ── Command empty state: single column cards ─────────────────────────────── */
  .cmd-suggestion-grid  { grid-template-columns: 1fr; }
  .cmd-empty-state      { padding: var(--space-lg) var(--space-md); gap: var(--space-md); }

  /* ── Onboarding ───────────────────────────────────────────────────────────── */
  .ob-shell             { padding: var(--space-md); }
  .ob-card              { padding: var(--space-md); }
  .ob-connect-tile      { gap: var(--space-sm); }
  .ob-goal-chip         { font-size: var(--text-xs); padding: 6px 10px; }
  .ob-feature-chips     { gap: 6px; }
  .ob-subheading        { font-size: var(--text-sm); }

  /* ── General ─────────────────────────────────────────────────────────────── */
  .resume-banner-inner  { flex-wrap: wrap; gap: var(--space-sm); }
}


/* =============================================================================
   PROFILE MENU
   ============================================================================= */

.v4-profile-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 5px 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: left;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.v4-profile-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text-primary);
}
.v4-profile-identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.v4-profile-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-profile-org {
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-profile-email {
  font-size: var(--text-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-profile-chevron {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform var(--ease);
}
.v4-profile-btn[aria-expanded="true"] .v4-profile-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.v4-profile-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  min-width: 200px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  padding: var(--space-xs);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity var(--ease), transform var(--ease);
  z-index: 200;
}
.v4-profile-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.v4-profile-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.v4-profile-menu-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.v4-profile-menu-item.danger {
  color: var(--negative);
}
.v4-profile-menu-item.danger:hover {
  background: rgba(248,113,113,0.08);
  color: var(--negative);
}
.v4-profile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-xs) 0;
}

/* Header profile — compact button, dropdown opens downward */
.v4-header-profile .v4-profile-org,
.v4-header-profile .v4-profile-email { display: none !important; }
.v4-header-profile .v4-profile-identity { gap: 0; }
.v4-header-profile .v4-profile-btn[aria-expanded="true"] {
  background: var(--surface);
  border-color: var(--border);
}

/* Org switcher (inside profile menu — shown only for multi-org) */
.v4-org-switcher-header {
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 12px 4px;
}
.v4-org-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.v4-org-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.v4-org-item.active { color: var(--text-primary); }
.v4-org-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v4-org-check { flex-shrink: 0; color: var(--accent); }


/* =============================================================================
   RESUME-SETUP BANNER
   ============================================================================= */

.resume-banner {
  margin-bottom: var(--space-md);
}
.resume-banner-inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 14px var(--space-lg);
  background: linear-gradient(135deg, rgba(224,64,251,0.08) 0%, rgba(0,212,255,0.06) 100%);
  border: 1px solid rgba(224,64,251,0.25);
  border-radius: var(--r-md);
}
.resume-banner-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(224,64,251,0.55));
}
.resume-banner-text {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}
.resume-banner-text strong {
  color: var(--text-primary);
  font-weight: 600;
}
.resume-banner-cta {
  flex-shrink: 0;
  font-size: var(--text-sm) !important;
  padding: 8px 16px !important;
}
.resume-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: color var(--ease);
}
.resume-banner-dismiss:hover {
  color: var(--text-primary);
}


/* =============================================================================
   ONBOARDING FLOW
   ============================================================================= */

.ob-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

/* Progress tracker */
.ob-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-xl);
}
.ob-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ob-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--ease-slow);
}
.ob-step.active .ob-step-dot {
  background: var(--magenta);
  border-color: var(--magenta);
  color: #fff;
  box-shadow: 0 0 14px rgba(224,64,251,0.35);
}
.ob-step.done .ob-step-dot {
  background: var(--positive);
  border-color: var(--positive);
  color: #fff;
}
.ob-step-label {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.ob-step.active .ob-step-label {
  color: var(--text-primary);
}
.ob-step.done .ob-step-label {
  color: var(--positive);
}
.ob-step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  margin-bottom: 24px; /* align with dot center */
  min-width: 24px;
}

/* Card */
.ob-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-xl);
  box-shadow: 0 8px 40px rgba(0,0,0,0.08);
}

/* Welcome */
.ob-welcome-icon {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
  filter: drop-shadow(0 0 24px rgba(224,64,251,0.45));
}
.ob-complete-icon {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
  /* Dual glow: positive (success) + magenta (brand) */
  filter: drop-shadow(0 0 20px rgba(74,222,128,0.35)) drop-shadow(0 0 10px rgba(224,64,251,0.3));
}

/* Command page empty-state brand mark */
.cmd-empty-icon {
  display: flex;
  justify-content: center;
  /* filter controlled by diamond state animation; static value is fallback only */
  filter: drop-shadow(0 0 14px rgba(224,64,251,0.4));
  margin-bottom: calc(-1 * var(--space-sm));
}

/* =============================================================================
   ARES DIAMOND STATE SYSTEM
   State classes live on <body>. CSS specificity drives all three diamond
   surfaces simultaneously: .ss-logo-mark · .v4-logo-svg · .cmd-empty-icon
   JS API: setDiamondState('idle' | 'processing' | 'success' | 'error')
   ============================================================================= */

/* ── Idle (default) — gentle breathing glow, always running ── */
.ss-logo-mark,
.v4-logo-svg,
.cmd-empty-icon {
  animation: ares-idle-breathe 3.5s ease-in-out infinite;
}

/* ── Processing — tighter pulse, full glow intensity ── */
body.ares-state-processing .ss-logo-mark,
body.ares-state-processing .v4-logo-svg,
body.ares-state-processing .cmd-empty-icon {
  animation: ares-proc-pulse 0.95s ease-in-out infinite;
}

/* ── Success — green flash fading back to magenta ── */
body.ares-state-success .ss-logo-mark,
body.ares-state-success .v4-logo-svg,
body.ares-state-success .cmd-empty-icon {
  animation: ares-success-flash 0.65s ease-out forwards;
}

/* ── Error — red flash fading back to magenta ── */
body.ares-state-error .ss-logo-mark,
body.ares-state-error .v4-logo-svg,
body.ares-state-error .cmd-empty-icon {
  animation: ares-error-flash 0.65s ease-out forwards;
}

@keyframes ares-idle-breathe {
  0%, 100% { filter: drop-shadow(0 0 7px  rgba(224,64,251,0.55)); }
  50%       { filter: drop-shadow(0 0 2px  rgba(224,64,251,0.12)); }
}
@keyframes ares-proc-pulse {
  0%, 100% { filter: drop-shadow(0 0 13px rgba(224,64,251,0.95)); }
  50%       { filter: drop-shadow(0 0 4px  rgba(224,64,251,0.35)); }
}
@keyframes ares-success-flash {
  0%   { filter: drop-shadow(0 0 18px rgba( 74,222,128,0.95)); }
  40%  { filter: drop-shadow(0 0 10px rgba( 74,222,128,0.65)); }
  100% { filter: drop-shadow(0 0  6px rgba(224, 64,251,0.45)); }
}
@keyframes ares-error-flash {
  0%   { filter: drop-shadow(0 0 18px rgba(248,113,113,0.95)); }
  40%  { filter: drop-shadow(0 0 10px rgba(248,113,113,0.55)); }
  100% { filter: drop-shadow(0 0  6px rgba(224, 64,251,0.45)); }
}

/* ── Reduced motion: static state glows, no looping animations ── */
@media (prefers-reduced-motion: reduce) {
  .ss-logo-mark,
  .v4-logo-svg,
  .cmd-empty-icon                              { animation: none; filter: drop-shadow(0 0 6px rgba(224,64,251,0.45)); }
  body.ares-state-processing .ss-logo-mark,
  body.ares-state-processing .v4-logo-svg,
  body.ares-state-processing .cmd-empty-icon   { animation: none; filter: drop-shadow(0 0 12px rgba(224,64,251,0.85)); }
  body.ares-state-success .ss-logo-mark,
  body.ares-state-success .v4-logo-svg,
  body.ares-state-success .cmd-empty-icon      { animation: none; filter: drop-shadow(0 0 10px rgba(74,222,128,0.8)); }
  body.ares-state-error .ss-logo-mark,
  body.ares-state-error .v4-logo-svg,
  body.ares-state-error .cmd-empty-icon        { animation: none; filter: drop-shadow(0 0 10px rgba(248,113,113,0.8)); }
  body.ares-state-malbolge .ss-logo-mark,
  body.ares-state-malbolge .v4-logo-svg,
  body.ares-state-malbolge .cmd-empty-icon     { animation: none; filter: drop-shadow(0 0 8px rgba(239,68,68,0.9)); }
  body.ares-state-oracle .ss-logo-mark,
  body.ares-state-oracle .v4-logo-svg,
  body.ares-state-oracle .cmd-empty-icon       { animation: none; filter: drop-shadow(0 0 14px rgba(251,191,36,0.9)); }
  body.ares-state-elysium .ss-logo-mark,
  body.ares-state-elysium .v4-logo-svg,
  body.ares-state-elysium .cmd-empty-icon      { animation: none; filter: drop-shadow(0 0 14px rgba(147,197,253,0.9)); }
  body.ares-state-obsidian .ss-logo-mark,
  body.ares-state-obsidian .v4-logo-svg,
  body.ares-state-obsidian .cmd-empty-icon     { animation: none; filter: drop-shadow(0 0 3px  rgba(224,64,251,0.20)); }
}

/* ── Malbolge Protocol ───────────────────────────────────────────────────────── */
body.ares-state-malbolge .ss-logo-mark,
body.ares-state-malbolge .v4-logo-svg,
body.ares-state-malbolge .cmd-empty-icon {
  animation: ares-malbolge-flicker 0.38s ease-in-out infinite;
}
@keyframes ares-malbolge-flicker {
  0%   { filter: drop-shadow(0 0 11px rgba(239,68,68,0.95)); }
  35%  { filter: drop-shadow(0 0 3px  rgba(239,68,68,0.25)); }
  65%  { filter: drop-shadow(0 0 15px rgba(239,68,68,1.00)); }
  100% { filter: drop-shadow(0 0 9px  rgba(239,68,68,0.80)); }
}
body.ares-malbolge .v4-sidebar {
  box-shadow: inset -1px 0 0 rgba(239,68,68,0.18), 0 0 28px rgba(239,68,68,0.05);
  transition: box-shadow 0.45s ease;
}
body.ares-malbolge .v4-shell {
  box-shadow: inset 0 0 0 1px rgba(239,68,68,0.12);
  transition: box-shadow 0.45s ease;
}

/* ── Oracle Protocol ─────────────────────────────────────────────────────────── */
body.ares-state-oracle .ss-logo-mark,
body.ares-state-oracle .v4-logo-svg,
body.ares-state-oracle .cmd-empty-icon {
  animation: ares-oracle-pulse 1.8s ease-in-out forwards;
}
@keyframes ares-oracle-pulse {
  0%   { filter: drop-shadow(0 0 4px  rgba(251,191,36,0.20)); }
  18%  { filter: drop-shadow(0 0 22px rgba(251,191,36,1.00)); }
  55%  { filter: drop-shadow(0 0 16px rgba(251,191,36,0.80)); }
  100% { filter: drop-shadow(0 0 6px  rgba(224,64,251,0.45)); }
}
body.ares-oracle .v4-shell {
  box-shadow: inset 0 0 0 1px rgba(251,191,36,0.10);
  transition: box-shadow 0.5s ease;
}

/* ── Elysium Protocol ────────────────────────────────────────────────────────── */
body.ares-state-elysium .ss-logo-mark,
body.ares-state-elysium .v4-logo-svg,
body.ares-state-elysium .cmd-empty-icon {
  animation: ares-elysium-hold 2.8s ease-out forwards;
}
@keyframes ares-elysium-hold {
  0%   { filter: drop-shadow(0 0 4px  rgba(147,197,253,0.20)); }
  12%  { filter: drop-shadow(0 0 20px rgba(147,197,253,1.00)); }
  70%  { filter: drop-shadow(0 0 16px rgba(147,197,253,0.88)); }
  100% { filter: drop-shadow(0 0 6px  rgba(224,64,251,0.45)); }
}
body.ares-elysium .v4-sidebar {
  box-shadow: inset -1px 0 0 rgba(147,197,253,0.14), 0 0 24px rgba(147,197,253,0.04);
  transition: box-shadow 0.6s ease;
}
body.ares-elysium .v4-shell {
  box-shadow: inset 0 0 0 1px rgba(147,197,253,0.09);
  transition: box-shadow 0.6s ease;
}

/* ── Obsidian Protocol ───────────────────────────────────────────────────────── */
/* Zero-point. Below idle baseline. Pilot-light only — present, not pulsing.    */
body.ares-state-obsidian .ss-logo-mark,
body.ares-state-obsidian .v4-logo-svg,
body.ares-state-obsidian .cmd-empty-icon {
  animation: ares-obsidian-hold 6s ease-in-out infinite;
}
@keyframes ares-obsidian-hold {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(224,64,251,0.14)); }
  50%       { filter: drop-shadow(0 0 4px rgba(224,64,251,0.24)); }
}

.ob-heading {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 var(--space-sm);
}
.ob-subheading {
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  margin: 0 0 var(--space-lg);
}

/* Feature chips (welcome) */
.ob-feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-xl);
}
.ob-chip {
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Form */
.ob-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.ob-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ob-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.ob-input {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--ease);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.ob-input:focus {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(224,64,251,0.12);
}
.ob-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Goal chips */
.ob-goal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.ob-goal-chip {
  padding: 7px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--ease);
}
.ob-goal-chip:hover {
  border-color: var(--magenta);
  color: var(--text-primary);
}
.ob-goal-chip.selected {
  background: rgba(224,64,251,0.12);
  border-color: var(--magenta);
  color: var(--magenta);
  font-weight: 600;
}

/* Connect grid */
.ob-connect-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.ob-connect-tile {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px var(--space-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--ease);
}
.ob-connect-tile.connected {
  border-color: rgba(74,222,128,0.4);
  background: rgba(74,222,128,0.04);
}
.ob-connect-icon {
  font-size: 1.25rem;
  width: 32px;
  text-align: center;
  color: var(--text-muted);
}
.ob-connect-info {
  flex: 1;
}
.ob-connect-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.ob-connect-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.ob-connect-btn {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
}
.ob-connect-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}
.ob-connect-btn.done {
  border-color: var(--positive);
  color: var(--positive);
  cursor: default;
}

/* Completion summary */
.ob-complete-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  background: var(--surface-2);
  border-radius: var(--r-md);
}
.ob-summary-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.ob-summary-icon {
  color: var(--positive);
  font-size: 0.9rem;
}

/* Nav row */
.ob-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}
.ob-nav-center {
  justify-content: center;
}
.ob-next,
.ob-launch {
  min-width: 140px;
}

/* Onboarding breakpoint rules consolidated into the main responsive section above */

/* ─────────────────────────────────────────────────────────────────────────────
   NOTIFICATIONS PANEL
   ───────────────────────────────────────────────────────────────────────────── */
.v4-notif-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 299;
}
.v4-notif-backdrop.open { display: block; }

.v4-notif-panel {
  position: fixed;
  top: var(--strip-h);
  right: 0; bottom: 0;
  width: 360px;
  max-width: 100vw;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.v4-notif-panel.open { transform: translateX(0); }
.v4-notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.v4-notif-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); letter-spacing: 0.02em; }
.v4-notif-actions { display: flex; gap: var(--space-xs); }
.v4-notif-body { flex: 1; overflow-y: auto; }
.v4-notif-item {
  display: flex; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: default; transition: background var(--ease); position: relative;
}
.v4-notif-item:hover { background: var(--surface-hover); }
.v4-notif-item.unread { background: rgba(224,64,251,0.03); }
.v4-notif-item.unread::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--gradient); border-radius: 0 2px 2px 0;
}
.v4-notif-icon {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.v4-notif-icon.approval { background: rgba(251,191,36,0.12); color: var(--warn); }
.v4-notif-icon.agent    { background: rgba(34,211,238,0.12);  color: var(--info); }
.v4-notif-icon.system   { background: rgba(248,113,113,0.12); color: var(--negative); }
.v4-notif-icon.intel    { background: rgba(224,64,251,0.12);  color: var(--accent); }
.v4-notif-content { flex: 1; min-width: 0; }
.v4-notif-item-title {
  font-size: var(--text-sm); font-weight: 500; color: var(--text-primary);
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v4-notif-item-body { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; }
.v4-notif-item-time { font-size: var(--text-xs); color: var(--text-dim); font-family: 'JetBrains Mono', monospace; margin-top: 4px; }
.v4-notif-empty { padding: 48px 24px; text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
.v4-notif-empty-icon { font-size: 28px; margin-bottom: 12px; opacity: 0.4; }

/* ─────────────────────────────────────────────────────────────────────────────
   TOAST NOTIFICATIONS
   ───────────────────────────────────────────────────────────────────────────── */
.v4-toast-container {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 500; pointer-events: none;
}
.v4-toast {
  padding: 10px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); font-size: var(--text-sm); color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  pointer-events: auto; white-space: nowrap;
  animation: toast-in 0.2s ease;
}
.v4-toast.success { border-color: rgba(74,222,128,0.45);  color: var(--positive); }
.v4-toast.error   { border-color: rgba(248,113,113,0.45); color: var(--negative); }
.v4-toast.info    { border-color: rgba(224,64,251,0.30); }
.v4-toast.fade-out { animation: toast-out 0.22s ease forwards; }
@keyframes toast-in  { from { opacity:0; transform: translateY(8px);  } to { opacity:1; transform: translateY(0);  } }
@keyframes toast-out { from { opacity:1; transform: translateY(0);    } to { opacity:0; transform: translateY(4px); } }

/* ─────────────────────────────────────────────────────────────────────────────
   SETTINGS — TABBED LAYOUT
   ───────────────────────────────────────────────────────────────────────────── */
.settings-layout { display: flex; min-height: 500px; }
.settings-tabs {
  width: 176px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: var(--space-md) 0;
  display: flex; flex-direction: column; gap: 2px;
}
.settings-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: var(--text-sm); color: var(--text-muted);
  cursor: pointer; background: transparent; border: none;
  border-left: 2px solid transparent; text-align: left;
  transition: background var(--ease), color var(--ease);
}
.settings-tab:hover { background: var(--surface-hover); color: var(--text-primary); }
.settings-tab.active {
  color: var(--text-primary); font-weight: 500;
  border-left-color: var(--accent); background: var(--surface-hover);
}
.settings-tab svg { opacity: 0.55; flex-shrink: 0; }
.settings-tab.active svg { opacity: 1; }
.settings-panel { flex: 1; padding: var(--space-lg); overflow-y: auto; min-width: 0; max-width: 580px; }
.settings-section-title {
  font-size: var(--text-base); font-weight: 600; color: var(--text-primary);
  margin-bottom: var(--space-md); padding-bottom: var(--space-sm); border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-md); padding: var(--space-sm) 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: var(--text-sm); color: var(--text-primary); font-weight: 500; }
.settings-row-hint  { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.settings-field-group { display: flex; flex-direction: column; gap: var(--space-md); margin-bottom: var(--space-lg); }
.settings-field { display: flex; flex-direction: column; gap: 6px; }
.settings-label {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-muted); text-transform: uppercase;
}
.settings-input {
  padding: 9px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: var(--text-sm); color: var(--text-primary);
  font-family: 'Inter', sans-serif; transition: border-color var(--ease);
  outline: none; width: 100%; box-sizing: border-box;
}
.settings-input:focus { border-color: var(--accent); }
.settings-input[readonly] { color: var(--text-muted); cursor: default; background: var(--surface-hover); }

/* Profile photo */
.settings-avatar-wrap { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-lg); }
.settings-avatar {
  width: 72px; height: 72px; border-radius: 50%; background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff; overflow: hidden;
  flex-shrink: 0; cursor: pointer; transition: opacity var(--ease);
  border: 2px solid transparent;
}
.settings-avatar:hover { opacity: 0.85; border-color: var(--accent); }
.settings-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.settings-avatar-actions { display: flex; flex-direction: column; gap: 8px; }
.settings-avatar-hint { font-size: var(--text-xs); color: var(--text-muted); }

/* Toggle switch */
.settings-toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.settings-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.settings-toggle-track {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 11px; cursor: pointer; transition: background var(--ease);
}
.settings-toggle input:checked + .settings-toggle-track { background: var(--accent); }
.settings-toggle-track::after {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform var(--ease);
}
.settings-toggle input:checked + .settings-toggle-track::after { transform: translateX(18px); }

/* Experimental zone */
.settings-exp-warning {
  background: rgba(251,191,36,0.07); border: 1px solid rgba(251,191,36,0.25);
  border-radius: var(--r-sm); padding: var(--space-sm) var(--space-md);
  font-size: var(--text-xs); color: var(--warn); margin-bottom: var(--space-md); line-height: 1.5;
}

/* Sidebar avatar image support */
.v4-sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }


/* ─────────────────────────────────────────────────────────────────────────────
   OVERVIEW — PRIORITY ACTIONS + ACTIVITY MINI
   ───────────────────────────────────────────────────────────────────────────── */
.priority-list { display: flex; flex-direction: column; }
.priority-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
}
.priority-item:last-child { border-bottom: none; }
.priority-item-label {
  font-size: var(--text-2xs); font-weight: 700; letter-spacing: .07em;
  color: var(--warn); background: rgba(251,191,36,.09);
  border: 1px solid rgba(251,191,36,.25); border-radius: var(--r-pill);
  padding: 2px 8px; flex-shrink: 0; white-space: nowrap;
}
.priority-item-text { font-size: var(--text-sm); color: var(--text-secondary); flex: 1; min-width: 0; }

.activity-mini-list { display: flex; flex-direction: column; }
.activity-mini-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--border);
}
.activity-mini-row:last-child { border-bottom: none; }
.activity-mini-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; background: var(--surface-2);
}
.activity-mini-icon.type-agent    { background: rgba(0,212,255,.1);  color: var(--cyan);    }
.activity-mini-icon.type-campaign { background: rgba(251,191,36,.1); color: var(--warn);    }
.activity-mini-icon.type-workflow { background: rgba(124,77,255,.1); color: var(--purple);  }
.activity-mini-icon.type-approval { background: rgba(224,64,251,.1); color: var(--magenta); }
.activity-mini-icon.type-intel    { background: rgba(74,222,128,.1); color: var(--positive);}
.activity-mini-body { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.activity-mini-title  { font-size: var(--text-sm); color: var(--text-primary); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-mini-detail { font-size: var(--text-xs); color: var(--text-muted); flex: 2; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-mini-time   { font-size: var(--text-xs); color: var(--text-dim); flex-shrink: 0; }


/* ─────────────────────────────────────────────────────────────────────────────
   AGENTS — DETAIL GRID
   ───────────────────────────────────────────────────────────────────────────── */
.agent-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm); margin-bottom: var(--space-md);
}
.agent-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--space-md) var(--space-lg);
  text-align: center;
}
.agent-stat-val { font-size: var(--kpi-md); font-weight: 700; color: var(--text-primary); line-height: 1; }
.agent-stat-val.positive { color: var(--positive); }
.agent-stat-val.warn     { color: var(--warn); }
.agent-stat-lbl { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

.agent-detail-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md); margin-bottom: var(--space-md);
}
@media (max-width: 900px) { .agent-detail-grid { grid-template-columns: 1fr; } }

.agent-detail-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--space-md) var(--space-lg);
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color var(--ease);
}
.agent-detail-card:hover { border-color: var(--border-accent); }
.agent-detail-header { display: flex; align-items: center; gap: 10px; }
.agent-detail-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); flex: 1; }
.agent-detail-desc { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.5; }
.agent-detail-task { font-size: var(--text-sm); color: var(--text-secondary); font-style: italic; }
.agent-detail-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }


/* ─────────────────────────────────────────────────────────────────────────────
   CRM — PIPELINE STAGES
   ───────────────────────────────────────────────────────────────────────────── */
.pipeline-stages { display: flex; flex-direction: column; gap: 10px; }
.pipeline-stage-row { display: flex; align-items: center; gap: 12px; }
.pipeline-stage-name { font-size: var(--text-sm); color: var(--text-secondary); width: 130px; flex-shrink: 0; }
.pipeline-stage-bar-track {
  flex: 1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden;
}
.pipeline-stage-bar-fill {
  height: 100%; background: var(--gradient); border-radius: 3px;
  transition: width 0.4s ease;
}
.pipeline-stage-count { font-size: var(--text-xs); color: var(--text-muted); width: 56px; text-align: right; flex-shrink: 0; }
.pipeline-stage-val   { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); width: 48px; text-align: right; flex-shrink: 0; }


/* ─────────────────────────────────────────────────────────────────────────────
   INTEGRATIONS — HEALTH + SETUP BANNER
   ───────────────────────────────────────────────────────────────────────────── */
.int-health-row {
  display: flex; gap: var(--space-sm); margin-bottom: var(--space-md);
}
.int-health-stat {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--space-md);
  text-align: center;
}
.int-health-val { font-size: var(--kpi-md); font-weight: 700; color: var(--text-primary); line-height: 1; }
.int-health-val.positive { color: var(--positive); }
.int-health-val.warn     { color: var(--warn); }
/* Wave 2: 'Not probed' tile — muted to distinguish from the
   primary three buckets (which all represent ARES-verified states). */
.int-health-val.muted    { color: var(--text-muted); }
.int-health-lbl { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

.int-setup-banner {
  background: rgba(251,191,36,.06); border: 1px solid rgba(251,191,36,.25);
  border-radius: var(--r-md); padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
}
.int-setup-banner-title {
  font-size: var(--text-sm); font-weight: 600; color: var(--warn); margin-bottom: 8px;
}
.int-setup-banner-items { display: flex; flex-wrap: wrap; gap: 6px; }
.int-setup-chip {
  font-size: var(--text-xs); color: var(--text-secondary); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px 10px;
}


/* ─────────────────────────────────────────────────────────────────────────────
   APPROVALS PAGE
   ───────────────────────────────────────────────────────────────────────────── */
.approval-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm); margin-bottom: var(--space-md);
}
.approval-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--space-md) var(--space-lg);
  text-align: center;
}
.approval-stat-val { font-size: var(--kpi-md); font-weight: 700; color: var(--text-primary); line-height: 1; }
.approval-stat-val.warn     { color: var(--warn); }
.approval-stat-val.positive { color: var(--positive); }
.approval-stat-lbl { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

.approval-row {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
  transition: opacity 0.28s ease, background var(--ease);
}
.approval-row:last-child { border-bottom: none; }
.approval-row:hover { background: var(--surface-hover); }
.approval-row-meta { display: flex; align-items: center; gap: 10px; }
.approval-type-badge {
  font-size: var(--text-2xs); font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: rgba(251,191,36,.09); color: var(--warn); border: 1px solid rgba(251,191,36,.25);
}
.approval-row-time   { font-size: var(--text-xs); color: var(--text-dim); margin-left: auto; }
.approval-row-title  { font-size: var(--text-base); font-weight: 500; color: var(--text-primary); }
.approval-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }


/* ─────────────────────────────────────────────────────────────────────────────
   PROJECTS PAGE
   ───────────────────────────────────────────────────────────────────────────── */
.project-summary-row {
  display: flex; gap: var(--space-sm); margin-bottom: var(--space-md);
}
.project-summary-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--space-md) var(--space-lg);
  text-align: center; flex: 0 0 auto; min-width: 100px;
}
.project-summary-val { font-size: var(--kpi-md); font-weight: 700; color: var(--text-primary); line-height: 1; }
.project-summary-val.positive { color: var(--positive); }
.project-summary-lbl { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

.project-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}
@media (max-width: 900px) { .project-grid { grid-template-columns: 1fr; } }

.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--space-lg);
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color var(--ease);
}
.project-card:hover { border-color: var(--border-accent); }
.project-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-card-name { font-size: var(--text-md); font-weight: 600; color: var(--text-primary); flex: 1; }
.project-card-desc { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }

.project-progress-wrap { display: flex; align-items: center; gap: 10px; }
.project-progress-track { flex: 1; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.project-progress-fill  { height: 100%; background: var(--gradient); border-radius: 2px; transition: width 0.4s ease; }
.project-progress-pct   { font-size: var(--text-xs); color: var(--text-muted); flex-shrink: 0; }

.project-card-meta  { display: flex; gap: 12px; }
.project-meta-item  { font-size: var(--text-xs); color: var(--text-muted); }
.project-card-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--border); margin-top: 2px; }


/* ─────────────────────────────────────────────────────────────────────────────
   ACTIVITY PAGE
   ───────────────────────────────────────────────────────────────────────────── */
.activity-filter-bar {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-md);
}
.activity-filter-chip {
  font-size: var(--text-xs); font-weight: 500; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 5px 14px; cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.activity-filter-chip:hover  { color: var(--text-primary); background: var(--surface-2); }
.activity-filter-chip.active { color: var(--text-primary); background: var(--surface-2); border-color: var(--border-accent); }

.activity-log { display: flex; flex-direction: column; }
.activity-log-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}
.activity-log-row:last-child { border-bottom: none; }
.activity-log-row:hover { background: var(--surface-hover); }
.activity-log-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .8rem;
  background: var(--surface-2); margin-top: 1px;
}
.activity-log-icon.type-agent    { background: rgba(0,212,255,.1);  color: var(--cyan);    }
.activity-log-icon.type-campaign { background: rgba(251,191,36,.1); color: var(--warn);    }
.activity-log-icon.type-workflow { background: rgba(124,77,255,.1); color: var(--purple);  }
.activity-log-icon.type-approval { background: rgba(224,64,251,.1); color: var(--magenta); }
.activity-log-icon.type-intel    { background: rgba(74,222,128,.1); color: var(--positive);}
.activity-log-body   { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.activity-log-title  { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.activity-log-detail { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; }
.activity-log-right  { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.activity-log-time   { font-size: var(--text-xs); color: var(--text-dim); white-space: nowrap; }


/* =============================================================================
   DEMO SHARED COMPONENTS — also used by /command/demo
   ============================================================================= */

/* ── Workflow list rows ────────────────────────────────────────────────────── */
.workflow-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 13px var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.workflow-row:last-child { border-bottom: none; }
.workflow-row-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wf-active  { background: var(--positive); box-shadow: 0 0 6px rgba(74,222,128,0.5); }
.wf-paused  { background: var(--warn); }
.wf-draft   { background: var(--text-dim); }
.workflow-row-info  { flex: 1; min-width: 0; }
.workflow-row-name  { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.workflow-row-trigger { font-size: var(--text-xs); color: var(--text-muted); }
.workflow-row-meta  { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }

/* ── Integration list rows ─────────────────────────────────────────────────── */
.int-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 13px var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.int-row:last-child { border-bottom: none; }
.int-icon   { font-size: 1.1rem; width: 28px; text-align: center; flex-shrink: 0; opacity: 0.7; }
.int-info   { flex: 1; min-width: 0; }
.int-name   { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.int-detail { font-size: var(--text-xs); color: var(--text-muted); }
.int-status {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}
.int-connected    { background: rgba(74,222,128,.1);  color: var(--positive); border: 1px solid rgba(74,222,128,.2); }
.int-awaiting     { background: rgba(251,191,36,.1);  color: var(--warn);     border: 1px solid rgba(251,191,36,.2); }
.int-not-connected{ background: transparent;          color: var(--text-dim); border: 1px solid var(--border); }

/* ── Demo command page input row ───────────────────────────────────────────── */
.cmd-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  background: var(--bg-1);
  flex-shrink: 0;
}
.cmd-prompt-symbol {
  color: var(--magenta);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-sm);
  flex-shrink: 0;
}
.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-sm);
  color: var(--text-primary);
  padding: 6px 0;
}
.cmd-input::placeholder { color: var(--text-dim); }
.cmd-send-btn {
  padding: 7px 16px;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
.cmd-send-btn:hover    { opacity: 0.88; }
.cmd-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Wave 3: Intelligence page (translated /owner intelligence slice) ─────── */
.cmd-intel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 20px;
}
@media (min-width: 1100px) {
  .cmd-intel-grid { grid-template-columns: repeat(3, 1fr); }
}
.cmd-intel-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
  padding: 16px 18px;
}
.cmd-intel-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.cmd-intel-section-title {
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0;
}
.cmd-intel-section-count {
  font-size: .72rem;
  color: var(--text-muted);
}
.cmd-intel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cmd-intel-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
}
.cmd-intel-item-title {
  font-size: .85rem;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 4px;
}
.cmd-intel-item-sub {
  font-size: .76rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 6px;
}
.cmd-intel-item-meta {
  font-size: .7rem;
  color: var(--text-muted);
  letter-spacing: .02em;
}
.cmd-intel-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: .8rem;
}
.cmd-intel-footer {
  margin-top: 16px;
  text-align: right;
  font-size: .7rem;
  color: var(--text-muted);
}

/* ── Wave 5A: Campaigns (ARES Email Execution) ────────────────────────────── */
.cmp-banner {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0 18px;
  font-size: .82rem;
  color: var(--text-dim);
}
.cmp-banner--warn {
  border-color: rgba(251,191,36,.35);
  background: rgba(251,191,36,.07);
  color: var(--warn);
}
.cmp-banner code {
  background: rgba(0,0,0,.25);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .78rem;
}
.cmp-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.cmp-section-title {
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cmp-section-count {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.cmp-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cmp-form-row { display: flex; flex-direction: column; gap: 6px; }
.cmp-form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cmp-form-grid-2 > div { display: flex; flex-direction: column; gap: 6px; }
.cmp-label {
  font-size: .72rem;
  color: var(--text-dim);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.cmp-input,
.cmp-textarea {
  background: rgba(0,0,0,.18);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: .85rem;
  font-family: inherit;
}
.cmp-textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.cmp-input:focus,
.cmp-textarea:focus { outline: none; border-color: var(--text-muted); }
.cmp-form-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.cmp-form-status { font-size: .76rem; color: var(--text-muted); }
.cmp-btn {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 14px;
  color: var(--text-primary);
  font-size: .8rem;
  cursor: pointer;
  font-family: inherit;
}
.cmp-btn:hover { background: rgba(255,255,255,.1); }
.cmp-btn:disabled { opacity: .55; cursor: not-allowed; }
.cmp-btn--primary {
  background: rgba(124,77,255,.18);
  border-color: rgba(124,77,255,.55);
}
.cmp-btn--primary:hover { background: rgba(124,77,255,.28); }
.cmp-btn--small { padding: 5px 11px; font-size: .74rem; }
.cmp-list { display: flex; flex-direction: column; gap: 10px; }
.cmp-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cmp-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cmp-row-title { font-size: .9rem; color: var(--text-primary); font-weight: 500; }
.cmp-row-pills { display: flex; gap: 6px; }
.cmp-pill {
  font-size: .68rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(255,255,255,.04);
}
.cmp-pill--draft    { color: var(--text-muted); }
.cmp-pill--approved { color: var(--text-primary); border-color: rgba(124,77,255,.55); background: rgba(124,77,255,.12); }
.cmp-pill--idle     { color: var(--text-muted); }
.cmp-pill--sending  { color: var(--warn);  border-color: rgba(251,191,36,.45); background: rgba(251,191,36,.08); }
.cmp-pill--sent     { color: var(--sev-4); border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.08); }
.cmp-pill--failed   { color: var(--research-accent); border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.1); }
.cmp-row-meta { font-size: .72rem; color: var(--text-muted); }
.cmp-row-subject { font-size: .8rem; color: var(--text-dim); }
.cmp-row-evidence { font-size: .72rem; color: var(--text-muted); }
.cmp-evidence-na   { color: var(--text-muted); font-style: italic; }
.cmp-evidence-none { color: var(--text-muted); font-style: italic; }
.cmp-row-error { font-size: .72rem; color: var(--research-accent); }
.cmp-writeback-warn { font-size: .7rem; color: var(--warn); }
.cmp-row-actions { display: flex; gap: 8px; margin-top: 4px; }
.cmp-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.6;
}
.cmp-footer {
  margin-top: 16px;
  text-align: right;
  font-size: .7rem;
  color: var(--text-muted);
}
