/* ================================================================
   MindTheGap AI — Operations Dashboard
   Dark admin theme
   ================================================================ */

:root {
  /* Matched to MindTheGap main site (apps/mindthegap/index.html) */
  --navy: #1a2744;
  --navy-deep: #0a0f1a;
  --navy-mid: #1e3055;
  --navy-light: #2d4a7a;
  --gold: #c9985e;
  --gold-light: #dbb478;
  --gold-pale: rgba(201,152,94,0.07);
  --gold-glow: rgba(201,152,94,0.15);
  --teal: #4ecdc4;
  --teal-dark: #0f766e;
  --teal-subtle: rgba(78,205,196,0.06);
  --slate: #8a9bb5;
  --slate-light: #a8b5c8;
  --slate-dark: #5a6a80;
  --parchment: #ede9e3;
  --red: #ef4444;
  --red-dark: #991b1b;
  --amber: #f59e0b;
  --green: #22c55e;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.12);
  --card-bg: rgba(255,255,255,0.04);
  --card-bg-hover: rgba(255,255,255,0.06);
  --surface-glass: rgba(255,255,255,0.03);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.2), 0 16px 40px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.2), 0 24px 60px rgba(0,0,0,0.25);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-heading: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--navy-deep);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ================================================================
   LAYOUT
   ================================================================ */
#ops-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: rgba(10,15,26,0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  gap: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 30px rgba(0,0,0,0.2);
}
#ops-header h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 500;
  color: var(--parchment);
  letter-spacing: -0.01em;
  margin-right: auto;
}
#ops-header h1 .accent {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}
#last-refresh {
  font-size: 12px;
  color: var(--text-muted);
}
#btn-refresh {
  padding: 8px 20px;
  background: var(--gold);
  border: none;
  border-radius: 6px;
  color: var(--navy-deep);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.3s var(--ease);
  letter-spacing: 0.01em;
}
#btn-refresh:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,152,94,0.3);
}
#btn-logout {
  padding: 8px 16px;
  background: none;
  border: 1px solid rgba(201,152,94,0.3);
  border-radius: 6px;
  color: var(--slate-light);
  font-size: 0.8rem;
  font-weight: 400;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.3s var(--ease);
}
#btn-logout:hover {
  color: var(--parchment);
  border-color: rgba(201,152,94,0.5);
}

#ops-sidenav {
  position: fixed;
  top: 56px; left: 0;
  width: 200px;
  bottom: 0;
  background: rgba(10,15,26,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  z-index: 90;
}

#ops-main {
  margin-left: 200px;
  margin-top: 56px;
  padding: 24px;
  max-width: 1400px;
}

/* ================================================================
   NAVIGATION
   ================================================================ */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 24px;
  color: var(--slate);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: all 0.3s var(--ease);
  border-left: 2px solid transparent;
  position: relative;
}
.nav-item.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: var(--gold-pale);
  font-weight: 500;
}
.nav-item:hover:not(.active) {
  color: var(--parchment);
  background: rgba(255,255,255,0.03);
}
.nav-item:not(.active)::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 24px;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 0.3s var(--ease);
}
.nav-item:not(.active):hover::after { width: calc(100% - 48px); }
.nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  flex-shrink: 0;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
}
.nav-item.active .nav-icon { opacity: 1; }
.alert-badge {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  display: none;
}
.alert-badge.visible { display: inline; }

/* ================================================================
   LIVE INDICATOR
   ================================================================ */
.pulse-green {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* ================================================================
   PANELS
   ================================================================ */
.panel { display: none; }
.panel.active { display: block; }
.panel-title {
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 500;
  color: var(--parchment);
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

/* Quick Links Bar */
.quick-links-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.quick-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--slate-light);
  background: rgba(148,163,184,0.08);
  border: 1px solid rgba(148,163,184,0.15);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.quick-link:hover {
  background: rgba(148,163,184,0.15);
  color: var(--parchment);
  border-color: rgba(148,163,184,0.3);
}
.quick-link .ql-icon {
  font-size: 0.9rem;
  line-height: 1;
}

/* Supabase Studio Embed */
.studio-embed-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 120px);
  border-radius: 8px;
  overflow: hidden;
  background: #1c1c1c;
}
.studio-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
}
.studio-frame.loaded { display: block; }
.studio-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.studio-loading.hidden { display: none; }

