:root {
  --bg-dark: #07090e;
  --bg-surface: #0d121f;
  --bg-card: rgba(15, 22, 38, 0.65);
  --bg-card-hover: rgba(22, 32, 54, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 240, 255, 0.35);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --neon-cyan: #00f0ff;
  --neon-emerald: #10b981;
  --neon-violet: #8b5cf6;
  --neon-amber: #f59e0b;
  --neon-rose: #f43f5e;

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body.dark-theme {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Dynamic Ambient Glows */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--neon-cyan), transparent);
  top: -100px;
  right: -100px;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--neon-violet), transparent);
  bottom: -150px;
  left: 10%;
  animation: floatOrb 24s ease-in-out infinite alternate-reverse;
}

.glow-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--neon-emerald), transparent);
  top: 40%;
  left: 35%;
  animation: floatOrb 20s ease-in-out infinite alternate;
  opacity: 0.12;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-40px, 60px) scale(0.95); }
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: rgba(10, 15, 27, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(0, 240, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon-cyan);
  position: relative;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  border: 1px solid var(--neon-cyan);
  animation: ringPing 2.5s cubic-bezier(0, 0, 0.2, 1) infinite;
  opacity: 0.5;
}

@keyframes ringPing {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.brand-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  display: inline-block;
  margin-top: 2px;
}

/* Nav Menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  position: relative;
  text-align: left;
  width: 100%;
}

.nav-item svg {
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-spring);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-item:hover svg {
  transform: scale(1.12);
  color: var(--neon-cyan);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), rgba(139, 92, 246, 0.06));
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.08);
}

.nav-item.active svg {
  color: var(--neon-cyan);
}

.counter-pill {
  margin-left: auto;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.pulse-pill {
  background: rgba(16, 185, 129, 0.15);
  color: var(--neon-emerald);
  border: 1px solid rgba(16, 185, 129, 0.35);
  animation: pulseLight 2s infinite alternate;
}

@keyframes pulseLight {
  0% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-emerald);
  box-shadow: 0 0 8px var(--neon-emerald);
  flex-shrink: 0;
  animation: pulseDot 1.5s infinite alternate;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.2); opacity: 1; }
}

.status-texts {
  display: flex;
  flex-direction: column;
}

.status-title {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-val {
  font-size: 0.8rem;
  color: var(--neon-emerald);
  font-weight: 600;
}

.governance-tag {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  padding: 4px;
  border-radius: 4px;
}

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

/* Top Header */
.top-header {
  padding: 24px 36px;
  background: rgba(13, 18, 31, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* Tenant Switcher */
.tenant-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tenant-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

.custom-select-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 25, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  transition: all 0.25s var(--ease-spring);
  position: relative;
}

.custom-select-box:hover {
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

.creator-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-violet));
  color: #07090e;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tenant-dropdown {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  padding-right: 4px;
}

.tenant-dropdown option {
  background: var(--bg-surface);
  color: var(--text-main);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), #00aaff);
  color: #07090e;
  box-shadow: 0 4px 14px rgba(0, 240, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-outline:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-success {
  background: var(--neon-emerald);
  color: #07090e;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: var(--neon-rose);
  color: #fff;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
}

/* Content Container */
.content-container {
  padding: 32px 36px 60px 36px;
  flex: 1;
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: tabFadeIn 0.35s var(--ease-spring);
}

.tab-pane.active {
  display: block;
}

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

/* Cards & Glassmorphism */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transition: all 0.3s var(--ease-spring);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  transition: background 0.3s var(--ease-spring);
}

.kpi-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.kpi-card:hover::before {
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
}

.kpi-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-wrapper.cyan {
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.kpi-icon-wrapper.violet {
  background: rgba(139, 92, 246, 0.12);
  color: var(--neon-violet);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.kpi-icon-wrapper.amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--neon-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.kpi-icon-wrapper.emerald {
  background: rgba(16, 185, 129, 0.12);
  color: var(--neon-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.kpi-data {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-number {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  margin-top: 2px;
}

.kpi-trend {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.kpi-trend.positive {
  background: rgba(16, 185, 129, 0.12);
  color: var(--neon-emerald);
}

.kpi-trend.warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--neon-amber);
}

/* Creator Banner */
.creator-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  background: linear-gradient(135deg, rgba(16, 24, 43, 0.7), rgba(20, 20, 36, 0.5));
  border: 1px solid rgba(0, 240, 255, 0.18);
  position: relative;
  overflow: hidden;
}

.creator-banner::after {
  content: '';
  position: absolute;
  right: -50px;
  top: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.08), transparent 70%);
  pointer-events: none;
}

.creator-banner-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.avatar-large {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-violet));
  color: #07090e;
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
  flex-shrink: 0;
}

.creator-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.creator-identity-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.creator-identity-row h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.handle-tag {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--neon-cyan);
}

.role-pill {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.18);
  color: var(--neon-violet);
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-weight: 600;
}

