:root {
  --bg-primary: #0a0c14;
  --bg-secondary: #121624;
  --bg-panel: rgba(22, 28, 45, 0.45);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-purple: #8a2be2;
  --accent-blue: #00d2ff;
  --accent-indigo: #4a00e0;
  
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  --gradient-primary: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-indigo) 50%, var(--accent-blue) 100%);
  --gradient-glow: 0 0 20px rgba(138, 43, 226, 0.3), 0 0 40px rgba(0, 210, 255, 0.15);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: 
    radial-gradient(at 0% 0%, rgba(138, 43, 226, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(0, 210, 255, 0.08) 0px, transparent 50%);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* App Container */
.app-container {
  width: 95vw;
  max-width: 1400px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(18, 22, 36, 0.8);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spark-icon {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(138, 43, 226, 0.6));
  animation: pulse-slow 3s infinite ease-in-out;
}

.logo-area h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #b0b5c0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Status Badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

/* Status Classes */
.status-badge.disconnected {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}
.status-badge.disconnected .status-dot {
  background-color: var(--color-danger);
}

.status-badge.connecting {
  background: rgba(245, 158, 11 0.1);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}
.status-badge.connecting .status-dot {
  background-color: var(--color-warning);
  animation: blink 1s infinite alternate;
}

.status-badge.connected {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}
.status-badge.connected .status-dot {
  background-color: var(--color-success);
}

.status-badge.listening {
  background: rgba(0, 210, 255, 0.1);
  border-color: rgba(0, 210, 255, 0.25);
  color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.15);
}
.status-badge.listening .status-dot {
  background-color: var(--accent-blue);
  animation: ping 1.2s infinite ease-in-out;
}

.status-badge.speaking {
  background: rgba(138, 43, 226, 0.12);
  border-color: rgba(138, 43, 226, 0.3);
  color: #c084fc;
  box-shadow: 0 0 12px rgba(138, 43, 226, 0.2);
}
.status-badge.speaking .status-dot {
  background-color: #c084fc;
  animation: ping 1s infinite ease-in-out;
}

/* Main Layout */
.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100% - 75px);
}

/* Panel Layouts */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
}

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

.panel-header h2 {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* Left Settings Panel */
.settings-panel {
  width: 320px;
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow-y: auto;
}

.panel-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(10, 12, 20, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  transition: var(--transition-smooth);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(138, 43, 226, 0.5);
  box-shadow: 0 0 0 2px rgba(138, 43, 226, 0.15);
  background: rgba(10, 12, 20, 0.85);
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action input {
  padding-right: 48px;
}

.btn-icon {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.icon-svg {
  width: 20px;
  height: 20px;
}

.field-help {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Center Panel (Live Interface) */
.interface-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(18, 22, 36, 0.2) 0%, rgba(10, 12, 20, 0.4) 100%);
}

/* Visualizer Container */
.visualizer-container {
  height: 220px;
  position: relative;
  border-bottom: 1px solid var(--border-color);
  background: rgba(10, 12, 20, 0.4);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#waveform-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.visualizer-overlay {
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.agent-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-secondary);
  position: relative;
  transition: var(--transition-smooth);
}

.avatar-glow {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: var(--gradient-primary);
  z-index: -1;
  opacity: 0;
  filter: blur(8px);
  transition: var(--transition-smooth);
}

/* Speaking/Listening Avatar State */
.speaking .agent-avatar {
  border-color: transparent;
  color: #ffffff;
  transform: scale(1.05);
}
.speaking .avatar-glow {
  opacity: 0.8;
  animation: rotate-glow 4s linear infinite;
}

.listening .agent-avatar {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.3);
  transform: scale(1.02);
}

.avatar-svg {
  width: 32px;
  height: 32px;
}

.audio-feedback-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

/* Transcription Container */
.transcript-container {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

/* Dialogue Bubbles */
.chat-bubble {
  max-width: 80%;
  display: flex;
  gap: 12px;
  animation: fade-in 0.3s ease-out;
}

.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble.ai {
  align-self: flex-start;
}

.bubble-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chat-bubble.user .bubble-avatar {
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.2);
  color: var(--accent-blue);
}

