/**
 * CardFlow Labs HQ - Premium Monochrome Theme
 * Ultra-sleek black & white aesthetic with shiny, polished feel
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {
  /* Typography - Premium geometric fonts */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 64px;

  /* Transitions - Smooth, luxurious feel */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-luxury: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s var(--ease-luxury);
  --transition-normal: 0.3s var(--ease-luxury);
  --transition-slow: 0.5s var(--ease-out-expo);

  /* Border radius - Crisp, modern */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
}

/* ============================================
   LIGHT THEME (Default) - Crisp white, deep black accents
   ============================================ */

[data-theme="light"], :root {
  --bg-primary: #FAFAFA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F5F5F5;
  --bg-card: #FFFFFF;
  --bg-hover: #EBEBEB;
  --bg-elevated: #FFFFFF;

  --text-primary: #0A0A0A;
  --text-secondary: #404040;
  --text-muted: #5C5C5C;
  --text-inverted: #FFFFFF;

  /* Premium black accent with silver highlights */
  --accent: #0A0A0A;
  --accent-light: #262626;
  --accent-dark: #000000;
  --accent-subtle: rgba(10, 10, 10, 0.06);
  --accent-glow: rgba(10, 10, 10, 0.15);

  /* Refined status colors - functional but muted */
  --success: #16A34A;
  --warning: #CA8A04;
  --error: #DC2626;
  --info: #2563EB;

  /* Crisp borders - improved visibility */
  --border-color: rgba(0, 0, 0, 0.15);
  --border-strong: rgba(0, 0, 0, 0.25);
  --border-shine: rgba(255, 255, 255, 0.8);

  /* Polished shadows with subtle depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.15);
  --shadow-accent: 0 4px 20px rgba(0, 0, 0, 0.18);
  --shadow-glow: 0 0 40px rgba(0, 0, 0, 0.08);

  /* Shiny/glossy effects */
  --shine-gradient: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 50%);
  --surface-shine: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 100%);

  --grain-opacity: 0.02;
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(0, 0, 0, 0.08);
}

/* ============================================
   DARK THEME - Deep black with silver/white accents
   ============================================ */

[data-theme="dark"] {
  --bg-primary: #09090B;
  --bg-secondary: #111113;
  --bg-tertiary: #1A1A1D;
  --bg-card: #131315;
  --bg-hover: #252528;
  --bg-elevated: #1A1A1D;

  --text-primary: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --text-inverted: #09090B;

  /* Silver/white accent for dark mode */
  --accent: #FAFAFA;
  --accent-light: #FFFFFF;
  --accent-dark: #E4E4E7;
  --accent-subtle: rgba(250, 250, 250, 0.1);
  --accent-glow: rgba(250, 250, 250, 0.25);

  /* Refined status colors - visible in dark mode */
  --success: #22C55E;
  --warning: #EAB308;
  --error: #EF4444;
  --info: #3B82F6;

  /* Subtle borders with silver tint */
  --border-color: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-shine: rgba(255, 255, 255, 0.12);

  /* Deep, luxurious shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.7);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.8);
  --shadow-accent: 0 4px 20px rgba(255, 255, 255, 0.12);
  --shadow-glow: 0 0 60px rgba(255, 255, 255, 0.04);

  /* Metallic shine effects */
  --shine-gradient: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 50%);
  --surface-shine: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 100%);

  --grain-opacity: 0.03;
  --glass-bg: rgba(17, 17, 19, 0.92);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* Subtle grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-dark);
}

::selection {
  background: var(--accent);
  color: var(--text-inverted);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after {
  opacity: 1;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverted);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--shine-gradient);
  pointer-events: none;
}

.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--accent-subtle);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-color);
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ============================================
   INPUTS
   ============================================ */

.input, .textarea, .select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-muted);
}

.textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--surface-shine);
  pointer-events: none;
  opacity: 0.5;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ============================================
   LAYOUT
   ============================================ */

