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

:root {
  /* Dark moody palette */
  --bg-deep: #0a0e1a;
  --bg-primary: #12172b;
  --bg-secondary: #1a2039;
  --bg-tertiary: #232d4f;
  --bg-hover: #2d3a5f;
  
  /* Text */
  --text-primary: #e8e9f0;
  --text-secondary: #9ca3bf;
  --text-tertiary: #6b7394;
  
  /* Accents */
  --accent-gold: #e8b871;
  --accent-amber: #d9a156;
  --accent-purple: #8b7ec8;
  --accent-blue: #5d7fa8;
  
  /* Status colors */
  --status-online: #4ade80;
  --status-offline: #64748b;
  --priority-high: #ef4444;
  --priority-medium: #f59e0b;
  --priority-low: #6b7394;
  
  /* Borders */
  --border-subtle: rgba(139, 126, 200, 0.15);
  --border-medium: rgba(139, 126, 200, 0.25);
  --border-strong: rgba(139, 126, 200, 0.4);
  
  /* Shadows */
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-strong: 0 4px 24px rgba(0, 0, 0, 0.5);
  --glow-subtle: 0 0 20px rgba(139, 126, 200, 0.1);
  
  /* Typography */
  --font-display: 'Crimson Pro', serif;
  --font-body: 'IBM Plex Mono', monospace;
  
  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

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

.sidebar {
  width: 260px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 100;
}

.sidebar-header {
  padding: 32px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.sidebar-header h1 {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-amber) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

/* Status Bar */
.status-bar {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-offline);
  transition: all var(--transition-base);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

.status-indicator.online .status-dot {
  background: var(--status-online);
  box-shadow: 0 0 12px var(--status-online);
}

.status-text {
  color: var(--text-secondary);
  font-weight: 500;
}

.status-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-label {
  color: var(--text-tertiary);
}

.status-value {
  color: var(--accent-gold);
  font-weight: 500;
}

/* Navigation */
.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: all var(--transition-base);
  position: relative;
  font-size: 13px;
  letter-spacing: 0.01em;
  font-weight: 400;
}

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

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

.nav-item.active {
  background: var(--bg-tertiary);
  color: var(--accent-gold);
}

.nav-item.active::before {
  height: 24px;
}

.nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

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

.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-deep);
  position: relative;
}

.view {
  display: none;
  padding: 40px 48px;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn var(--transition-base);
}

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

.view.active {
  display: block;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.view-header h2 {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.view-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.15em;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

/* ============================================
   DASHBOARD
   ============================================ */

.dashboard-date {
  font-size: 15px;
  color: var(--text-tertiary);
  font-weight: 300;
  letter-spacing: 0.02em;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.dashboard-section {
  grid-column: span 1;
}

.dashboard-section.full-width {
  grid-column: span 2;
}

/* Project Cards */
.project-cards {
  display: grid;
  gap: 16px;
}

.project-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px;
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-purple));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.project-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

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

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.project-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-transform: capitalize;
}

.project-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.project-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.project-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-gold);
}

.project-progress {
  margin-top: 16px;
}

.progress-bar-bg {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-gold));
  border-radius: 3px;
  transition: width var(--transition-slow);
}

.progress-text {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all var(--transition-base);
}

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

.stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition-fast);
}

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

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  font-size: 14px;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.activity-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Subagent Tracker */
.subagent-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subagent-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition-fast);
}

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

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

.subagent-status-dot.running {
  background: var(--status-online);
  box-shadow: 0 0 8px var(--status-online);
  animation: pulse 2s ease-in-out infinite;
}

.subagent-status-dot.completed {
  background: var(--accent-gold);
}

.subagent-status-dot.failed {
  background: var(--priority-high);
}

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

.subagent-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.subagent-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

.subagent-preview {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.subagent-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-tertiary);
  font-size: 13px;
  border: 1px dashed var(--border-subtle);
  border-radius: 10px;
}

/* FAB (Floating Action Button) */
.fab {
  position: fixed;
  bottom: 32px;
  right: 48px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-amber));
  border: none;
  color: var(--bg-deep);
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: var(--shadow-strong), var(--glow-subtle);
  transition: all var(--transition-base);
  z-index: 50;
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 40px rgba(232, 184, 113, 0.3);
}

/* ============================================
   TASKS
   ============================================ */

.tasks-container {
  max-width: 100%;
}

.project-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.project-filter {
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.project-filter:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.project-filter.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-deep);
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}

.kanban-column {
  background: rgba(18, 23, 43, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 14px;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kanban-column.is-over {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 1px rgba(232, 184, 113, 0.4), var(--glow-subtle);
}

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

.kanban-column-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.kanban-column-count {
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: 999px;
}

.kanban-column-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.kanban-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 16px 10px;
  border: 1px dashed var(--border-subtle);
  border-radius: 12px;
  text-align: center;
}

.kanban-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.kanban-card.dragging {
  opacity: 0.6;
  transform: scale(0.98);
}

.kanban-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-tertiary);
}

.kanban-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.priority-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--priority-medium);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
  flex-shrink: 0;
}

.priority-indicator.high {
  background: var(--priority-high);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.priority-indicator.low {
  background: var(--priority-low);
  box-shadow: 0 0 0 3px rgba(107, 115, 148, 0.2);
}

.kanban-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.project-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.project-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tag-color, var(--accent-purple));
  box-shadow: 0 0 8px var(--tag-color, var(--accent-purple));
}

.subtask-count {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.subtask-count.muted,
.kanban-card-description.muted {
  color: var(--text-tertiary);
}

.subtask-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.subtask-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-amber));
  border-radius: 999px;
  transition: width var(--transition-base);
}

