/* ============================================================
   FK-NUDGE — Flipkart AI Nudge Platform
   Design System & Complete Stylesheet
   Light Mode · Flipkart Brand Colors
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap");
.invisible {
  visibility: hidden;
}

/* ── CSS Variables / Design Tokens ── */
:root {
  /* Flipkart Brand */
  --fk-blue: #2874f0;
  --fk-blue-hover: #1a5dc8;
  --fk-blue-light: #e8f0fe;
  --fk-blue-lighter: #f0f5ff;
  --fk-blue-10: rgba(40, 116, 240, 0.1);
  --fk-blue-20: rgba(40, 116, 240, 0.2);
  --fk-yellow: #ffe500;
  --fk-yellow-warm: #ffc200;
  --fk-yellow-light: #fff8d6;
  --fk-orange: #ff9f00;

  /* Surfaces */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-sidebar-active: #f1f5f9;
  --bg-sidebar-hover: #f8fafc;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-inverse: #ffffff;
  --text-link: #2874f0;

  /* Status */
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --info: #2874f0;
  --info-bg: #eff6ff;

  /* Borders */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #2874f0;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.02);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-card-hover:
    0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-blue-glow: 0 4px 14px rgba(40, 116, 240, 0.2);

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

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}
.login-overlay.hidden {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}
.login-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 25%, var(--fk-blue-10) 0%, transparent 45%),
    radial-gradient(
      circle at 85% 75%,
      rgba(255, 229, 0, 0.15) 0%,
      transparent 45%
    ),
    radial-gradient(circle at 50% 80%, var(--fk-blue-10) 0%, transparent 50%);
  animation: loginBgShift 15s ease-in-out infinite alternate;
}
@keyframes loginBgShift {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}
.login-card {
  position: relative;
  width: 400px;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 40px 36px 32px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  animation: loginCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.login-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  margin: 0 auto 12px;
  object-fit: contain;
}
.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.login-subtitle {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}
.login-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: all 0.2s;
  font-family: inherit;
}
.login-input:focus {
  outline: none;
  border-color: var(--fk-blue);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px var(--fk-blue-10);
}
.login-input::placeholder {
  color: var(--text-tertiary);
}
.login-error {
  font-size: 0.76rem;
  color: var(--danger);
  min-height: 18px;
  text-align: center;
  font-weight: 500;
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}
.login-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}
.login-demo-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 14px;
  background: var(--info-bg);
  border: 1px solid var(--fk-blue-10);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--fk-blue-hover);
}
.login-demo-hint strong {
  font-weight: 700;
  color: var(--fk-blue);
}
.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 0.3px;
}
@keyframes loginShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}
input,
select,
textarea {
  font-family: inherit;
}
ul,
ol {
  list-style: none;
}
img {
  max-width: 100%;
  display: block;
}

/* ── App Shell ── */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  min-height: var(--header-height);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  padding: 3px;
  border: 1px solid var(--border-light);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.sidebar-brand-tag {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--fk-yellow);
  border-radius: 0 4px 4px 0;
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.nav-item-badge {
  margin-left: auto;
  background: var(--fk-yellow);
  color: var(--text-primary);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: var(--bg-sidebar-hover);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--fk-yellow), var(--fk-orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-inverse);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

/* ── Main Content Area ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Top Header ── */
.top-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-7);
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.header-breadcrumb span.active {
  color: var(--fk-blue);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  width: 280px;
  transition: all var(--transition-fast);
}

.header-search:focus-within {
  border-color: var(--fk-blue);
  box-shadow: 0 0 0 3px var(--fk-blue-10);
  background: var(--bg-primary);
}

.header-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 100%;
}

.header-search input::placeholder {
  color: var(--text-tertiary);
}

.header-search-icon {
  color: var(--text-tertiary);
  font-size: 1rem;
  flex-shrink: 0;
}

.header-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
  font-size: 1.15rem;
}

.header-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.header-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-primary);
}

.header-env-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(38, 162, 105, 0.2);
}

.header-env-badge .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.3);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Content Area ── */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-7);
}

.content-area::-webkit-scrollbar {
  width: 6px;
}
.content-area::-webkit-scrollbar-track {
  background: transparent;
}
.content-area::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 10px;
}

