@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ==========================================================================
   1. CSS Variables & Theme
   ========================================================================== */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-surface: #16162a;
  --bg-surface-hover: #1e1e3a;
  --bg-card: rgba(22, 22, 42, 0.8);
  --bg-input: #12121a;
  --bg-overlay: rgba(0, 0, 0, 0.6);
  
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;
  --text-inverse: #0a0a0f;
  
  --accent-primary: #6c5ce7;
  --accent-secondary: #a78bfa;
  --accent-tertiary: #818cf8;
  --accent-glow: rgba(108, 92, 231, 0.15);
  --accent-gradient: linear-gradient(135deg, #6c5ce7, #a78bfa);
  
  --cyan-accent: #22d3ee;
  --green-accent: #34d399;
  --rose-accent: #f43f5e;
  --amber-accent: #fbbf24;
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(108, 92, 231, 0.5);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.15);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --sidebar-width: 280px;
  --header-height: 64px;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background-color: var(--accent-primary);
  color: #fff;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

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

/* ==========================================================================
   3. Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5em;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-tertiary);
}

/* ==========================================================================
   4. Utility Classes
   ========================================================================== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.gap-xl { gap: 2rem; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.text-danger { color: var(--rose-accent); }
.text-success { color: var(--green-accent); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }

.p-sm { padding: 0.5rem; }
.p-md { padding: 1rem; }
.p-lg { padding: 1.5rem; }

.hidden { display: none !important; }
.visible { display: block !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }

/* ==========================================================================
   5. Components
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.btn:focus-visible {
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}

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

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

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

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  color: var(--rose-accent);
  border-color: rgba(244, 63, 94, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-md);
  width: 2.5rem;
  height: 2.5rem;
}

.btn-lg {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.25rem;
  position: relative;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.input, .textarea, .select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-muted);
}

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper .input {
  padding-left: 2.5rem;
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

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

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

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

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

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary { background: rgba(108, 92, 231, 0.2); color: var(--accent-secondary); }
.badge-success { background: rgba(52, 211, 153, 0.2); color: var(--green-accent); }
.badge-danger { background: rgba(244, 63, 94, 0.2); color: var(--rose-accent); }
.badge-warning { background: rgba(251, 191, 36, 0.2); color: var(--amber-accent); }
.badge-info { background: rgba(34, 211, 238, 0.2); color: var(--cyan-accent); }

/* Avatar */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 2rem; height: 2rem; font-size: 0.875rem; }
.avatar-md { width: 2.5rem; height: 2.5rem; font-size: 1rem; }
.avatar-lg { width: 4rem; height: 4rem; font-size: 1.5rem; }

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

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

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-normal);
}

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

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

.modal-title {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

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

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1100;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.toast-icon {
  font-size: 1.25rem;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.125rem;
  color: var(--text-primary);
}

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

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.toast-success { border-left: 4px solid var(--green-accent); }
.toast-success .toast-icon { color: var(--green-accent); }

.toast-error { border-left: 4px solid var(--rose-accent); }
.toast-error .toast-icon { color: var(--rose-accent); }

.toast-info { border-left: 4px solid var(--cyan-accent); }
.toast-info .toast-icon { color: var(--cyan-accent); }

/* Loading States */
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-surface-hover) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 1rem; margin-bottom: 0.5rem; width: 100%; }
.skeleton-text:last-child { width: 80%; }
.skeleton-title { height: 1.5rem; margin-bottom: 1rem; width: 50%; }
.skeleton-avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  max-width: 400px;
}

/* ==========================================================================
   6. Auth Pages (Login/Register)
   ========================================================================== */
.auth-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-primary);
}

.auth-branding {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  background: radial-gradient(circle at top left, var(--bg-tertiary), var(--bg-primary));
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
}

/* Background Animation for Auth */
.auth-branding::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: backgroundPan 30s linear infinite;
  z-index: 0;
}

@keyframes backgroundPan {
  from { background-position: 0 0; }
  to { background-position: 60px 60px; }
}