.chat-bubble.ai .bubble-avatar {
  background: rgba(138, 43, 226, 0.15);
  border: 1px solid rgba(138, 43, 226, 0.2);
  color: #c084fc;
}

.bubble-content {
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--glass-shadow);
}

.chat-bubble.user .bubble-content {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top-right-radius: 2px;
  color: var(--text-primary);
}

.chat-bubble.ai .bubble-content {
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.1) 0%, rgba(74, 0, 224, 0.08) 100%);
  border: 1px solid rgba(138, 43, 226, 0.15);
  border-top-left-radius: 2px;
  color: var(--text-primary);
}

/* Interim / Streaming Text */
.interim {
  opacity: 0.7;
  font-style: italic;
}

/* Controls Panel */
.controls-panel {
  padding: 24px 30px;
  border-top: 1px solid var(--border-color);
  background: rgba(18, 22, 36, 0.7);
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Buttons styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  font-family: var(--font-family);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #ffffff;
  border: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--gradient-glow);
}

.btn-glow {
  box-shadow: 0 4px 15px rgba(138, 43, 226, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon-svg {
  width: 18px;
  height: 18px;
}

/* Active State Buttons */
.btn-active-red {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
}

/* Text Input Field */
.text-input-field {
  flex: 1;
  display: flex;
  background: rgba(10, 12, 20, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 4px;
  position: relative;
  align-items: center;
  transition: var(--transition-smooth);
}

.text-input-field:focus-within {
  border-color: rgba(0, 210, 255, 0.4);
  box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.1);
}

.text-input-field input {
  background: transparent;
  border: none;
  padding: 10px 16px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  width: 100%;
}

.text-input-field input:focus {
  outline: none;
}

.text-input-field .btn-icon {
  position: static;
  color: var(--accent-blue);
  margin-right: 4px;
}

.text-input-field .btn-icon:disabled {
  color: var(--text-muted);
}

/* Animations */
@keyframes pulse-slow {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 8px rgba(138, 43, 226, 0.6));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 16px rgba(0, 210, 255, 0.8));
  }
}

@keyframes blink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 210, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 210, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 210, 255, 0);
  }
}

@keyframes rotate-glow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-main {
    flex-direction: column;
    overflow-y: auto;
  }
  .settings-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    max-height: 250px;
  }
  .app-container {
    height: 98vh;
  }
}

/* System Diagnostics Bubble */
.chat-bubble.system-diagnostic {
  align-self: center;
  max-width: 90%;
  animation: fade-in 0.2s ease-out;
  margin: 4px 0;
}
.chat-bubble.system-diagnostic .bubble-content {
  background: rgba(10, 12, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 8px 14px;
}
.chat-bubble.system-diagnostic.warning .bubble-content {
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--color-warning);
  background: rgba(245, 158, 11, 0.05);
}
.chat-bubble.system-diagnostic.error .bubble-content {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.05);
}
.chat-bubble.system-diagnostic.info .bubble-content {
  border-color: rgba(0, 210, 255, 0.3);
  color: var(--accent-blue);
  background: rgba(0, 210, 255, 0.05);
}

/* Wiki Brain Index Styles */
.border-top-panel {
  border-top: 1px solid var(--border-color);
  margin-top: 10px;
}

.wiki-manager-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  flex: 1;
  overflow: hidden;
}

.wiki-search-group {
  margin-bottom: 8px;
}

.wiki-index-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wiki-loading-state {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 30px 10px;
}

.wiki-category {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wiki-category-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #c084fc; /* Light purple accent */
  letter-spacing: 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wiki-item-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wiki-item {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.01);
}

.wiki-item:hover {
  background: rgba(138, 43, 226, 0.08);
  border-color: rgba(138, 43, 226, 0.2);
  color: var(--text-primary);
  transform: translateX(3px);
}