/* ── Page Containers ── */
.page {
  display: none;
  animation: fadeSlideIn 0.35s ease-out;
}
.page.active {
  display: block;
}

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

/* ── Stat Cards Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-7);
}

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

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.stat-card.blue::before {
  background: var(--fk-blue);
}
.stat-card.yellow::before {
  background: var(--fk-yellow-warm);
}
.stat-card.green::before {
  background: var(--success);
}
.stat-card.orange::before {
  background: var(--fk-orange);
}

.stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-card.blue .stat-card-icon {
  background: var(--fk-blue-light);
  color: var(--fk-blue);
}
.stat-card.yellow .stat-card-icon {
  background: var(--fk-yellow-light);
  color: var(--fk-yellow-warm);
}
.stat-card.green .stat-card-icon {
  background: var(--success-bg);
  color: var(--success);
}
.stat-card.orange .stat-card-icon {
  background: #fff7ed;
  color: var(--fk-orange);
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-card-change.up {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card-change.down {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: var(--space-1);
}

.stat-card-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Section ── */
.section {
  margin-bottom: var(--space-7);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.section-subtitle {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Grid Layouts ── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-5);
}

.grid-1-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-5);
}

/* ── Card ── */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-5) var(--space-6);
}

.card-body-flush {
  padding: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--fk-blue);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--fk-blue-hover);
  box-shadow: var(--shadow-blue-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
}

.btn-ghost {
  color: var(--fk-blue);
  padding: var(--space-2) var(--space-3);
}

.btn-ghost:hover {
  background: var(--fk-blue-light);
}

.btn-success {
  background: var(--success);
  color: var(--text-inverse);
}

.btn-success:hover {
  background: #1f8c57;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
}

.btn-danger:hover {
  background: #c82333;
  transform: translateY(-1px);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: 0.92rem;
}

/* ── Tags / Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue {
  background: var(--fk-blue-light);
  color: var(--fk-blue);
}
.badge-green {
  background: var(--success-bg);
  color: var(--success);
}
.badge-yellow {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge-red {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge-gray {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.badge-orange {
  background: #fff7ed;
  color: var(--fk-orange);
}

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  background: transparent;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-medium);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

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

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

/* ── Activity Feed / Timeline ── */
.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  position: relative;
  transition: background var(--transition-fast);
  border-radius: var(--radius-sm);
}

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

.activity-item::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 36px;
  bottom: -4px;
  width: 1.5px;
  background: var(--border-light);
}

.activity-item:last-child::before {
  display: none;
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 0 2px var(--fk-blue);
  background: var(--fk-blue);
  z-index: 1;
}

.activity-dot.green {
  box-shadow: 0 0 0 2px var(--success);
  background: var(--success);
}

.activity-dot.yellow {
  box-shadow: 0 0 0 2px var(--fk-yellow-warm);
  background: var(--fk-yellow-warm);
}

.activity-dot.red {
  box-shadow: 0 0 0 2px var(--danger);
  background: var(--danger);
}

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

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

.activity-text strong {
  font-weight: 600;
  color: var(--fk-blue);
}

.activity-time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ── Chart Container ── */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Autonomy Tier Indicators ── */
.tier-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tier-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tier-dot.auto {
  background: var(--success);
}
.tier-dot.notify {
  background: var(--fk-blue);
}
.tier-dot.approval {
  background: var(--fk-yellow-warm);
}
.tier-dot.blocked {
  background: var(--danger);
}

.tier-label {
  font-size: 0.78rem;
  font-weight: 500;
}

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s ease-out;
  background: var(--fk-blue);
}

.progress-bar-fill.green {
  background: var(--success);
}
.progress-bar-fill.yellow {
  background: var(--fk-yellow-warm);
}
.progress-bar-fill.orange {
  background: var(--fk-orange);
}
.progress-bar-fill.red {
  background: var(--danger);
}

/* ── Persona Cards ── */
.persona-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: var(--space-5);
  transition: all var(--transition-normal);
  cursor: default;
}

.persona-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.persona-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.persona-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.persona-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.persona-stage {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.persona-scores {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.persona-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.persona-score-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 80px;
}

.persona-score-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.persona-score-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.persona-score-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 32px;
  text-align: right;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 3px;
}

.tab-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer !important;
  pointer-events: auto !important;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

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

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

.modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 560px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: all var(--transition-spring);
}

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

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

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

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

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ── Donut chart ── */
.donut-chart-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) 0;
}

.donut-chart {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-width: 70px;
}

.donut-legend-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Compliance Checklist ── */
.compliance-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.compliance-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
}

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

.compliance-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.compliance-icon.pass {
  background: var(--success-bg);
  color: var(--success);
}
.compliance-icon.fail {
  background: var(--danger-bg);
  color: var(--danger);
}
.compliance-icon.warn {
  background: var(--warning-bg);
  color: var(--warning);
}

.compliance-text {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
}

.compliance-status {
  font-size: 0.72rem;
  font-weight: 600;
}

/* ── Metric sparkline inline ── */
.metric-inline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}

.metric-inline:last-child {
  border-bottom: none;
}

.metric-inline-label {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.metric-inline-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 60px;
  text-align: right;
}

.metric-inline-sparkline {
  width: 60px;
  height: 24px;
}

/* ── Experiment Row ── */
.experiment-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.experiment-card:last-child {
  border-bottom: none;
}
.experiment-card:hover {
  background: var(--bg-tertiary);
}

.experiment-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.experiment-status-dot.running {
  background: var(--success);
  animation: pulse 2s infinite;
}
.experiment-status-dot.paused {
  background: var(--fk-yellow-warm);
}
.experiment-status-dot.completed {
  background: var(--fk-blue);
}

.experiment-info {
  flex: 1;
  min-width: 0;
}

.experiment-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.experiment-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.experiment-metrics {
  display: flex;
  gap: var(--space-5);
}

.experiment-metric {
  text-align: center;
}

.experiment-metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.experiment-metric-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Channel bars ── */
.channel-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.channel-bar-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 70px;
}

.channel-bar-track {
  flex: 1;
  height: 22px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.channel-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  padding: 0 var(--space-2);
}

.channel-bar-fill span {
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}

.channel-bar-value {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 40px;
  text-align: right;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  max-width: 320px;
}

/* ── Forms ── */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--fk-blue);
  box-shadow: 0 0 0 3px var(--fk-blue-10);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235a5a72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

/* ── Tooltip ── */
.tooltip-wrapper {
  position: relative;
}

.tooltip-wrapper:hover .tooltip-text {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tooltip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 500;
  pointer-events: none;
}

/* ── Skeleton Loader ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    #e8e8ed 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ── Scroll Thin ── */
.scroll-thin::-webkit-scrollbar {
  width: 4px;
}
.scroll-thin::-webkit-scrollbar-track {
  background: transparent;
}
.scroll-thin::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 10px;
}

/* ── Count Up Animation ── */
.count-up {
  display: inline-block;
}

/* ── Toggle ── */
.toggle {
  width: 40px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--border-medium);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle.active {
  background: var(--fk-blue);
}

.toggle::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.toggle.active::after {
  transform: translateX(18px);
}

/* ── Responsive ── */
@media (max-width: 1400px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    z-index: 200;
    transition: left var(--transition-normal);
  }
  .sidebar.open {
    left: 0;
  }
  .header-search {
    display: none;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ── Animations Utility ── */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-up {
  animation: slideUp 0.4s ease-out;
}

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

/* ── Staggered Children ── */
.stagger-children > * {
  opacity: 0;
  animation: fadeSlideIn 0.4s ease-out forwards;
}

.stagger-children > *:nth-child(1) {
  animation-delay: 0.05s;
}
.stagger-children > *:nth-child(2) {
  animation-delay: 0.1s;
}
.stagger-children > *:nth-child(3) {
  animation-delay: 0.15s;
}
.stagger-children > *:nth-child(4) {
  animation-delay: 0.2s;
}
.stagger-children > *:nth-child(5) {
  animation-delay: 0.25s;
}
.stagger-children > *:nth-child(6) {
  animation-delay: 0.3s;
}

/* ── Flip Card for Cohort ── */
.cohort-mini {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  transition: all var(--transition-fast);
}

.cohort-mini:hover {
  border-color: var(--fk-blue-20);
  background: var(--fk-blue-lighter);
}

.cohort-mini-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.cohort-mini-info {
  flex: 1;
  min-width: 0;
}

.cohort-mini-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cohort-mini-count {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.cohort-mini-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--fk-blue);
}