.app-container {
  display: flex;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-normal), background-color var(--transition-slow);
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-inverted);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.1);
  letter-spacing: -0.03em;
  position: relative;
  overflow: hidden;
}

.sidebar-logo-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--shine-gradient);
  pointer-events: none;
}

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 28px;
}

.nav-section-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 12px;
  margin-bottom: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 4px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  font-weight: 500;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 24px;
  background: var(--accent);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  transition: transform var(--transition-fast);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-color);
}

.nav-item.active {
  background: var(--accent);
  color: var(--text-inverted);
  box-shadow: var(--shadow-sm);
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
  background: var(--text-inverted);
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  opacity: 0.6;
  flex-shrink: 0;
}

.nav-item.active .nav-item-icon {
  opacity: 1;
  color: var(--text-inverted);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

/* ============================================
   HEADER
   ============================================ */

.header {
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color var(--transition-slow);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme Toggle - Premium pill switch */
.theme-toggle {
  width: 48px;
  height: 26px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-normal);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15), var(--shadow-sm);
}

.theme-toggle::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.2);
}

[data-theme="dark"] .theme-toggle::before {
  left: calc(100% - 21px);
}

.theme-toggle-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  transition: opacity var(--transition-fast);
  color: var(--text-muted);
}

.theme-toggle-sun {
  left: 6px;
  opacity: 1;
}

.theme-toggle-moon {
  right: 6px;
  opacity: 0.4;
}

[data-theme="dark"] .theme-toggle-sun {
  opacity: 0.4;
}

[data-theme="dark"] .theme-toggle-moon {
  opacity: 1;
}

/* ============================================
   AVATAR
   ============================================ */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-inverted);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.1);
  border: 2px solid var(--bg-secondary);
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.1rem; }

/* ============================================
   CONTENT AREA
   ============================================ */

.content {
  flex: 1;
  padding: 28px;
}

/* ============================================
   GRID
   ============================================ */

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   STAT CARDS
   ============================================ */

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface-shine);
  pointer-events: none;
  opacity: 0.3;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.stat-card:hover::after {
  transform: scaleX(1);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.stat-change.positive {
  color: var(--success);
  background: rgba(45, 157, 120, 0.1);
}

.stat-change.negative {
  color: var(--error);
  background: rgba(220, 74, 74, 0.1);
}

/* ============================================
   ACTIVITY FEED
   ============================================ */

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.activity-item:hover {
  background: var(--bg-secondary);
  box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-sm);
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.activity-text strong {
  font-weight: 600;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   FOUNDER INBOX + MISSION SCORECARDS
   ============================================ */

.founder-inbox-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px 12px 16px;
}

.founder-dispatch-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px 16px;
  flex-wrap: wrap;
}

.founder-inbox-stat {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
}

.founder-inbox-stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  line-height: 1;
}

.founder-inbox-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.founder-inbox-list,
.mission-eval-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 16px 16px;
}

.founder-inbox-item,
.mission-eval-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-tertiary);
}

.founder-inbox-item.critical {
  border-left: 4px solid #ef4444;
}

.founder-inbox-item.high {
  border-left: 4px solid #f59e0b;
}

.founder-inbox-item.medium {
  border-left: 4px solid #3b82f6;
}

.founder-inbox-item-top,
.mission-eval-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.founder-inbox-item-title,
.mission-eval-agent {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
}

.founder-inbox-item-desc,
.mission-eval-metrics {
  margin-top: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.founder-inbox-item-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.founder-inbox-score,
.mission-eval-score {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  white-space: nowrap;
}

.founder-inbox-score {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.mission-eval-score.elite {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
}

.mission-eval-score.strong {
  background: rgba(59, 130, 246, 0.14);
  color: #2563eb;
}

.mission-eval-score.watch {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
}

.mission-eval-score.critical {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

.mission-eval-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px 12px 16px;
}

.mission-regression-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px 16px;
}

.mission-regression-chip {
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.mission-regression-chip.ok {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}

.mission-regression-chip.warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
}

.mission-regression-chip.critical {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

.mission-eval-summary-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
}

.mission-eval-summary-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.mission-eval-summary-label {
  margin-top: 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.memory-governance-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 16px 16px;
}

.memory-governance-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-tertiary);
}