/* ================================================================
   GRID LAYOUTS
   ================================================================ */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }

/* ================================================================
   METRIC CARDS
   ================================================================ */
.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-glow), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.metric-card:hover {
  background: var(--card-bg-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.metric-card:hover::before { opacity: 1; }
.metric-card .label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.metric-card .value {
  font-size: 32px;
  font-weight: 500;
  margin-top: 6px;
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  color: var(--parchment);
}
.metric-card .sub {
  font-size: 12px;
  color: var(--slate);
  margin-top: 6px;
}
.metric-card .value.green { color: var(--green); }
.metric-card .value.amber { color: var(--amber); }
.metric-card .value.red { color: var(--red); }
.metric-card .value.teal { color: var(--teal); }

/* ================================================================
   STATUS INDICATORS
   ================================================================ */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-dot.up { background: var(--green); }
.status-dot.degraded { background: var(--amber); }
.status-dot.down { background: var(--red); animation: pulse-dot 1.5s infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Service card */
.service-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s var(--ease);
}
.service-card:hover {
  background: var(--card-bg-hover);
  border-color: var(--border-strong);
}
.service-card .service-info { flex: 1; }
.service-card .service-name { font-weight: 500; font-size: 14px; }
.service-card .service-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ================================================================
   DATA TABLE
   ================================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  cursor: default;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text); }
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover { background: var(--navy-light); }
.data-table thead tr:hover { background: none; }
.data-table tr.clickable { cursor: pointer; }

/* ================================================================
   SEVERITY BADGES
   ================================================================ */
.badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}
.badge.critical { background: var(--red-dark); color: #fca5a5; }
.badge.warning { background: #78350f; color: #fbbf24; }
.badge.info { background: #1e3a5f; color: #93c5fd; }
.badge.resolved { background: #064e3b; color: #6ee7b7; }
.badge.hot { background: var(--red-dark); color: #fca5a5; }
.badge.warm { background: #78350f; color: #fbbf24; }
.badge.nurture { background: #1e3a5f; color: #93c5fd; }
.badge.disqualified { background: #374151; color: #9ca3af; }
.badge.unscored { background: #374151; color: #9ca3af; }

/* ================================================================
   CHARTS
   ================================================================ */
.chart-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.3s var(--ease);
}
.chart-container:hover {
  background: var(--card-bg-hover);
  border-color: var(--border-strong);
}
.chart-container h3 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

/* Progress bars */
.progress-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}
.progress-label {
  width: 100px;
  font-size: 13px;
  color: var(--text-muted);
}
.progress-bar-bg {
  flex: 1;
  height: 20px;
  background: var(--navy);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.progress-value {
  width: 80px;
  text-align: right;
  font-size: 13px;
  color: var(--text);
}

/* SVG chart styles */
.chart-svg {
  width: 100%;
  height: auto;
}
.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-area {
  opacity: 0.1;
}
.chart-dot {
  fill: var(--card-bg);
  stroke-width: 2;
}
.chart-gridline {
  stroke: var(--border);
  stroke-width: 0.5;
  stroke-dasharray: 4 4;
}
.chart-axis-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-body);
}
.chart-tooltip {
  position: absolute;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}

/* Bar chart */
.chart-bar {
  transition: opacity 0.15s;
}
.chart-bar:hover {
  opacity: 0.8;
}
.chart-bar-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-body);
  text-anchor: middle;
}

/* ================================================================
   LOGIN FORM
   ================================================================ */
#app-login {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--navy-deep);
  position: relative;
  overflow: hidden;
  /* Subtle noise texture overlay — same SVG fractalNoise pattern as main site hero */
  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)' opacity='0.035'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  background-repeat: repeat;
}
#app-login::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(100px);
  background: rgba(201,152,94,0.08);
  bottom: -20%; left: -5%;
  pointer-events: none;
}
#app-login::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  filter: blur(100px);
  background: rgba(78,205,196,0.05);
  top: -10%; right: -5%;
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 380px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.login-card h2 {
  font-family: var(--font-heading);
  color: var(--parchment);
  margin-bottom: 4px;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}
/* (login-subtitle and input styles moved below button) */
.login-card button {
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: var(--navy-deep);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  transition: all 0.3s var(--ease);
}
.login-card button:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(201,152,94,0.3);
}
.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}
.login-card h2 .accent {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}
.login-subtitle {
  color: var(--slate);
  font-size: 0.84rem;
  margin-bottom: 28px;
  letter-spacing: 0.01em;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  box-sizing: border-box;
  transition: border-color 0.3s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255,255,255,0.06);
}
.login-card input::placeholder {
  color: var(--slate-dark);
}