/* ── Heatmap Grid ── */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  transition: transform var(--transition-fast);
  cursor: default;
}

.heatmap-cell:hover {
  transform: scale(1.3);
  z-index: 1;
}

.heatmap-label {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  text-align: center;
  padding-top: 2px;
}

/* ── Floating Action Button ── */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--fk-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: var(--shadow-blue-glow);
  z-index: 90;
  transition: all var(--transition-normal);
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(40, 116, 240, 0.4);
}

/* ── Utility ── */
.text-blue {
  color: var(--fk-blue) !important;
}
.text-green {
  color: var(--success) !important;
}
.text-red {
  color: var(--danger) !important;
}
.text-yellow {
  color: var(--fk-yellow-warm) !important;
}
.text-muted {
  color: var(--text-tertiary) !important;
}
.text-sm {
  font-size: 0.78rem !important;
}
.text-xs {
  font-size: 0.68rem !important;
}
.fw-600 {
  font-weight: 600 !important;
}
.fw-700 {
  font-weight: 700 !important;
}
.mt-2 {
  margin-top: var(--space-2);
}
.mt-4 {
  margin-top: var(--space-4);
}
.mb-4 {
  margin-bottom: var(--space-4);
}
.gap-2 {
  gap: var(--space-2);
}
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item-icon svg {
  width: 100%;
  height: 100%;
}
.stat-card-icon svg {
  width: 60%;
  height: 60%;
}

/* ── Tooltip Fixes ── */
.tooltip-wrapper {
  position: relative;
}

.tooltip-wrapper::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 10px;
  display: block;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
  z-index: 1000;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

.tooltip-wrapper:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ── Chart Tooltip ── */
.chart-tooltip {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  box-shadow: var(--shadow-lg);
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 9999;
  transition:
    opacity 0.2s ease,
    transform 0.1s ease-out;
  opacity: 0;
}

.chart-tooltip .ct-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chart-tooltip .ct-value {
  color: var(--text-secondary);
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  border: 1px solid var(--border-light);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  background: var(--success-bg);
  color: var(--success);
}
.toast.info .toast-icon {
  background: var(--info-bg);
  color: var(--info);
}
.toast.error .toast-icon {
  background: var(--danger-bg);
  color: var(--danger);
}
.toast.warning .toast-icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.toast-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   NEW FEATURES: Agent Controls, Temperature, Observability
   ═══════════════════════════════════════════════════════════════ */