.memory-governance-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.memory-governance-title {
  font-weight: 600;
  color: var(--text-primary);
}

.memory-governance-score {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  white-space: nowrap;
}

.memory-governance-desc {
  margin-top: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.memory-governance-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.founder-dispatch-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px 12px 16px;
}

.founder-dispatch-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 16px 16px;
}

.dispatch-timeline-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-tertiary);
}

.dispatch-timeline-item.healthy {
  border-left: 4px solid #10b981;
}

.dispatch-timeline-item.at-risk {
  border-left: 4px solid #f59e0b;
}

.dispatch-timeline-item.breached {
  border-left: 4px solid #ef4444;
}

.dispatch-timeline-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dispatch-timeline-title {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
}

.dispatch-timeline-chip {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  white-space: nowrap;
}

.dispatch-timeline-chip.healthy {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.dispatch-timeline-chip.at-risk {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.dispatch-timeline-chip.breached {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.dispatch-timeline-desc {
  margin-top: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.dispatch-timeline-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dispatch-recommendation-list,
.autopilot-breach-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 16px 16px;
}

.dispatch-recommendation-meta,
.autopilot-meta {
  padding: 0 16px 12px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dispatch-recommendation-item,
.autopilot-breach-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-tertiary);
}

.dispatch-recommendation-item.critical,
.autopilot-breach-item.critical {
  border-left: 4px solid #ef4444;
}

.dispatch-recommendation-item.high,
.autopilot-breach-item.high {
  border-left: 4px solid #f59e0b;
}

.dispatch-recommendation-item.medium,
.autopilot-breach-item.warning {
  border-left: 4px solid #3b82f6;
}

.dispatch-recommendation-top,
.autopilot-breach-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dispatch-recommendation-title,
.autopilot-breach-title {
  font-weight: 600;
  color: var(--text-primary);
}

.dispatch-recommendation-subtitle,
.autopilot-breach-subtitle {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.dispatch-recommendation-reason {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.dispatch-recommendation-footer,
.autopilot-breach-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dispatch-recommendation-footer {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.dispatch-recommendation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dispatch-recommendation-chip,
.autopilot-summary-chip {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.autopilot-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px 12px 16px;
}

.autopilot-summary-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  padding: 10px;
}

.autopilot-summary-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}

.autopilot-summary-label {
  margin-top: 5px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.autopilot-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px 16px;
  flex-wrap: wrap;
}

.control-center-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px 12px 16px;
}

.control-center-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px 12px 16px;
}

.control-center-panel {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  padding: 12px;
}

.control-center-panel-title {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.control-center-switches {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-center-switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.control-center-form-row {
  margin-bottom: 8px;
}

.control-center-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.control-center-actions .btn {
  flex: 1 1 180px;
}

.control-center-output {
  margin-top: 8px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  padding: 8px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  min-height: 64px;
  white-space: pre-wrap;
}

.control-center-observability {
  padding: 0 16px 16px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-command-deck {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 75;
  background: var(--bg-card);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.14);
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
}

.mobile-command-summary {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.mobile-command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-command-actions .btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 130px;
}

/* ============================================
   CHAT
   ============================================ */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0; /* Critical for nested flex scrolling */
}

.chat-message {
  display: flex;
  gap: 14px;
  max-width: 75%;
  animation: messageIn 0.3s var(--ease-out-expo);
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.own {
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-message-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

.chat-message.own .chat-message-content {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-inverted);
}

.chat-message.ai .chat-message-content {
  background: var(--bg-tertiary);
  border-color: var(--accent-subtle);
  border-left: 3px solid var(--accent);
}

.chat-message-text {
  font-size: 0.95rem;
  line-height: 1.6;
}

.chat-message-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
  opacity: 0.8;
}

.chat-message.own .chat-message-meta {
  color: rgba(255, 255, 255, 0.7);
}

.chat-input-container {
  padding: 20px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: none;
  max-height: 150px;
  transition: all var(--transition-fast);
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ============================================
   KANBAN BOARD
   ============================================ */

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  flex: 1;
  min-width: 220px;
  max-width: 300px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

/* Compact variant for boards with many columns (like CRM pipeline) */
.kanban-board.compact .kanban-column,
.kanban-board.pipeline .kanban-column {
  min-width: 160px;
  max-width: 220px;
}

.kanban-board.compact .kanban-card,
.kanban-board.pipeline .kanban-card {
  padding: 10px;
}

.kanban-board.compact .kanban-card-title,
.kanban-board.pipeline .kanban-card-title {
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.kanban-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
}

.kanban-count {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.kanban-cards {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 150px;
  max-height: 60vh;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.kanban-card-title {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.875rem;
  line-height: 1.3;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================
   PRIORITY BADGES
   ============================================ */

.priority {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.priority-low { background: rgba(45, 157, 120, 0.12); color: var(--success); }
.priority-medium { background: rgba(229, 161, 23, 0.12); color: var(--warning); }
.priority-high { background: rgba(220, 74, 74, 0.12); color: var(--error); }
.priority-urgent { background: var(--error); color: white; }

/* ============================================
   STATUS BADGES
   ============================================ */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-online { background: rgba(45, 157, 120, 0.12); color: var(--success); }
.status-online::before { background: var(--success); }

.status-offline { background: var(--bg-tertiary); color: var(--text-muted); }
.status-offline::before { background: var(--text-muted); animation: none; }

.status-away { background: rgba(229, 161, 23, 0.12); color: var(--warning); }
.status-away::before { background: var(--warning); }

/* ============================================
   PIPELINE
   ============================================ */

.pipeline {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
}

.pipeline-stage {
  flex: 1;
  padding: 18px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.pipeline-stage:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.pipeline-stage.active {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-accent);
}

.pipeline-stage-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.pipeline-stage.active .pipeline-stage-name {
  color: rgba(255, 255, 255, 0.85);
}

.pipeline-stage-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

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

.table th,
.table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-tertiary);
}

.table tr:hover td {
  background: var(--bg-tertiary);
}

.table tr:last-child td {
  border-bottom: none;
}

/* ============================================
   CALENDAR
   ============================================ */

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

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.calendar-day-header {
  padding: 14px;
  background: var(--bg-tertiary);
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-day {
  min-height: 110px;
  padding: 10px;
  background: var(--bg-card);
  transition: background-color var(--transition-fast);
}

.calendar-day:hover {
  background: var(--bg-tertiary);
}

.calendar-day.other-month {
  background: var(--bg-secondary);
  opacity: 0.5;
}

.calendar-day.today {
  background: var(--accent-subtle);
}

.calendar-date {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.calendar-day.today .calendar-date {
  color: var(--accent);
}

.calendar-event {
  padding: 4px 8px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--accent);
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   DOCUMENT EDITOR
   ============================================ */

.doc-editor {
  display: flex;
  gap: 24px;
  height: calc(100vh - var(--header-height) - 56px);
}

.doc-sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.doc-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.doc-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 4px;
}

.doc-item:hover {
  background: var(--bg-tertiary);
}

.doc-item.active {
  background: var(--accent);
  color: white;
}

.doc-item-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.doc-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.doc-item.active .doc-item-meta {
  color: rgba(255, 255, 255, 0.75);
}

.doc-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.doc-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.doc-textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  resize: none;
}

.doc-textarea:focus {
  outline: none;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.05);
  position: relative;
}

.modal::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--surface-shine);
  pointer-events: none;
  opacity: 0.3;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-tertiary);
}

/* ============================================
   FORM
   ============================================ */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ============================================
   LOADING
   ============================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: 20px;
  opacity: 0.4;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: toastIn 0.4s var(--ease-spring);
  min-width: 300px;
}