.auth-branding-content {
  position: relative;
  z-index: 1;
  max-width: 500px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: #fff;
}

.auth-logo svg {
  width: 2rem;
  height: 2rem;
  color: var(--accent-primary);
}

.auth-tagline {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-primary);
}

.auth-feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--accent-secondary);
  border: 1px solid var(--border-color);
}

.auth-form-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: var(--bg-secondary);
}

.auth-form-card {
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}

.auth-form-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-form-title {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.auth-form-subtitle {
  color: var(--text-muted);
}

.auth-form .input {
  height: 48px;
}

.auth-form .btn-primary {
  height: 48px;
  width: 100%;
  font-size: 1.05rem;
  margin-top: 1rem;
}

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.password-toggle:hover {
  color: var(--text-primary);
}

.auth-error {
  background: rgba(244, 63, 94, 0.1);
  color: var(--rose-accent);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(244, 63, 94, 0.2);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-links {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-links a {
  font-weight: 500;
  margin-left: 0.25rem;
}

/* ==========================================================================
   7. App Layout & Sidebar
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--bg-primary);
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.sidebar-logo svg {
  color: var(--accent-primary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  padding-left: 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
}

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

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

.nav-item-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

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

.user-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin: 0;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-normal);
}

.topbar {
  height: var(--header-height);
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

.page-container {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* ==========================================================================
   8. Dashboard
   ========================================================================== */
.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-greeting {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.stat-title {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.stat-icon {
  color: var(--accent-secondary);
  background: var(--accent-glow);
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.action-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: linear-gradient(145deg, var(--bg-surface), var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.action-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 0;
}

.action-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

.action-card:hover::before {
  opacity: 0.05;
}

.action-card-content {
  position: relative;
  z-index: 1;
}

.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-hover);
  color: var(--accent-primary);
  margin-bottom: 1rem;
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}

.action-card:hover .action-icon {
  background: var(--accent-primary);
  color: white;
}

.action-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.action-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   9. Chat Interface
   ========================================================================== */
.chat-layout {
  display: flex;
  height: calc(100vh - var(--header-height));
  margin: -2rem; /* Negate page-container padding to make it full height/width */
  overflow: hidden;
}

.chat-sidebar {
  width: 300px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.chat-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.new-chat-btn {
  width: 100%;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.new-chat-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-list-item {
  padding: 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
}

.chat-list-item:hover {
  background: var(--bg-surface-hover);
}

.chat-list-item.active {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.chat-item-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 2rem;
}

.chat-item-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-item-delete {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  transition: all var(--transition-fast);
}

.chat-list-item:hover .chat-item-delete {
  opacity: 1;
}

.chat-item-delete:hover {
  color: var(--rose-accent);
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}

.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

.chat-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.message {
  display: flex;
  gap: 1rem;
  max-width: 85%;
  animation: fadeInUp 0.3s ease forwards;
}

.message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message.ai {
  margin-right: auto;
}

.message-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
}

.message.user .message-avatar {
  background: var(--accent-gradient);
  color: white;
}

.message.ai .message-avatar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--accent-secondary);
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.message-bubble {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  line-height: 1.6;
}

.message.user .message-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
  background: transparent;
  padding: 0.5rem 0;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.message.user .message-time {
  text-align: right;
}

/* Markdown Styles within AI Messages */
.markdown-body {
  color: var(--text-primary);
}

.markdown-body p {
  margin-bottom: 1rem;
}
.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.markdown-body ul, .markdown-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.markdown-body li {
  margin-bottom: 0.25rem;
}

.markdown-body code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent-secondary);
}

.markdown-body pre {
  background: #1e1e2e;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent-primary);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin: 1rem 0;
  font-style: italic;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.markdown-body th, .markdown-body td {
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-surface);
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

.chat-input-container {
  padding: 1rem 2rem 2rem;
  background: linear-gradient(to top, var(--bg-primary) 80%, transparent);
}

.chat-input-wrapper {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-end;
  padding: 0.5rem;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-fast);
}

.chat-input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--accent-primary), var(--shadow-md);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  max-height: 200px;
  resize: none;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  outline: none;
}