/* ── Temperature Card Variants ── */
.stat-card.temp-hot::before {
  background: linear-gradient(90deg, #ef4444, #f97316);
}
.stat-card.temp-hot .stat-card-icon {
  background: #fef2f2;
  color: #ef4444;
}
.stat-card.temp-warm::before {
  background: linear-gradient(90deg, #f59e0b, #eab308);
}
.stat-card.temp-warm .stat-card-icon {
  background: #fffbeb;
  color: #f59e0b;
}
.stat-card.temp-cold::before {
  background: linear-gradient(90deg, #3b82f6, #6366f1);
}
.stat-card.temp-cold .stat-card-icon {
  background: #eff6ff;
  color: #3b82f6;
}

/* ── Temperature Badges ── */
.temp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.temp-badge.hot {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  color: #dc2626;
  border: 1px solid #fecaca;
}
.temp-badge.warm {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #d97706;
  border: 1px solid #fde68a;
}
.temp-badge.cold {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

/* ── Autonomy Level Selector ── */
.autonomy-select {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  min-width: 110px;
  appearance: auto;
}
.autonomy-select:focus {
  border-color: var(--fk-blue);
  box-shadow: 0 0 0 2px var(--fk-blue-10);
}
.autonomy-select.level-auto {
  border-left: 3px solid var(--success);
}
.autonomy-select.level-notify {
  border-left: 3px solid var(--fk-blue);
}
.autonomy-select.level-approval {
  border-left: 3px solid var(--fk-yellow-warm);
}
.autonomy-select.level-restricted {
  border-left: 3px solid var(--danger);
}

/* ── Policy Rule Item ── */
.policy-rule {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: var(--space-3);
  transition: all var(--transition-fast);
  background: var(--bg-primary);
}
.policy-rule:hover {
  border-color: var(--fk-blue-20);
  background: var(--fk-blue-lighter);
}
.policy-rule:last-child {
  margin-bottom: 0;
}
.policy-rule-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.policy-rule-icon.high {
  background: var(--danger-bg);
  color: var(--danger);
}
.policy-rule-icon.medium {
  background: var(--warning-bg);
  color: var(--warning);
}
.policy-rule-icon.low {
  background: var(--success-bg);
  color: var(--success);
}
.policy-rule-info {
  flex: 1;
  min-width: 0;
}
.policy-rule-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.policy-rule-desc {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ── Fail-Safe Toggle Row ── */
.failsafe-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}
.failsafe-row:last-child {
  border-bottom: none;
}
.failsafe-info {
  flex: 1;
}
.failsafe-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}
.failsafe-desc {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ── Signal Weight Bar ── */
.signal-weight-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}
.signal-weight-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 100px;
}
.signal-weight-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.signal-weight-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.signal-weight-fill::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 3px solid currentColor;
  box-shadow: var(--shadow-sm);
}
.signal-weight-value {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 36px;
  text-align: right;
}

/* ── Strategy Matrix Card ── */
.strategy-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: all var(--transition-normal);
  background: var(--bg-primary);
}
.strategy-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}
.strategy-card-header {
  padding: var(--space-5) var(--space-5);
  color: white;
  position: relative;
  overflow: hidden;
}
.strategy-card-header::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='white' fill-opacity='1' fill-rule='evenodd'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/svg%3E");
}
.strategy-card-header.hot {
  background: linear-gradient(135deg, #ef4444, #f97316);
}
.strategy-card-header.warm {
  background: linear-gradient(135deg, #f59e0b, #eab308);
}
.strategy-card-header.cold {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
}
.strategy-card-title {
  font-size: 1rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.strategy-card-subtitle {
  font-size: 0.72rem;
  opacity: 0.9;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}
.strategy-card-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.strategy-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.strategy-item::before {
  content: "→";
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ── Decision Trace ── */
.trace-item {
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.trace-item:last-child {
  border-bottom: none;
}
.trace-item:hover {
  background: var(--bg-tertiary);
}
.trace-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}
.trace-expand-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}
.trace-item.expanded .trace-expand-icon {
  transform: rotate(90deg);
}
.trace-summary {
  flex: 1;
  min-width: 0;
}
.trace-action {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.trace-meta {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.trace-steps {
  display: none;
  padding: 0 var(--space-5) var(--space-5) calc(var(--space-5) + 32px);
}
.trace-item.expanded .trace-steps {
  display: block;
}
.trace-step {
  position: relative;
  padding: var(--space-3) var(--space-4);
  border-left: 2px solid var(--border-light);
  margin-left: 6px;
  margin-bottom: var(--space-2);
}
.trace-step::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fk-blue);
  border: 2px solid var(--bg-primary);
}
.trace-step:last-child {
  border-left-color: transparent;
}
.trace-step-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fk-blue);
  margin-bottom: 2px;
}
.trace-step-detail {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ── Anomaly Card ── */
.anomaly-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: all var(--transition-normal);
}
.anomaly-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}
.anomaly-card-stripe {
  height: 4px;
}
.anomaly-card-stripe.critical {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}
.anomaly-card-stripe.warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}
.anomaly-card-stripe.info {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}
.anomaly-card-body {
  padding: var(--space-5);
}
.anomaly-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.anomaly-card-desc {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}
.anomaly-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ═══════════════════════════════════════════════════════════════
   AGENT REGISTRY & PROMPT STUDIO
   ═══════════════════════════════════════════════════════════════ */