.wiki-item-search-match {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.wiki-item-search-match:hover {
  background: rgba(0, 210, 255, 0.05);
  border-color: rgba(0, 210, 255, 0.3);
}

.wiki-search-match-path {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
}

.wiki-search-match-text {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Glassmorphic Sliding Drawer */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
}

.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 12, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-content {
  position: relative;
  width: 100%;
  max-width: 550px;
  height: 100%;
  background: rgba(13, 17, 28, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.drawer.open {
  pointer-events: auto;
}

.drawer.open .drawer-overlay {
  opacity: 1;
  pointer-events: auto;
}

.drawer.open .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(20, 26, 42, 0.5);
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-action-btn {
  position: static !important;
  right: auto !important;
}

.drawer-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Markdown Rendering in Drawer */
.wiki-markdown h1 {
  font-size: 22px;
  margin-top: 0;
  margin-bottom: 16px;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.wiki-markdown h2 {
  font-size: 17px;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--accent-blue);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

.wiki-markdown h3 {
  font-size: 15px;
  margin-top: 20px;
  margin-bottom: 8px;
  color: #c084fc;
}

.wiki-markdown p {
  margin-bottom: 14px;
  color: var(--text-secondary);
}

.wiki-markdown ul, .wiki-markdown ol {
  margin-bottom: 16px;
  padding-left: 20px;
}

.wiki-markdown li {
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.wiki-markdown blockquote {
  border-left: 4px solid var(--accent-purple);
  background: rgba(138, 43, 226, 0.05);
  padding: 10px 16px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
}

.wiki-markdown blockquote p {
  margin: 0;
  color: var(--text-secondary);
}

.wiki-markdown code {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #f472b6;
}

.wiki-markdown pre {
  background: rgba(10, 12, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  margin: 16px 0;
}

.wiki-markdown pre code {
  background: transparent;
  padding: 0;
  color: #cbd5e1;
  font-size: 12px;
}

.wiki-markdown hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 20px 0;
}

/* Frontmatter Box */
.wiki-frontmatter-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.wiki-frontmatter-item {
  font-size: 12px;
}

.wiki-frontmatter-label {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 6px;
}

.wiki-frontmatter-val {
  color: var(--text-secondary);
}

.wiki-tag {
  display: inline-block;
  background: rgba(0, 210, 255, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
}

/* Wiki Internal Link Button */
.wiki-inline-link {
  color: var(--accent-blue);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}

.wiki-inline-link:hover {
  color: #00d2ff;
}

/* Tabs Navigation */
.wiki-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(18, 22, 36, 0.4);
  padding: 0 16px;
  gap: 8px;
}

.wiki-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 16px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

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

.wiki-tab.active {
  color: #c084fc; /* Purple accent */
}

.wiki-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  box-shadow: 0 0 8px var(--accent-purple);
}

.wiki-tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
}

.wiki-tab-content.active {
  display: flex;
}

/* Inbox & Voice Notes Section */
.wiki-inbox-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wiki-section-subtitle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-blue);
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.wiki-inbox-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.inbox-note-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition-smooth);
}

.inbox-note-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

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

.inbox-note-date {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.inbox-note-badge {
  font-size: 10px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.inbox-note-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  word-break: break-word;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.inbox-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.inbox-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-smooth);
}

.inbox-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.inbox-btn.btn-process {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.inbox-btn.btn-process:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Activity Logs Timeline */
.wiki-logs-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.wiki-logs-feed {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  gap: 16px;
  margin-left: 4px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.log-timeline-item {
  position: relative;
}

.log-timeline-item::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 2px solid var(--bg-secondary);
  z-index: 2;
}

.log-timeline-item.ingest::before {
  background: var(--accent-blue);
}

.log-timeline-item.correction::before {
  background: var(--color-warning);
}

.log-timeline-item.cross-link::before {
  background: var(--accent-purple);
}

.log-timeline-item.lint::before {
  background: var(--color-success);
}

.log-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.log-item-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.log-item-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.log-timeline-item.ingest .log-item-tag {
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-blue);
}