.chat-send-btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0.25rem;
  transition: all var(--transition-fast);
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--accent-tertiary);
  transform: translateY(-1px);
}

.chat-send-btn:disabled {
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: not-allowed;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.suggestion-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* ==========================================================================
   10. Notes & Summaries Page
   ========================================================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  margin: 0;
}

.search-bar {
  position: relative;
  width: 100%;
  max-width: 300px;
}

.notes-grid, .summaries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.note-card, .summary-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.note-card-body {
  flex: 1;
}

.note-topic {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-secondary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.note-preview {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.75rem;
}

.note-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.note-actions {
  display: flex;
  gap: 0.5rem;
}

.action-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  transition: color var(--transition-fast);
}

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

.action-icon-btn.favorite:hover, .action-icon-btn.favorite.active {
  color: var(--amber-accent);
}

.action-icon-btn.delete:hover {
  color: var(--rose-accent);
}

/* Generation Form Area */
.generate-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.generate-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   11. Profile Page
   ========================================================================== */
.profile-container {
  max-width: 800px;
  margin: 0 auto;
}

.profile-header-card {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  margin-bottom: 2rem;
}

.profile-avatar-lg {
  width: 100px;
  height: 100px;
  font-size: 2.5rem;
  background: var(--accent-gradient);
  color: white;
}

.profile-info {
  flex: 1;
}

.profile-name {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.profile-email {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.profile-stats {
  display: flex;
  gap: 1.5rem;
}

.profile-stat {
  display: flex;
  flex-direction: column;
}

.profile-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   12. Animations
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes typing {
  0% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
  100% { opacity: 0.3; transform: translateY(0); }
}

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

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(108, 92, 231, 0.2); }
  50% { box-shadow: 0 0 20px rgba(108, 92, 231, 0.4); }
}

.animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease forwards; }
.animate-slideInLeft { animation: slideInLeft 0.5s ease forwards; }

/* Stagger delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }

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

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }
  
  .chat-sidebar {
    width: 260px;
  }
  
  .auth-branding {
    padding: 3rem 2rem;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .auth-layout {
    flex-direction: column;
  }
  
  .auth-branding {
    padding: 2rem;
    min-height: 300px;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .auth-tagline {
    font-size: 2rem;
  }
  
  .chat-layout {
    position: relative;
  }
  
  .chat-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    transform: translateX(0);
    transition: transform var(--transition-normal);
  }
  
  .chat-sidebar.hidden-mobile {
    transform: translateX(-100%);
  }
  
  .message {
    max-width: 95%;
  }
  
  .stats-grid, .quick-actions-grid {
    grid-template-columns: 1fr;
  }
  
  .page-container {
    padding: 1rem;
  }
  
  .profile-header-card {
    flex-direction: column;
    text-align: center;
  }
  
  .profile-stats {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  
  .chat-input-container {
    padding: 1rem;
  }
  
  .auth-form-card {
    padding: 1.5rem;
  }
}

/* ==========================================================================
   SUPPLEMENTAL STYLES — Bridge EJS/JS class names to design system
   ========================================================================== */

/* Auth page class aliases (EJS uses .auth-left, .auth-right, .auth-form-header h2, .gradient-bg, .hidden-mobile) */
.auth-left { 
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  background: radial-gradient(circle at top left, var(--bg-tertiary), var(--bg-primary));
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
}
.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: backgroundPan 30s linear infinite;
}
.auth-left-content { position: relative; z-index: 1; max-width: 500px; }
.auth-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: var(--bg-secondary);
}
.gradient-bg { background: radial-gradient(circle at top left, var(--bg-tertiary), var(--bg-primary)); }
.hidden-mobile {}