/* ── Agent Cards Grid ── */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
.agent-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all 0.25s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.agent-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(40, 116, 240, 0.08);
  transform: translateY(-2px);
}
.agent-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.agent-card.status-active::before {
  background: linear-gradient(90deg, #26a269, #2ec4b6);
}
.agent-card.status-testing::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.agent-card.status-disabled::before {
  background: linear-gradient(90deg, #6b7280, #9ca3af);
}

.agent-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.agent-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-faint);
  color: var(--accent);
}
.agent-card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
}
.agent-card-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.agent-card-role {
  font-size: 0.76rem;
  color: var(--text-tertiary);
  line-height: 1.45;
  margin-bottom: var(--space-3);
  min-height: 32px;
}
.agent-card-stats {
  display: flex;
  justify-content: space-between;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
  margin-bottom: var(--space-4);
}
.agent-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.agent-toggle input {
  display: none;
}
.agent-toggle-slider {
  width: 36px;
  height: 20px;
  background: #ccd0d8;
  border-radius: 20px;
  position: relative;
  transition: background 0.25s ease;
  flex-shrink: 0;
}
.agent-toggle-slider::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.agent-toggle input:checked + .agent-toggle-slider {
  background: #26a269;
}
.agent-toggle input:checked + .agent-toggle-slider::after {
  transform: translateX(16px);
}
.agent-toggle-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.agent-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.autonomy-pill {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.autonomy-pill.autonomous {
  background: #26a26920;
  color: #26a269;
}
.autonomy-pill.approval {
  background: #f59e0b20;
  color: #f59e0b;
}
.autonomy-pill.gated {
  background: #ef444420;
  color: #ef4444;
}
.autonomy-select {
  font-size: 0.7rem;
  padding: 4px 22px 4px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  border: 1.5px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b8ba3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.autonomy-select:hover { border-color: var(--blue); }
.autonomy-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,116,240,0.12); }
.autonomy-select.autonomous { background-color: rgba(38,162,105,0.08); border-color: rgba(38,162,105,0.3); color: #1a7a4f; }
.autonomy-select.approval { background-color: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); color: #b45309; }
.autonomy-select.gated { background-color: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.3); color: #b91c1c; }

/* ── Execution Chain Pipeline ── */
.execution-chain {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  overflow-x: auto;
}
.execution-chain-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 90px;
}
.execution-chain-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border: 2px solid;
  transition: all 0.3s ease;
}
.execution-chain-circle.active {
  border-color: #26a269;
  background: #26a26915;
  color: #26a269;
}
.execution-chain-circle.testing {
  border-color: #f59e0b;
  background: #f59e0b15;
  color: #f59e0b;
}
.execution-chain-circle.disabled {
  border-color: #6b7280;
  background: #6b728015;
  color: #6b7280;
}
.execution-chain-circle svg {
  width: 20px;
  height: 20px;
}
.execution-chain-label {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  text-align: center;
  max-width: 80px;
  line-height: 1.3;
  font-weight: 500;
}
.execution-chain-arrow {
  flex: 1;
  height: 2px;
  background-image: linear-gradient(
    90deg,
    #26a26930 0%,
    #26a26930 40%,
    #26a269 50%,
    #26a26930 60%,
    #26a26930 100%
  );
  background-size: 200% 100%;
  position: relative;
  min-width: 20px;
  border-radius: 2px;
  animation: dataFlow 2s linear infinite;
  opacity: 0.8;
}
.execution-chain-arrow::after {
  content: "▸";
  position: absolute;
  right: -2px;
  top: -8.5px;
  color: #26a269;
  font-size: 0.75rem;
}
@keyframes dataFlow {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ── Prompt Studio Layout ── */
.ps-agent-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
}
.ps-banner-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.ps-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fk-blue-light);
  color: var(--fk-blue);
}
.ps-banner-icon svg {
  width: 22px;
  height: 22px;
}
.ps-banner-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.ps-banner-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ps-banner-right {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.ps-banner-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-tertiary);
}
.ps-banner-stat svg {
  width: 14px;
  height: 14px;
}
.ps-banner-stat strong {
  color: var(--text-primary);
  font-weight: 600;
}
.ps-save-bar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: var(--space-4);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-2);
}
.grid-prompt-studio {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: var(--space-4);
  align-items: start;
}
.prompt-editor-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.prompt-section .card-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.prompt-textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  color: var(--text-primary);
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s;
}
.prompt-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 116, 240, 0.1);
}

/* ── Tone Tags ── */
.tone-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tone-tag {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.tone-tag:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Context Variable Tags ── */
.context-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.context-var-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-family: "Fira Code", monospace;
  font-weight: 500;
  border: 1px dashed;
  cursor: pointer;
  transition: all 0.2s;
}
.context-var-tag.active {
  border-style: solid;
  opacity: 1;
  font-weight: 600;
}
.context-var-tag:not(.active) {
  opacity: 0.35;
}