@keyframes toastIn {
  from {
    transform: translateX(100%) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 40px;
}

.login-logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  color: white;
  box-shadow: var(--shadow-accent);
}

.login-logo-text {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 36px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-message {
  text-align: center;
  padding: 16px 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.login-message.success {
  background: rgba(45, 157, 120, 0.12);
  color: var(--success);
}

.login-message.error {
  background: rgba(220, 74, 74, 0.12);
  color: var(--error);
}

/* ============================================
   APP CARDS (Products Section)
   ============================================ */

.app-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.app-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-subtle), transparent);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.app-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.app-card:hover::before {
  opacity: 1;
}

.app-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-sm);
}

.app-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.app-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.app-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
  position: relative;
  z-index: 1;
}

.app-card:hover .app-arrow {
  color: var(--accent);
  transform: translate(4px, -4px);
}

/* ============================================
   RESPONSIVE
   ============================================ */

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

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

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  /* Show mobile menu button */
  #menuBtn {
    display: flex !important;
  }

  .sidebar {
    transform: translateX(-100%);
    z-index: 1001;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  /* Sidebar overlay for mobile */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  .main-content {
    margin-left: 0;
    padding-bottom: 190px;
  }

  .content {
    padding: 16px;
  }

  .grid-4, .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }

  .founder-inbox-stats,
  .mission-eval-summary,
  .founder-dispatch-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .founder-dispatch-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .founder-dispatch-toolbar .input,
  .founder-dispatch-toolbar .select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .founder-inbox-item-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .memory-governance-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .dispatch-timeline-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .dispatch-recommendation-footer,
  .autopilot-breach-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .autopilot-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .control-center-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .control-center-grid {
    grid-template-columns: 1fr;
  }

  .header {
    min-height: var(--header-height);
    height: auto;
    padding: 10px 16px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-left {
    min-width: 0;
    flex: 1;
  }

  .header-right {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-right > .flex {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  .kanban-board {
    flex-direction: column;
  }

  .kanban-column {
    min-width: 100%;
    max-width: 100%;
  }

  .header {
    padding: 10px 16px;
  }

  .header-title {
    font-size: 1.25rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .stat-card {
    padding: 16px;
  }

  /* Better touch targets */
  .btn {
    min-height: 44px;
    padding: 12px 16px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 10px 14px;
  }

  .nav-item {
    padding: 14px 16px;
  }

  /* Activity items */
  .activity-item {
    padding: 14px 16px;
  }

  /* Modal mobile styles */
  .modal-content {
    margin: 16px;
    max-height: calc(100vh - 32px);
    width: calc(100% - 32px);
  }

  /* Calendar mobile */
  .fc-toolbar {
    flex-direction: column;
    gap: 12px;
  }

  .fc-toolbar-chunk {
    width: 100%;
    justify-content: center;
  }

  /* Deal/CRM cards */
  .deal-card,
  .contact-card {
    padding: 14px;
  }

  /* Team presence */
  .team-member {
    padding: 10px 12px;
  }

  /* User profile in sidebar */
  .user-profile {
    padding: 16px;
  }

  .card-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .notification-dropdown {
    width: min(420px, calc(100vw - 24px));
    right: -8px;
    max-height: min(70vh, 460px);
  }

  .global-search {
    width: 100%;
  }

   .mobile-command-deck {
    display: block;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .content {
    padding: 12px;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .card-header h3 {
    font-size: 0.9rem;
  }

  .btn {
    font-size: 0.85rem;
  }

  .header-right .status {
    display: none;
  }

  .founder-inbox-stats,
  .mission-eval-summary,
  .founder-dispatch-stats,
  .autopilot-summary,
  .control-center-stats {
    grid-template-columns: 1fr;
  }

  .mission-regression-chip {
    width: 100%;
  }

  .notification-dropdown {
    width: calc(100vw - 16px);
    right: -10px;
  }

  .table {
    min-width: 620px;
  }

  .mobile-command-actions .btn {
    flex: 1 1 100%;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }

/* ============================================
   NOTIFICATIONS
   ============================================ */

.notification-bell {
  position: relative;
}

.notification-bell button {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.notification-dropdown.open {
  display: block;
  animation: fadeInDown 0.2s var(--ease-out-expo);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.notification-title {
  font-weight: 600;
  color: var(--text-primary);
}

.notification-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

.notification-item:hover {
  background: var(--bg-hover);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item.unread {
  background: rgba(59, 130, 246, 0.05);
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
}

.notification-item {
  position: relative;
  padding-left: 20px;
}

.notification-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.notification-icon.task { background: rgba(234, 179, 8, 0.1); color: #eab308; }
.notification-icon.deal { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.notification-icon.mention { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.notification-icon.approval { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.notification-icon.system { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item-message {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.notification-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.notification-item.high-priority {
  border-left: 3px solid var(--danger, #ef4444);
}

/* ============================================
   GLOBAL SEARCH
   ============================================ */

.global-search {
  position: relative;
  width: 280px;
}

.global-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.global-search-input {
  width: 100%;
  padding: 10px 80px 10px 40px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.global-search-input::placeholder {
  color: var(--text-muted);
}

.global-search-input:focus {
  outline: none;
  background: var(--bg-secondary);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.global-search.open .global-search-input {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.global-search-shortcut {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.global-search-spinner {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.global-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
}

.global-search-results {
  padding: 8px 0;
}

.global-search-empty,
.global-search-error {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.global-search-error {
  color: var(--error);
}

.global-search-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 4px;
  margin-top: 4px;
}

.global-search-group-header:first-child {
  margin-top: 0;
}

.global-search-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.global-search-group-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.global-search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.global-search-result-item:hover,
.global-search-result-item.selected {
  background: var(--bg-hover);
}

.global-search-result-item.selected {
  background: var(--accent-subtle);
}

.global-search-result-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: currentColor;
  background: color-mix(in srgb, currentColor 10%, transparent);
  flex-shrink: 0;
}

.global-search-result-content {
  flex: 1;
  min-width: 0;
}

.global-search-result-title {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-result-snippet {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.global-search-result-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.global-search-view-all {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
}

.global-search-view-all a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.global-search-view-all a:hover {
  text-decoration: underline;
}

.global-search-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  color: var(--text-secondary);
}

.global-search-recent-item:hover {
  background: var(--bg-hover);
}

.global-search-recent-query {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-recent-remove {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.global-search-recent-item:hover .global-search-recent-remove {
  opacity: 1;
}

.global-search-recent-remove:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Suggestion items */
.global-search-suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  color: var(--text-secondary);
}

.global-search-suggestion-item:hover {
  background: var(--bg-tertiary);
}

.global-search-suggestion-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.global-search-suggestion-content {
  flex: 1;
  min-width: 0;
}

.global-search-suggestion-query {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.global-search-suggestion-reason {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive */
@media (max-width: 768px) {
  .global-search {
    width: 200px;
  }

  .global-search-input {
    padding: 8px 40px 8px 36px;
    font-size: 0.85rem;
  }

  .global-search-shortcut {
    display: none;
  }
}

@media (max-width: 480px) {
  .global-search {
    width: 160px;
  }

  .global-search-dropdown {
    position: fixed;
    left: 16px;
    right: 16px;
    width: auto;
    max-height: 60vh;
  }
}