.auth-form-container { width: 100%; max-width: 440px; }
.auth-form-header h2 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.auth-form-header p { color: var(--text-muted); margin-bottom: 2rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-muted); font-size: 0.9rem; }
.auth-footer a { color: var(--accent-secondary); text-decoration: none; font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

.auth-features { list-style: none; display: flex; flex-direction: column; gap: 1.25rem; }
.auth-features li { display: flex; align-items: center; gap: 1rem; color: var(--text-primary); }
.auth-features li svg, .auth-features li i { color: var(--accent-secondary); width: 1.25rem; height: 1.25rem; flex-shrink: 0; }

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon > svg, .input-with-icon > i { position: absolute; left: 1rem; color: var(--text-muted); width: 1.125rem; height: 1.125rem; pointer-events: none; }
.input-with-icon input {
  width: 100%;
  height: 48px;
  padding: 0 1rem 0 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}
.input-with-icon input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.input-with-icon input::placeholder { color: var(--text-muted); }
.password-toggle {
  position: absolute;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle:hover { color: var(--text-primary); }
.error-message {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--rose-accent);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}
.auth-submit {
  height: 48px;
  width: 100%;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.auth-submit.loading { pointer-events: none; opacity: 0.7; }

/* Input/textarea base */
.input, .textarea, textarea.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  resize: vertical;
}
.input:focus, .textarea:focus, textarea.input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea-large { min-height: 200px; }

/* Modal overlay system (EJS uses .modal-overlay, .modal-card) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-normal);
}
.modal-overlay.active .modal-card { transform: translateY(0) scale(1); }
.modal-overlay.modal-full .modal-card, .modal-card.modal-large { max-width: 800px; width: 95%; max-height: 90vh; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h2 { font-size: 1.25rem; margin: 0; }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer { padding: 1.25rem 1.5rem; border-top: 1px solid var(--border-color); }
.modal-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn svg, .btn i { width: 1rem; height: 1rem; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--bg-surface-hover); border-color: var(--border-hover); }
.btn-danger { background: rgba(244,63,94,0.1); color: var(--rose-accent); border: 1px solid rgba(244,63,94,0.2); }
.btn-danger:hover { background: rgba(244,63,94,0.2); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-surface); color: var(--text-primary); }
.btn-icon { padding: 0.5rem; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); }
.btn-icon:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.btn-tiny { padding: 0.25rem; }
.btn-tiny svg { width: 0.875rem; height: 0.875rem; }
.btn-full { width: 100%; }
.btn-send {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent-secondary);
  border: 1px solid rgba(108,92,231,0.2);
}
.badge-chat { background: rgba(34,211,238,0.1); color: var(--cyan-accent); border-color: rgba(34,211,238,0.2); }
.badge-note { background: rgba(251,191,36,0.1); color: var(--amber-accent); border-color: rgba(251,191,36,0.2); }
.badge-summary { background: rgba(52,211,153,0.1); color: var(--green-accent); border-color: rgba(52,211,153,0.2); }

/* Text utilities */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* Spin animation */
.spin { animation: spin 1s linear infinite; }

/* Page container */
.page-container { padding: 2rem; max-width: 1200px; margin: 0 auto; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.header-content { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.search-bar { position: relative; max-width: 400px; }
.search-bar svg, .search-bar i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 1rem; height: 1rem; pointer-events: none; }
.search-bar input {
  width: 100%;
  height: 40px;
  padding: 0 1rem 0 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}
.search-bar input:focus { outline: none; border-color: var(--border-focus); }

/* Dashboard */
.dashboard-container { padding: 2rem; max-width: 1200px; margin: 0 auto; }
.dashboard-header { margin-bottom: 2.5rem; }
.dashboard-header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.dashboard-header .subtitle { color: var(--text-secondary); font-size: 1.1rem; }
.quick-actions-section { margin-bottom: 2.5rem; }
.quick-actions-section h2, .stats-section h2, .recent-activity-section h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; }
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.action-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
}
.action-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: var(--accent-glow);
  color: var(--accent-secondary);
  flex-shrink: 0;
}
.action-icon svg { width: 1.25rem; height: 1.25rem; }
.action-details h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.action-details p { font-size: 0.875rem; color: var(--text-secondary); }