/* ── Tool Toggles ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tool-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all 0.2s;
}
.tool-toggle:hover {
  border-color: var(--accent);
}
.tool-toggle.active {
  border-color: #26a269;
  background: #26a26910;
}
.tool-toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background 0.2s;
}
.tool-toggle.active .tool-toggle-dot {
  background: #26a269;
}
.tool-toggle-label {
  font-size: 0.72rem;
  font-family: "Fira Code", monospace;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Negative Rules ── */
.neg-rule-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ef444408;
  border: 1px solid #ef444425;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.76rem;
  color: var(--text-primary);
  transition: background 0.2s;
}
.neg-rule-item:hover {
  background: #ef444412;
}
.neg-rule-icon {
  color: #ef4444;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.neg-rule-text {
  flex: 1;
}
.neg-rule-remove {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.neg-rule-remove:hover {
  opacity: 1;
  color: #ef4444;
}

/* ── Version History ── */
.prompt-version-sidebar {
  position: sticky;
  top: var(--space-4);
}
.version-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.version-item:last-child {
  border-bottom: none;
}
.version-item:hover {
  background: var(--bg-tertiary);
}
.version-item.current {
  background: var(--accent-faint);
}
.version-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}
.version-item.current .version-dot {
  background: var(--border-focus);
}
.version-info {
  flex: 1;
}
.version-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}
.version-date {
  font-size: 0.65rem;
  color: var(--text-tertiary);
}

/* ── Environment Toggle ── */
.env-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  overflow: hidden;
}
.env-btn {
  padding: 5px 12px;
  font-size: 0.68rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
}
.env-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ── Form Select for Prompt Studio ── */
.form-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.form-select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════
   USER DROPDOWN
   ═══════════════════════════════════════════════════════════════ */
.user-dropdown-wrap {
  position: relative;
}
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.user-avatar-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}
.user-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--fk-blue), #1a5dc8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.user-avatar-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  display: none;
  animation: dropdownIn 0.2s ease;
}
.user-dropdown.open {
  display: block;
}
@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}
.user-dd-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}
.user-dd-email {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.user-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0 12px;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.user-dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.user-dropdown-item:first-of-type {
  border-radius: 0;
}
.user-dropdown-item:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.user-dropdown-item.logout {
  color: #ef4444;
}
.user-dropdown-item.logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════
   NETWORK CHART VISUALIZATION
   ═══════════════════════════════════════════════════════════════ */

.network-chart-section {
  animation: fadeSlideIn 0.5s ease-out;
}

.network-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  gap: 16px;
  flex-wrap: wrap;
}

.network-chart-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.network-chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 3px;
}

.network-chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.network-tier-filters {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 3px;
}

.network-filter-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.network-filter-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
}

.network-filter-btn.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.network-filter-btn.cat-elec.active {
  color: #2874f0;
  background: #e8f0fe;
}

.network-filter-btn.cat-fashion.active {
  color: #e91e8c;
  background: #fce4f3;
}

.network-filter-btn.cat-home.active {
  color: #26a269;
  background: #e8f8f1;
}

.network-filter-btn.cat-mobile.active {
  color: #7c3aed;
  background: #ede9fe;
}

.network-filter-btn.eng-high.active {
  color: #26a269;
  background: #e8f8f1;
}

.network-filter-btn.eng-med.active {
  color: #d97706;
  background: #fffbeb;
}

.network-filter-btn.eng-low.active {
  color: #ef4444;
  background: #fef2f2;
}

/* Canvas Body */
.network-chart-body {
  position: relative;
  background: transparent;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.04);
}

.network-chart-body canvas {
  display: block;
  width: 100%;
  height: 540px;
  cursor: grab;
}

.network-chart-body canvas:active {
  cursor: grabbing;
}

/* Edge Detail Tooltip */
.network-edge-tooltip {
  position: absolute;
  bottom: 16px;
  left: 16px;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 12px 16px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
  transform: translateY(6px);
  z-index: 10;
  border: 1px solid var(--border-light);
}