/* ── MFA Screens ── */
.mfa-label {
  font-family: var(--font-heading);
  color: var(--parchment);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.mfa-code-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.mfa-code-row input {
  flex: 1;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.3rem;
  font-family: var(--font-body);
  letter-spacing: 0.3em;
  text-align: center;
  box-sizing: border-box;
}
.mfa-code-row input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255,255,255,0.06);
}
.mfa-code-row button {
  padding: 12px 20px;
  background: var(--gold);
  color: var(--navy-deep);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font-body);
  transition: all 0.3s var(--ease);
  white-space: nowrap;
}
.mfa-code-row button:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
}
.mfa-qr {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}
.mfa-qr img {
  border-radius: 12px;
  background: white;
  padding: 8px;
}
#mfa-secret {
  font-size: 0.7rem;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  user-select: all;
  word-break: break-all;
}
.btn-link {
  background: none;
  border: none;
  color: var(--slate);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  font-family: var(--font-body);
}
.btn-link:hover { color: var(--text); }

/* ================================================================
   ANALYTICS TOOLBAR & PRODUCT SELECTOR
   ================================================================ */
.analytics-toolbar { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.product-selector { display: flex; gap: 0.25rem; }
.product-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.product-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.product-btn.active { background: var(--teal); color: var(--navy-deep); border-color: var(--teal); font-weight: 600; }
.product-note { margin-bottom: 1rem; padding: 0.75rem 1rem; background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); border-radius: 6px; }

/* ================================================================
   PERIOD SELECTOR
   ================================================================ */
.period-selector {
  display: flex;
  gap: 8px;
}
.period-btn {
  padding: 6px 16px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
}
.period-btn.active {
  background: var(--gold);
  color: var(--navy-deep);
  border-color: var(--gold);
  font-weight: 600;
}
.period-btn:hover:not(.active) {
  color: var(--text);
  background: var(--border);
}

/* ================================================================
   TAB BAR
   ================================================================ */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  padding: 8px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
}
.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.tab-btn:hover:not(.active) {
  color: var(--text);
}

/* ================================================================
   SEARCH & TOOLBAR
   ================================================================ */
.users-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.search-input {
  flex: 1;
  max-width: 400px;
  padding: 8px 12px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
}
.search-input:focus {
  outline: none;
  border-color: var(--gold);
}
.user-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ================================================================
   PAGINATION
   ================================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.page-btn {
  padding: 6px 12px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-body);
}
.page-btn.active {
  background: var(--gold);
  color: var(--navy-deep);
  border-color: var(--gold);
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ================================================================
   USER DETAIL DRAWER
   ================================================================ */
.drawer {
  position: fixed;
  top: 56px;
  right: 0;
  width: 420px;
  bottom: 0;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  z-index: 110;
  overflow-y: auto;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.3);
  animation: slide-in 0.2s ease;
}
@keyframes slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-header h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--gold);
}
.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.drawer-close:hover { color: var(--text); }
#drawer-content {
  padding: 20px;
}
#drawer-content .data-table {
  margin-top: 16px;
}
.drawer-section {
  margin-bottom: 24px;
}
.drawer-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ================================================================
   CRITICAL ALERT BANNER
   ================================================================ */