.stats-section { margin-bottom: 2.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}
.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--accent-glow);
  color: var(--accent-secondary);
}
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.recent-activity-section { margin-bottom: 2rem; }
.activity-list { display: flex; flex-direction: column; gap: 0.5rem; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.activity-item:hover { background: var(--bg-surface-hover); }
.activity-icon { color: var(--accent-secondary); flex-shrink: 0; }
.activity-icon svg { width: 1.125rem; height: 1.125rem; }
.activity-details { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.activity-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.activity-time { color: var(--text-muted); }

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform var(--transition-normal);
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  color: white;
}
.logo-icon svg { width: 1.125rem; height: 1.125rem; }
.logo-text { font-size: 1.25rem; font-weight: 700; }
.sidebar-close-btn { display: none; }
.sidebar-nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.nav-section { margin-bottom: 1.5rem; }
.nav-section-label { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 0 0.75rem; margin-bottom: 0.5rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 450;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-sans);
}
.nav-link svg { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.nav-link:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.nav-link.active { background: var(--accent-glow); color: var(--accent-secondary); font-weight: 500; }
.sidebar-footer { padding: 0.75rem; border-top: 1px solid var(--border-color); }
.logout-btn { color: var(--text-muted); }
.logout-btn:hover { color: var(--rose-accent); }
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 30;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  color: var(--text-primary);
  cursor: pointer;
}

/* App Layout */
.app-layout { display: flex; min-height: 100vh; }
.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; }

/* Chat Page */
.chat-page { padding: 0; }
.chat-container { display: flex; height: 100vh; }
.chat-sidebar {
  width: 300px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.chat-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}
.chat-sidebar-header h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.chat-search {
  padding: 0.75rem;
  position: relative;
}
.chat-search svg, .chat-search i {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 0.875rem;
  height: 0.875rem;
  pointer-events: none;
}
.chat-search input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
}
.chat-search input:focus { outline: none; border-color: var(--border-focus); }
.conversation-list { flex: 1; overflow-y: auto; padding: 0.5rem; }
.conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 0.25rem;
}
.conversation-item:hover { background: var(--bg-surface-hover); }
.conversation-item.active { background: var(--accent-glow); }
.conv-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.conv-title { font-weight: 500; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.125rem; }
.conv-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; }
.conv-actions { display: flex; gap: 0.125rem; opacity: 0; transition: opacity var(--transition-fast); }
.conversation-item:hover .conv-actions { opacity: 1; }
.conv-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* Chat Main Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.chat-back-btn { display: none; }
.chat-title { font-size: 1rem; font-weight: 600; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; gap: 0.25rem; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Messages */
.message { display: flex; gap: 1rem; max-width: 85%; animation: fadeInUp 0.3s ease; }
.message-user, .message.user { margin-left: auto; flex-direction: row-reverse; }
.message-assistant, .message.ai { margin-right: auto; }
.message-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.message-avatar svg { width: 1rem; height: 1rem; }
.message-user .message-avatar { background: var(--accent-gradient); color: white; }
.message-assistant .message-avatar { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--accent-secondary); }
.message-bubble {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 100%;
  overflow-wrap: break-word;
}
.message-user .message-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-bottom-right-radius: 4px;
}
.message-assistant .message-bubble {
  background: transparent;
  padding: 0.5rem 0;
}
.message-content { word-break: break-word; }
.message-content p { margin-bottom: 0.75rem; }
.message-content p:last-child { margin-bottom: 0; }
.message-content h1, .message-content h2, .message-content h3, .message-content h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.message-content h2 { font-size: 1.25rem; }
.message-content h3 { font-size: 1.1rem; }
.message-content ul, .message-content ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.message-content li { margin-bottom: 0.25rem; }
.message-content code { background: var(--bg-tertiary); padding: 0.15rem 0.4rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.85em; }
.message-content pre { background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1rem; overflow-x: auto; margin: 0.75rem 0; position: relative; }
.message-content pre code { background: transparent; padding: 0; font-size: 0.85rem; }
.message-content blockquote { border-left: 3px solid var(--accent-primary); padding-left: 1rem; margin: 0.75rem 0; color: var(--text-secondary); }
.message-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; }
.message-content th, .message-content td { padding: 0.5rem 0.75rem; border: 1px solid var(--border-color); text-align: left; font-size: 0.9rem; }
.message-content th { background: var(--bg-surface); font-weight: 600; }
.message-content strong { font-weight: 600; }
.message-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.5rem; }
.message-user .message-time { text-align: right; }