.creator-bio {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.creator-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.meta-pill {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.meta-pill strong {
  color: var(--text-main);
}

/* Sections */
.section-block {
  margin-top: 32px;
}

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

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

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

/* Departments Grid */
.departments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.dept-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all 0.3s var(--ease-spring);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.dept-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 240, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.dept-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dept-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.dept-status-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dept-status-badge.healthy {
  background: rgba(16, 185, 129, 0.12);
  color: var(--neon-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.dept-status-badge.action {
  background: rgba(245, 158, 11, 0.15);
  color: var(--neon-amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.dept-agent-name {
  font-size: 0.8rem;
  color: var(--neon-cyan);
  font-family: var(--font-mono);
}

.dept-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Studio Tab Layout */
.studio-layout {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 24px;
}

.chat-terminal-card {
  display: flex;
  flex-direction: column;
  height: 640px;
  padding: 0;
  overflow: hidden;
}

.chat-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(18, 25, 42, 0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cos-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-violet));
  color: #07090e;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.chat-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.chat-quick-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-cmd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--neon-cyan);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
}

.chip-cmd:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.4);
  transform: translateY(-1px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message-bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.5;
  animation: msgPop 0.3s var(--ease-spring);
}

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

.bot-message {
  align-self: flex-start;
  background: rgba(22, 32, 54, 0.8);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.user-message {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-bottom-right-radius: 4px;
  color: #fff;
}

.message-sender {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.badge-role {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--neon-cyan);
  font-family: var(--font-mono);
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.message-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.message-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.dept-chip {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 240, 255, 0.25);
  font-family: var(--font-mono);
}

.chat-input-bar {
  padding: 16px 20px;
  background: rgba(14, 20, 35, 0.9);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
}

.chat-input-bar input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.25s var(--ease-spring);
}

.chat-input-bar input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.2);
}

.btn-send {
  background: var(--neon-cyan);
  color: #07090e;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-send:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
}

/* Studio Sidebar */
.studio-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.card-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-item-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  width: 100%;
}

.action-item-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(0, 240, 255, 0.3);
  transform: translateX(4px);
}

.action-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.action-item-icon.cyan { background: rgba(0, 240, 255, 0.15); }
.action-item-icon.violet { background: rgba(139, 92, 246, 0.15); }
.action-item-icon.emerald { background: rgba(16, 185, 129, 0.15); }
.action-item-icon.amber { background: rgba(245, 158, 11, 0.15); }

.action-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-item-text strong {
  font-size: 0.84rem;
  color: #fff;
}

.action-item-text span {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.telemetry-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.telemetry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 8px;
}

.telemetry-item strong {
  color: #fff;
  font-family: var(--font-mono);
}

.badge-success {
  font-size: 0.72rem;
  color: var(--neon-emerald);
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Approvals / Intervention Queue */
.approvals-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.approval-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  transition: all 0.3s var(--ease-spring);
}

.approval-card.waiting {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.1);
}

.approval-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.approval-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.approval-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.approval-type {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
}

.approval-summary {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.approval-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Workflows Tab */
.workflows-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.3s var(--ease-spring);
}

.workflow-card:hover {
  border-color: rgba(0, 240, 255, 0.25);
  transform: translateY(-2px);
}

.workflow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workflow-steps-track {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
}

.wf-step-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  white-space: nowrap;
}

.wf-step-node.completed {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
  color: var(--neon-emerald);
}

.wf-step-node.active {
  border-color: rgba(0, 240, 255, 0.5);
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.wf-step-arrow {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Content Pieces Tab */
.pieces-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.piece-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s var(--ease-spring);
}

.piece-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 240, 255, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.piece-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.piece-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}

.piece-hook {
  font-size: 0.84rem;
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--neon-cyan);
  font-style: italic;
}

.piece-body-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.piece-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

/* Graphs Tab */
.graphs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.graph-card.span-2 {
  grid-column: span 2;
}

.graph-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

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

.legend-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-color.cyan { background: var(--neon-cyan); }
.legend-color.emerald { background: var(--neon-emerald); }

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 260px;
  background: rgba(8, 12, 22, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

#retention-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(14, 21, 37, 0.95);
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.25);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 5;
  white-space: nowrap;
}

.retention-brackets-bar {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
}

.bracket-tag {
  flex: 1;
  text-align: center;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.dag-nodes-container, .attribution-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dag-node-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 0.25s var(--ease-spring);
}

.dag-node-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 240, 255, 0.3);
  transform: translateX(3px);
}

.attr-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.attr-row-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #fff;
}

.attr-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.attr-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-emerald));
  transition: width 0.6s var(--ease-spring);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 12, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeInModal 0.2s ease;
}

.modal-overlay.open {
  display: flex;
}

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

.modal-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalSpring 0.35s var(--ease-spring);
}

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

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 15, 27, 0.5);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.25s var(--ease-spring);
}

.form-control:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.form-help {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.approval-modal-summary {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.4;
}

/* Responsiveness */
@media (max-width: 1024px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
  .graphs-grid {
    grid-template-columns: 1fr;
  }
  .graph-card.span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .top-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