.log-timeline-item.correction .log-item-tag {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.log-timeline-item.cross-link .log-item-tag {
  background: rgba(138, 43, 226, 0.15);
  color: #c084fc;
}

.log-timeline-item.lint .log-item-tag {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
}

.log-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  flex-basis: 100%;
}

.log-item-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 4px;
}

.log-item-details {
  font-size: 11px;
  color: var(--text-muted);
  list-style: none;
  padding-left: 0;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-item-details li {
  position: relative;
  padding-left: 10px;
}

.log-item-details li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* Drawer Editor Styles */
.drawer-edit-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 350px;
}

.drawer-edit-container.hidden {
  display: none;
}

.drawer-body-render.hidden {
  display: none;
}

#drawer-editor {
  background: rgba(10, 12, 20, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  color: var(--text-primary);
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
  flex: 1;
  resize: none;
  outline: none;
  transition: var(--transition-smooth);
  width: 100%;
  height: 100%;
  min-height: 350px;
}

#drawer-editor:focus {
  border-color: rgba(138, 43, 226, 0.5);
  box-shadow: 0 0 0 2px rgba(138, 43, 226, 0.15);
  background: rgba(10, 12, 20, 0.85);
}

/* Backlinks Section */
.drawer-backlinks-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-backlinks-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #c084fc;
  letter-spacing: 1px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-backlinks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wiki-backlink-pill {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wiki-backlink-pill:hover {
  background: rgba(138, 43, 226, 0.08);
  border-color: rgba(138, 43, 226, 0.2);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

/* Center panel tab bar */
.center-tab-bar {
  display: flex;
  background: rgba(18, 22, 36, 0.5);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  gap: 12px;
}

.center-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 18px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

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

.center-tab.active {
  color: #00d2ff; /* Cyan accent for center active tab */
}

.center-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  box-shadow: 0 0 8px var(--accent-blue);
}

/* Brain Map Container styles */
.brain-map-container {
  flex: 1;
  position: relative;
  background: radial-gradient(circle at center, rgba(18, 22, 36, 0.5) 0%, rgba(10, 12, 20, 0.8) 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fade-in 0.3s ease-out;
  height: 100%;
}

.brain-map-container.hidden {
  display: none !important;
}

.transcript-container.hidden {
  display: none !important;
}

#brain-map-canvas {
  width: 100%;
  height: 100%;
  flex: 1;
  cursor: grab;
}

#brain-map-canvas:active {
  cursor: grabbing;
}

.brain-map-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(10, 12, 20, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: calc(100% - 32px);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.index { background-color: #a855f7; }
.legend-dot.concepts { background-color: #06b6d4; }
.legend-dot.entities { background-color: #6366f1; }
.legend-dot.sources { background-color: #f59e0b; }
.legend-dot.syntheses { background-color: #10b981; }
.legend-dot.raw { background-color: #ec4899; }

.brain-map-instructions {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(10, 12, 20, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 10px;
  color: var(--text-muted);
  pointer-events: none;
  backdrop-filter: blur(6px);
  z-index: 10;
}

/* Premium Modal styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 12, 0.75);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: rgba(18, 22, 36, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 90%;
  max-width: 460px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--gradient-glow);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.modal.open .modal-content {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

/* Password Protection Styles */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 20, 0.7);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  animation: loginFadeIn 0.4s ease-out;
}

.login-overlay.hidden {
  display: none !important;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: loginSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.login-spark-icon {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 0 12px rgba(138, 43, 226, 0.6));
  animation: pulse-slow 3s infinite ease-in-out;
}

.login-logo-area h2 {
  font-size: 28px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.login-logo-area p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.login-error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  text-align: center;
  animation: loginShake 0.3s ease-in-out;
}

.btn-login {
  margin-top: 10px;
  width: 100%;
}

.btn-logout {
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
}

/* Blur effect on app when login is active */
body.login-active .app-container {
  filter: blur(10px);
  pointer-events: none;
}

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

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

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}