/* Copy button for code blocks */
.copy-code-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.copy-code-btn:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.copy-code-btn svg { width: 0.875rem; height: 0.875rem; }

/* Typing indicator */
.typing-bubble { display: flex; align-items: center; gap: 0.75rem; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-secondary);
  animation: typing 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-text { font-size: 0.8rem; color: var(--text-muted); }

/* Chat empty state */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}
.chat-empty-state .empty-icon { margin-bottom: 1.5rem; }
.chat-empty-state .empty-icon svg { width: 3rem; height: 3rem; color: var(--accent-secondary); }
.chat-empty-state h3 { font-size: 1.25rem; margin-bottom: 0.5rem; color: var(--text-primary); }
.chat-empty-state p { color: var(--text-muted); margin-bottom: 1.5rem; }
.quick-suggestions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.suggestion-chip {
  padding: 0.5rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.suggestion-chip:hover { background: var(--bg-surface-hover); color: var(--text-primary); border-color: var(--border-hover); }

/* Chat input */
.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.chat-form { display: flex; gap: 0.75rem; align-items: flex-end; }
.chat-form textarea {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  resize: none;
  line-height: 1.5;
  max-height: 160px;
  transition: border-color var(--transition-fast);
}
.chat-form textarea:focus { outline: none; border-color: var(--border-focus); }
.chat-form textarea::placeholder { color: var(--text-muted); }
.char-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.375rem; text-align: right; }

/* Notes grid */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
}
.note-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.note-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.note-actions { display: flex; gap: 0.25rem; }
.note-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.note-preview { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0.75rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-footer { display: flex; justify-content: space-between; align-items: center; }
.note-date { font-size: 0.75rem; color: var(--text-muted); }
.favorite-btn.active { color: var(--amber-accent); }
.favorite-btn.active svg { fill: var(--amber-accent); }

/* Quick topics */
.quick-topics { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* Summaries */
.summaries-list { display: flex; flex-direction: column; gap: 1rem; }
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
}
.summary-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.summary-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.summary-title { font-size: 1.05rem; font-weight: 600; }
.summary-preview { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0.75rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.summary-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }
.meta-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.meta-item svg { width: 0.875rem; height: 0.875rem; }

/* Summary view sections */
.summary-section { margin-bottom: 1.5rem; }
.summary-section h3 { display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--accent-secondary); }
.summary-section h3 svg { width: 1rem; height: 1rem; }
.content-box { padding: 1rem; background: var(--bg-surface); border-radius: var(--radius-md); line-height: 1.65; }
.styled-list { list-style: none; padding: 0; }
.styled-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); display: flex; align-items: flex-start; gap: 0.5rem; }
.styled-list li::before { content: '•'; color: var(--accent-secondary); font-weight: bold; }
.styled-list li:last-child { border-bottom: none; }
.pills-container { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.numbered-list { padding-left: 1.25rem; }
.numbered-list li { padding: 0.375rem 0; color: var(--text-secondary); }

/* Markdown content area */
.markdown-content { line-height: 1.65; }
.markdown-content h1, .markdown-content h2, .markdown-content h3 { margin-top: 1.5rem; margin-bottom: 0.75rem; font-weight: 600; }
.markdown-content p { margin-bottom: 0.75rem; }
.markdown-content ul, .markdown-content ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.markdown-content li { margin-bottom: 0.25rem; }
.markdown-content code { background: var(--bg-tertiary); padding: 0.15rem 0.4rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.85em; }
.markdown-content pre { background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1rem; overflow-x: auto; margin: 0.75rem 0; position: relative; }
.markdown-content pre code { background: transparent; padding: 0; font-size: 0.85rem; }
.markdown-content blockquote { border-left: 3px solid var(--accent-primary); padding-left: 1rem; margin: 0.75rem 0; color: var(--text-secondary); }
.markdown-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; }
.markdown-content th, .markdown-content td { padding: 0.5rem; border: 1px solid var(--border-color); text-align: left; }
.markdown-content th { background: var(--bg-surface); font-weight: 600; }