.kanban-card-details {
  display: none;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  gap: 12px;
  flex-direction: column;
}

.kanban-card.expanded .kanban-card-details {
  display: flex;
}

.kanban-card-description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.kanban-card-actions {
  display: flex;
  gap: 8px;
}

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

.btn.btn-ghost:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.kanban-subtasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-primary);
  border-radius: 6px;
  transition: all var(--transition-fast);
}

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

.subtask-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 2px solid var(--border-medium);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  appearance: none;
  position: relative;
}

.subtask-checkbox:checked {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.subtask-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 10px;
  font-weight: 700;
}

.subtask-title {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
}

.subtask-item.completed .subtask-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

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

@media (max-width: 800px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

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

.chat-container {
  max-width: 900px;
  height: calc(100vh - 200px);
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
}

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

.chat-welcome {
  text-align: center;
  padding: 64px 32px;
  color: var(--text-tertiary);
}

.chat-welcome-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.3;
}

.chat-welcome h3 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.chat-message {
  display: flex;
  gap: 12px;
  animation: slideIn var(--transition-base);
}

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

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-message.user .chat-avatar {
  background: var(--accent-gold);
  color: var(--bg-deep);
}

.chat-bubble {
  max-width: 70%;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
}

.chat-message.user .chat-bubble {
  background: var(--bg-tertiary);
  border-color: var(--border-medium);
}

.chat-bubble-content {
  color: var(--text-primary);
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-timestamp {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-input-container {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

#chatInput {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  transition: all var(--transition-fast);
}

#chatInput:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(232, 184, 113, 0.1);
}

#chatSend {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shortcut {
  opacity: 0.5;
  font-size: 12px;
}

/* ============================================
   SECOND BRAIN
   ============================================ */

.brain-layout {
  display: flex;
  gap: 24px;
  height: calc(100vh - 220px);
}

.brain-sidebar {
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-box {
  margin-bottom: 8px;
}

.search-box input {
  width: 100%;
}

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

.category-item {
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: capitalize;
  font-size: 13px;
  color: var(--text-secondary);
}

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

.category-item.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-deep);
  font-weight: 500;
}

.brain-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.notes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  height: 100%;
  overflow-y: auto;
  padding-right: 8px;
}

.note-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-base);
  height: fit-content;
}

.note-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.note-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.note-card-preview {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Note Editor & Viewer */
.note-editor,
.note-viewer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 32px;
  overflow-y: auto;
  z-index: 10;
}

.hidden {
  display: none !important;
}

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

.viewer-header {
  flex-wrap: wrap;
}

.viewer-header h3 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1 1 100%;
  margin-bottom: 12px;
}

.viewer-meta {
  flex: 1;
  font-size: 12px;
  color: var(--text-tertiary);
}

.note-title-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px 18px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.note-title-input:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(232, 184, 113, 0.1);
}

.editor-actions,
.viewer-actions {
  display: flex;
  gap: 10px;
}

#noteContent {
  width: 100%;
  height: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.8;
  resize: vertical;
  margin-bottom: 24px;
  transition: all var(--transition-fast);
}

#noteContent:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(232, 184, 113, 0.1);
}

.editor-preview h4 {
  font-size: 14px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.markdown-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 24px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 600;
}

.markdown-content h1 { font-size: 28px; }
.markdown-content h2 { font-size: 22px; }
.markdown-content h3 { font-size: 18px; }

.markdown-content p {
  margin-bottom: 16px;
}

.markdown-content code {
  background: var(--bg-tertiary);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--accent-gold);
}

.markdown-content pre {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.markdown-content a {
  color: var(--accent-gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.markdown-content a:hover {
  border-bottom-color: var(--accent-gold);
}

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

.markdown-content li {
  margin-bottom: 8px;
}

/* ============================================
   MEMORY
   ============================================ */

.memory-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 900px;
}

.memory-file {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.memory-file:hover {
  border-color: var(--border-medium);
  background: var(--bg-secondary);
  transform: translateX(4px);
}

.memory-file-name {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.memory-file-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ============================================
   BUTTONS & INPUTS
   ============================================ */

.btn {
  padding: 12px 24px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-deep);
}

.btn-primary:hover {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
  box-shadow: 0 4px 12px rgba(232, 184, 113, 0.3);
}

.btn-danger {
  background: var(--priority-high);
  border-color: var(--priority-high);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.input,
textarea,
select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  margin-bottom: 16px;
  transition: all var(--transition-fast);
}

.input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(232, 184, 113, 0.1);
}

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

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

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn var(--transition-base);
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  padding: 32px;
  max-width: 540px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-strong);
  animation: slideIn var(--transition-base);
}

.modal-content h3 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

.loading-state {
  text-align: center;
  padding: 48px 32px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 5px;
  border: 2px solid var(--bg-primary);
}

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

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

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-section.full-width {
    grid-column: span 1;
  }
  
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 72px;
  }
  
  .sidebar-header {
    padding: 24px 12px;
  }
  
  .sidebar-header h1 {
    font-size: 32px;
  }
  
  .status-bar,
  .nav-item span:not(.icon) {
    display: none;
  }
  
  .nav-item {
    justify-content: center;
    padding: 14px;
  }
  
  .view {
    padding: 24px 20px;
  }
  
  .brain-layout {
    flex-direction: column;
  }
  
  .brain-sidebar {
    width: 100%;
  }
  
  .notes-list {
    grid-template-columns: 1fr;
  }
  
  .stat-cards {
    grid-template-columns: 1fr;
  }
  
  .fab {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 28px;
  }
}