.critical-banner {
  position: fixed;
  top: 56px;
  left: 200px;
  right: 0;
  background: var(--red-dark);
  color: #fca5a5;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
  z-index: 95;
  border-bottom: 1px solid var(--red);
}
.critical-banner ~ #ops-main {
  margin-top: 96px;
}

/* ================================================================
   RESOLVE BUTTON
   ================================================================ */
.btn-resolve {
  padding: 4px 10px;
  background: var(--teal-dark);
  border: none;
  border-radius: 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn-resolve:hover {
  background: var(--teal);
  color: var(--navy-deep);
}

/* ================================================================
   PROSPECTS — PIPELINE KANBAN
   ================================================================ */
.pipeline-container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
}
.pipeline-column {
  min-width: 200px;
  max-width: 220px;
  flex-shrink: 0;
}
.pipeline-column-header {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pipeline-column-count {
  background: var(--navy-light);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.pipeline-column-cards {
  max-height: 520px;
  overflow-y: auto;
}
.pipeline-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  position: relative;
}
.pipeline-card:hover {
  background: var(--card-bg-hover);
  border-color: var(--border-strong);
}
.pipeline-card-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--parchment);
  margin-bottom: 2px;
}
.pipeline-card-company {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.pipeline-card-meta {
  font-size: 11px;
  color: var(--slate);
  margin-top: 6px;
}
.pipeline-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.pipeline-card-days {
  font-size: 10px;
  color: var(--text-muted);
}
.pipeline-card-actions {
  display: flex;
  gap: 4px;
}
.pipeline-card-actions button {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: none;
  color: var(--slate);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.pipeline-card-actions button:hover {
  color: var(--gold);
  border-color: var(--gold);
}
.pipeline-show-all {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  color: var(--slate);
  cursor: pointer;
}
.pipeline-show-all:hover { color: var(--gold); }

/* ================================================================
   PROSPECTS — SUB-VIEWS
   ================================================================ */
.prospects-subview { display: none; }
.prospects-subview.active { display: block; }

/* ================================================================
   PROSPECTS — TOOLBAR & FILTERS
   ================================================================ */
.prospects-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-select {
  padding: 8px 12px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
}
.filter-select:focus {
  outline: none;
  border-color: var(--gold);
}

/* ================================================================
   PROSPECTS — TIER DOTS
   ================================================================ */
.tier-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  flex-shrink: 0;
}
.tier-dot.hot { background: var(--red); }
.tier-dot.warm { background: var(--amber); }
.tier-dot.nurture { background: var(--teal); }
.tier-dot.disqualified { background: var(--slate-dark); }
.tier-dot.unscored { background: var(--slate); }

/* ================================================================
   PROSPECTS — STAGE BADGES
   ================================================================ */
.badge.new { background: #1e3a5f; color: #93c5fd; }
.badge.contacted { background: #1e3a5f; color: #93c5fd; }
.badge.engaged { background: #065f46; color: #6ee7b7; }
.badge.call_scheduled { background: #78350f; color: #fbbf24; }
.badge.proposal { background: #581c87; color: #c084fc; }
.badge.won { background: #064e3b; color: #6ee7b7; }
.badge.lost { background: var(--red-dark); color: #fca5a5; }

/* ================================================================
   PROSPECTS — TIMELINE
   ================================================================ */
.timeline { list-style: none; padding: 0; }
.timeline-item {
  position: relative;
  padding: 12px 0 12px 24px;
  border-left: 2px solid var(--border);
  font-size: 13px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}
.timeline-item .timeline-date {
  color: var(--text-muted);
  font-size: 11px;
}
.timeline-item .timeline-body {
  margin-top: 2px;
}

/* ================================================================
   PROSPECTS — QUICK ACTIONS
   ================================================================ */
.quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.btn-action {
  padding: 6px 14px;
  background: none;
  border: 1px solid rgba(201,152,94,0.3);
  border-radius: 6px;
  color: var(--slate-light);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.3s var(--ease);
}
.btn-action:hover {
  color: var(--parchment);
  border-color: rgba(201,152,94,0.5);
}

/* ================================================================
   PROSPECTS — INLINE FORMS
   ================================================================ */
.inline-form {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.inline-form textarea {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}
.inline-form textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.inline-form select {
  padding: 6px 10px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
}
.inline-form .form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  align-items: center;
}
.inline-form .btn-submit {
  padding: 6px 16px;
  background: var(--gold);
  border: none;
  border-radius: 6px;
  color: var(--navy-deep);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
}
.inline-form .btn-cancel {
  padding: 6px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
}

/* ================================================================
   PROSPECTS — TAGS
   ================================================================ */
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  padding: 2px 10px;
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ================================================================
   PROSPECTS — DRAWER (wider)
   ================================================================ */
#prospect-drawer { width: 480px; }
#prospect-drawer-content { padding: 20px; }

/* ================================================================
   PROSPECTS — ANALYTICS FUNNEL
   ================================================================ */
.funnel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.funnel-label {
  width: 110px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}
.funnel-bar-bg {
  flex: 1;
  height: 26px;
  background: var(--navy);
  border-radius: 4px;
  overflow: hidden;
}
.funnel-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.5s var(--ease);
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 12px;
  color: var(--navy-deep);
  font-weight: 600;
  min-width: 32px;
}
.funnel-value {
  width: 50px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.heatmap-cell {
  padding: 6px 10px;
  border-radius: 3px;
  text-align: center;
  font-size: 12px;
}

/* ================================================================
   CSV EXPORT BUTTON
   ================================================================ */
.btn-export {
  padding: 6px 14px;
  background: var(--gold);
  border: none;
  border-radius: 6px;
  color: var(--navy-deep);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s var(--ease);
  margin-left: auto;
}
.btn-export:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,152,94,0.3);
}

/* ================================================================
   UNDO BANNER (stage change confirmation)
   ================================================================ */
.undo-banner {
  background: rgba(78,205,196,0.1);
  border: 1px solid rgba(78,205,196,0.2);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slide-down 0.2s var(--ease);
}
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.btn-undo {
  padding: 4px 12px;
  background: rgba(78,205,196,0.15);
  border: 1px solid rgba(78,205,196,0.3);
  border-radius: 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
}
.btn-undo:hover {
  background: rgba(78,205,196,0.25);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  #ops-sidenav { width: 60px; }
  #ops-main { margin-left: 60px; }
  .nav-label { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .critical-banner { left: 60px; }
  /* Pipeline kanban horizontal scroll */
  .pipeline-container { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .pipeline-column { min-width: 220px; flex-shrink: 0; }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
  #prospect-drawer { width: 100%; }
  /* Pipeline vertical stack on mobile */
  .pipeline-container { flex-direction: column; }
  .pipeline-column { min-width: auto; }
}

/* ================================================================
   SERVICES PANEL
   ================================================================ */
.services-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* Services registry */
.service-category { margin-bottom: 1.5rem; }
.service-category h3 { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.service-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.service-row:hover { background: rgba(255,255,255,0.03); }
.service-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.service-status.up { background: #2ecc71; }
.service-status.degraded { background: #f39c12; }
.service-status.down { background: #e74c3c; }
.service-status.unknown { background: #666; }
.service-name { flex: 1; font-size: 0.85rem; min-width: 0; }
.service-name a { color: var(--text-primary); text-decoration: none; }
.service-name a:hover { color: var(--teal); }
.service-name .svc-badges { margin-top: 3px; }
.service-meta { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.service-notes { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.service-cost { font-size: 0.8rem; color: var(--teal); min-width: 60px; text-align: right; }
.service-expiry-warn { color: #f39c12; font-size: 0.75rem; white-space: nowrap; }
.service-dash-link { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; padding: 2px 4px; }
.service-dash-link:hover { color: var(--teal); }
.btn-service-check { background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 4px; padding: 2px 6px; font-size: 0.75rem; cursor: pointer; transition: all 0.2s; }
.btn-service-check:hover { border-color: #2ecc71; color: #2ecc71; }
.services-total { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid rgba(255,255,255,0.1); font-weight: 600; text-align: right; font-size: 0.9rem; }

.svc-badges {
  display: flex;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.svc-badge-product {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── Command Center ──────────────────────────────────────────── */
.activity-feed { max-height: 400px; overflow-y: auto; }
.feed-item { padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.85rem; line-height: 1.4; }
.feed-time { color: var(--text-muted); font-size: 0.75rem; min-width: 3rem; display: inline-block; }
.feed-item .badge { font-size: 0.65rem; padding: 0.1rem 0.4rem; margin: 0 0.3rem; }
.badge.veracita { background: var(--teal); }
.badge.oraclea { background: var(--gold); color: var(--navy-deep); }
.badge.platform { background: rgba(255,255,255,0.15); }
.badge.live { background: var(--teal); }
.badge.development { background: var(--gold); color: var(--navy-deep); }
.badge.planned { background: rgba(255,255,255,0.1); }
.progress-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.progress-label { font-size: 0.8rem; min-width: 120px; color: var(--text-muted); }
.progress-bar-bg { flex: 1; height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--gold); border-radius: 4px; transition: width 0.3s ease; }
.progress-value { font-size: 0.8rem; min-width: 3rem; text-align: right; color: var(--text-light); }

/* ── Loading & Error States ──────────────────────────────────── */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.loading::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--text-muted);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error {
  text-align: center;
  padding: 3rem;
  color: var(--gold);
  font-size: 0.875rem;
}
.error button {
  margin-top: 1rem;
  background: var(--gold);
  color: var(--bg-main);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ── Alert Severity Styling ────────────────────────────────── */
.alerts-table tr[data-severity="critical"] { border-left: 3px solid #e74c3c; }
.alerts-table tr[data-severity="warning"] { border-left: 3px solid #f39c12; }
.alerts-table tr[data-severity="info"] { border-left: 3px solid #3498db; }
.alerts-table tr.auto-resolved td { opacity: 0.6; }
.alerts-table .resolution-note { font-size: 0.75rem; color: var(--text-muted); font-style: italic; margin-top: 0.25rem; }

/* ── User Communication ───────────────────────────────────── */
.drawer-actions { display: flex; gap: 0.5rem; margin: 1rem 0; }
.drawer-actions .btn-action { flex: 1; }
.inline-form { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 0.5rem; padding: 0.75rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.inline-form select, .inline-form .form-input { background: var(--bg-main); border: 1px solid rgba(255,255,255,0.1); color: var(--text-primary); padding: 0.5rem; border-radius: 0.375rem; font-size: 0.8125rem; width: 100%; }
.inline-form textarea.form-input, .inline-form textarea.search-input { resize: vertical; font-family: inherit; }
.inline-form-buttons { display: flex; gap: 0.5rem; }
.inline-form-buttons .btn-action { font-size: 0.8125rem; padding: 0.4rem 0.75rem; }
.inline-form-buttons .btn-action.secondary { background: transparent; border: 1px solid rgba(255,255,255,0.15); }
.comm-item { padding: 0.4rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.8rem; }

/* ── Tags ─────────────────────────────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.5rem; border-radius: 12px;
  font-size: 0.75rem; background: rgba(0,210,190,0.15); color: var(--teal);
  border: 1px solid rgba(0,210,190,0.3);
}
.tag-chip .tag-remove {
  background: none; border: none; color: inherit; cursor: pointer;
  font-size: 0.9rem; padding: 0; line-height: 1;
}
.tag-add select { font-size: 0.8rem; background: var(--navy-mid); border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted); border-radius: 4px; padding: 0.3rem; }
.tag-cell .tag-chip { font-size: 0.65rem; padding: 0.1rem 0.4rem; }

/* ── Notes ────────────────────────────────────────────────── */
.note-item { padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.note-meta { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.note-text { font-size: 0.8rem; color: var(--text-primary); white-space: pre-wrap; }
.note-add { margin-bottom: 0.75rem; }
.note-add textarea { width: 100%; margin-bottom: 0.3rem; }

/* ── Real-Time Feed ───────────────────────────────────────── */
.feed-item.feed-error { border-left: 2px solid var(--red, #e74c3c); padding-left: 0.5rem; }
.feed-item.feed-success { border-left: 2px solid var(--teal); padding-left: 0.5rem; }

/* Live indicator flash */
.pulse-green.flash {
  animation: flash-pulse 0.5s ease-out;
}
@keyframes flash-pulse {
  0% { box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.7); }
  100% { box-shadow: 0 0 0 8px rgba(78, 205, 196, 0); }
}

/* Feed item entrance animation */
.feed-item {
  animation: feed-slide-in 0.3s ease-out;
}
@keyframes feed-slide-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Search Engine Deep Dive ────────────────────────────────── */
.backend-detail h2 { margin: 0.5rem 0 1rem; }
.backend-detail h3 { margin: 1.5rem 0 0.75rem; font-size: 0.9rem; color: var(--text-muted); }
.btn-back {
  background: none; border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted);
  padding: 0.4rem 0.8rem; border-radius: 4px; cursor: pointer; font-size: 0.8rem;
  margin-bottom: 0.5rem; font-family: var(--font-body); transition: all 0.2s;
}
.btn-back:hover { color: var(--parchment); border-color: var(--teal); }
.error-dist { display: flex; flex-direction: column; gap: 0.4rem; }
.error-bar { display: flex; align-items: center; gap: 0.5rem; }
.error-label { width: 100px; font-size: 0.8rem; color: var(--text-muted); text-align: right; flex-shrink: 0; }
.error-bar-fill { height: 16px; background: var(--teal); border-radius: 2px; min-width: 2px; transition: width 0.3s; }
.error-count { font-size: 0.75rem; color: var(--text-muted); }
.row-error { background: rgba(231, 76, 60, 0.1); }
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-error { color: #e74c3c; }
.sample-queries { font-size: 0.8rem; color: var(--text-muted); padding-left: 1.2rem; }
.sample-queries li { padding: 0.2rem 0; }
.search-backends-table tbody tr { cursor: pointer; transition: background 0.2s; }
.search-backends-table tbody tr:hover { background: rgba(255,255,255,0.05); }

/* ── Audit Log ─────────────────────────────────────────────── */
.audit-toolbar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.audit-toolbar .search-input { flex: 1; min-width: 200px; }
.audit-toolbar select { font-size: 0.8rem; }
.audit-count { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.audit-table { font-size: 0.8rem; }
.audit-table .audit-message { max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-table .nowrap { white-space: nowrap; }
.audit-table a { color: var(--teal); text-decoration: none; }
.audit-table a:hover { text-decoration: underline; }
.text-warn { color: #f39c12; }
.audit-pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; }
.audit-pagination button { padding: 0.4rem 0.8rem; background: var(--navy-light); color: var(--text-primary); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; cursor: pointer; font-size: 0.8rem; }
.audit-pagination button:hover { border-color: var(--teal); }

/* Session timeline modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: var(--navy-mid); border-radius: 12px; padding: 1.5rem;
  max-width: 700px; width: 90%; max-height: 80vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.modal-close:hover { color: var(--parchment); }
.session-meta { display: flex; gap: 1.5rem; margin-bottom: 1rem; font-size: 0.8rem; color: var(--text-muted); flex-wrap: wrap; }
.session-timeline { position: relative; padding-left: 2rem; }
.session-timeline::before { content: ''; position: absolute; left: 0.9rem; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.1); }
.timeline-event { display: flex; gap: 0.75rem; margin-bottom: 0.75rem; position: relative; }
.timeline-dot { font-size: 0.9rem; z-index: 1; }
.timeline-content { flex: 1; }
.timeline-time { font-size: 0.7rem; color: var(--text-muted); }
.timeline-message { font-size: 0.8rem; color: var(--text-primary); }
.timeline-cat { font-size: 0.7rem; color: var(--text-muted); }

/* ── Cohort Analysis ──────────────────────────────────────── */
.cohort-table .cohort-cell { text-align: center; font-size: 0.75rem; font-weight: 600; min-width: 45px; }
.cohort-bars { display: flex; flex-direction: column; gap: 0.3rem; }
.cohort-bar-row { display: flex; align-items: center; gap: 0.5rem; }
.cohort-label { width: 100px; font-size: 0.8rem; color: var(--text-muted); text-align: right; }
.cohort-bar { flex: 1; height: 18px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.cohort-bar-fill { height: 100%; background: var(--teal); border-radius: 3px; transition: width 0.3s; }
.cohort-value { width: 80px; font-size: 0.8rem; color: var(--text-primary); }

/* ── CSV Import ─────────────────────────────────────────────── */
.import-result { color: var(--teal); font-size: 0.85rem; margin-top: 0.5rem; }

/* ── Cost Optimization ──────────────────────────────────────── */
.recommendations { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.rec-card { padding: 0.75rem 1rem; border-radius: 8px; background: rgba(255,255,255,0.03); border-left: 3px solid rgba(255,255,255,0.2); }
.rec-card.rec-high { border-left-color: #e74c3c; }
.rec-card.rec-medium { border-left-color: #f39c12; }
.rec-card.rec-low { border-left-color: #3498db; }
.rec-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.rec-type { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.rec-title { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 0.2rem; }
.rec-detail { font-size: 0.8rem; color: var(--text-muted); }
.rec-savings { font-size: 0.8rem; color: var(--teal); margin-top: 0.3rem; font-weight: 600; }
.hourly-heatmap { display: flex; gap: 2px; margin-bottom: 1.5rem; }
.hour-cell { flex: 1; text-align: center; padding: 0.4rem 0; border-radius: 3px; font-size: 0.65rem; color: var(--text-muted); min-width: 20px; cursor: default; }

/* ── Health Donut ─────────────────────────────────────────── */
.health-donut-container { margin: 1.5rem 0; }
.health-donut-container h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.health-donut-wrapper { display: flex; align-items: center; gap: 1.5rem; }
.health-legend { display: flex; flex-direction: column; gap: 0.3rem; }
.health-legend-item { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; }
.health-legend-item:hover { color: var(--text-primary); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.health-legend-item strong { color: var(--text-primary); }

/* Health indicators in users table */
.health-indicator { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; font-size: 0.65rem; font-weight: 700; margin-left: 0.3rem; }
.health-indicator.at-risk { background: rgba(243,156,18,0.2); color: #f39c12; }
.health-indicator.churning { background: rgba(231,76,60,0.2); color: #e74c3c; }

/* Filter badge */
.filter-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.6rem; border-radius: 12px;
  background: rgba(0,210,190,0.15); color: var(--teal);
  font-size: 0.75rem; margin-left: 0.5rem;
}
.filter-badge button { background: none; border: none; color: inherit; cursor: pointer; font-size: 0.9rem; }