.network-edge-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.net-edge-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.net-edge-reason {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.net-edge-score {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* Node Tooltip */
.network-node-tooltip {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 260px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 14px 16px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
  transform: translateY(-6px);
  z-index: 10;
  border: 1px solid var(--border-light);
}

.network-node-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ntt-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.ntt-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.ntt-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ntt-tier {
  font-size: 0.66rem;
  font-weight: 500;
  margin-top: 1px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ntt-defining {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.ntt-scores {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.ntt-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
}

.ntt-score-label {
  width: 105px;
  color: var(--text-tertiary);
  font-weight: 500;
  flex-shrink: 0;
}

.ntt-score-bar {
  flex: 1;
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.ntt-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.ntt-score-val {
  font-weight: 700;
  color: var(--text-primary);
  width: 32px;
  text-align: right;
  font-size: 0.64rem;
  flex-shrink: 0;
}

.ntt-meta {
  font-size: 0.64rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* Footer */
.network-chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
  flex-wrap: wrap;
  gap: 12px;
}

.network-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.network-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.network-legend-line {
  width: 20px;
  height: 3px;
  border-radius: 2px;
}

.network-legend-line.strong {
  background: linear-gradient(
    90deg,
    rgba(40, 116, 240, 0.7),
    rgba(40, 116, 240, 0.3)
  );
  height: 3px;
}

.network-legend-line.weak {
  background: rgba(100, 116, 139, 0.25);
  height: 2px;
}

.network-legend-line.weak {
  background: rgba(100, 116, 139, 0.25);
  height: 2px;
  border-style: dashed;
}

.network-legend-dot {
  border-radius: 50%;
  background: var(--fk-blue);
}

.network-legend-dot.large {
  width: 10px;
  height: 10px;
}

.network-legend-dot.small {
  width: 5px;
  height: 5px;
}

.network-stats {
  display: flex;
  gap: 20px;
}

.network-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.network-stat-value {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
}

.network-stat-label {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   USER DRILL-DOWN NETWORK OVERLAY
   ═══════════════════════════════════════════════════════════════ */

.user-drilldown-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: udOverlayIn 0.3s ease;
}

.user-drilldown-overlay.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes udOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.user-drilldown-panel {
  width: 92vw;
  max-width: 1280px;
  height: 85vh;
  max-height: 820px;
  background: var(--bg-primary);
  border-radius: var(--radius-xl, 16px);
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.25),
    0 8px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: udPanelIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-light);
}

@keyframes udPanelIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ── Header ── */
.user-drilldown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-primary);
}

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

.user-drilldown-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.user-drilldown-back:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(40, 116, 240, 0.3);
}

.user-drilldown-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-drilldown-cohort-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-drilldown-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.user-drilldown-subtitle {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.user-drilldown-header-right {
  display: flex;
  align-items: center;
}

.user-drilldown-stats {
  display: flex;
  gap: 20px;
}

.uds-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.uds-stat-value {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
}

.uds-stat-label {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Body ── */
.user-drilldown-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(40, 116, 240, 0.03), transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(245, 158, 11, 0.03), transparent 60%),
    var(--bg-secondary);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.04);
}

.user-drilldown-body canvas {
  cursor: grab;
}

.user-drilldown-body canvas:active {
  cursor: grabbing;
}

/* ── User Node Tooltip ── */
.user-node-tooltip {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 280px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 14px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  transform: translateY(-6px);
  z-index: 10;
  border: 1px solid var(--border-light);
}

.user-node-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.unt-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.unt-header .unt-id-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #e8f0fe;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  color: #2874F0;
  font-family: 'Fira Code', monospace;
}

.unt-header .unt-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #fff7ed;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  color: #d97706;
}

.unt-actions {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.unt-actions .unt-action-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}

.unt-actions .unt-action-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.unt-meta {
  font-size: 0.66rem;
  color: var(--text-tertiary);
  line-height: 1.5;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

/* ── Footer ── */
.user-drilldown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
  gap: 16px;
  flex-wrap: wrap;
}

.user-drilldown-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.udl-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.udl-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.udl-line {
  width: 20px;
  height: 2px;
  flex-shrink: 0;
  border-radius: 1px;
}

.udl-line.solid {
  background: linear-gradient(90deg, rgba(40, 116, 240, 0.7), rgba(40, 116, 240, 0.3));
}

.udl-line.dashed {
  background: transparent;
  border-top: 2px dashed rgba(245, 158, 11, 0.5);
  height: 0;
}

.user-drilldown-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.64rem;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ── Click hint on cohort nodes ── */
.network-click-hint {
  position: absolute;
  bottom: 54px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 116, 240, 0.9);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 12px rgba(40, 116, 240, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.network-click-hint.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}