/* Profile page */
.profile-container { padding: 2rem; max-width: 600px; margin: 0 auto; }
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  border-bottom: 1px solid var(--border-color);
}
.profile-avatar {
  width: 5rem;
  height: 5rem;
  border-radius: var(--radius-lg);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.profile-info h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.profile-info p { color: var(--text-secondary); }
.member-since { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; display: block; }
.profile-body { padding: 2rem; }
.profile-body h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; color: var(--text-secondary); }
.info-group { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); }
.info-group:last-child { border-bottom: none; }
.info-group label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.info-value { font-size: 1rem; font-weight: 500; }

/* Error page */
.error-page-layout { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-primary); }
.error-container { text-align: center; padding: 2rem; }
.error-content { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.error-icon svg { width: 4rem; height: 4rem; color: var(--rose-accent); }
.error-title { font-size: 2rem; font-weight: 700; }
.error-message { color: var(--text-secondary); font-size: 1.1rem; margin-bottom: 1rem; }
.error-brand { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); margin-top: 3rem; font-weight: 600; }
.error-brand svg { width: 1.25rem; height: 1.25rem; color: var(--accent-secondary); }

/* Empty state inside grid (not in container) */
.notes-grid > .empty-state,
.summaries-list > .empty-state {
  grid-column: 1 / -1;
}
.empty-state svg, .empty-state i { width: 3rem; height: 3rem; color: var(--text-muted); margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-secondary); margin-bottom: 1.25rem; }
.empty-state .btn { margin-top: 0.5rem; }

/* Toast styling (ensure visibility) */
.toast { pointer-events: all; }
.toast-exit { animation: slideOutRight 0.3s ease forwards; }
@keyframes slideOutRight { to { transform: translateX(120%); opacity: 0; } }
.toast > svg, .toast > i { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.toast > span { flex: 1; }
.toast .toast-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 0.25rem; border-radius: var(--radius-sm); display: flex; }
.toast .toast-close:hover { color: var(--text-primary); }
.toast .toast-close svg { width: 0.875rem; height: 0.875rem; }

/* Scrollbar */
::-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); }

/* Selection */
::selection { background: rgba(108,92,231,0.3); color: white; }

/* Responsive */
@media (max-width: 1024px) {
  .quick-actions-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.active { transform: translateX(0); }
  .sidebar-close-btn { display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 0.5rem; border-radius: var(--radius-sm); }
  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; }
  .hidden-mobile { display: none !important; }
  
  .auth-left { display: none; }
  .auth-right { flex: 1; }
  
  .chat-container { flex-direction: column; }
  .chat-sidebar { width: 100%; height: auto; max-height: none; border-right: none; border-bottom: 1px solid var(--border-color); }
  .chat-main { height: 100vh; }
  .chat-main.active-mobile { display: flex; }
  .chat-back-btn { display: flex; }
  
  .quick-actions-grid, .stats-grid { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: 1fr; }
  .dashboard-container, .page-container { padding: 1rem; }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  .message { max-width: 95%; }
}

/* Sidebar Quota Display */
.sidebar-quota {
  padding: 0.75rem 1rem;
  margin: 0 0.75rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.quota-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.quota-label svg { width: 0.875rem; height: 0.875rem; color: var(--amber-accent); }
.quota-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.quota-admin { color: var(--green-accent); }
.badge-admin {
  background: rgba(52,211,153,0.15);
  color: var(--green-accent);
  border-color: rgba(52,211,153,0.3);
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
}
.quota-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.quota-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.quota-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.quota-exhausted {
  font-size: 0.75rem;
  color: var(--rose-accent);
  margin-top: 0.35rem;
  font-weight: 500;
}
