/* ========================================
   PatDash — Chic Personal Dashboard
   Enhanced with Glassmorphism & Smooth Animations
   Patricia Angelöw — 2026
   ======================================== */

/* Fonts loaded via /fonts/fonts.css in index.html */

:root {
  /* — Palette: warm noir + rosé gold — */
  --bg: #141216;
  --bg-gradient-start: #1a171d;
  --bg-gradient-end: #0f0d11;
  --surface: rgba(28, 25, 31, 0.85);
  --surface-solid: #1c191f;
  --card: rgba(36, 32, 40, 0.7);
  --card-solid: #242028;
  --card-hover: rgba(42, 37, 48, 0.85);
  --accent: #c4956a;
  --accent-soft: rgba(196, 149, 106, 0.12);
  --accent-glow: rgba(196, 149, 106, 0.15);
  --rosé: #c9918a;
  --rosé-soft: rgba(201, 145, 138, 0.1);
  --text: #ede8e3;
  --text-secondary: #b8b3c3;
  --text-muted: #7a7585;
  --success: #8aab8e;
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(196, 149, 106, 0.25);
  --shadow: rgba(0, 0, 0, 0.4);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  /* Glassmorphism */
  --glass-bg: rgba(28, 25, 31, 0.65);
  --glass-blur: blur(20px) saturate(1.8);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  
  /* Layout */
  --sidebar-w: 280px;
  --chat-w: 380px;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.85rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;

  /* Aliases for legacy/alternate naming conventions */
  --color-bg: var(--bg);
  --color-bg-elevated: var(--card);
  --color-bg-hover: var(--card-hover);
  --color-border: var(--border);
  --color-fg: var(--text);
  --color-fg-muted: var(--text-muted);
  --color-primary: var(--accent);
  --color-success: var(--success);
  --surface-subtle: rgba(28, 25, 31, 0.45);
  --accent-muted: rgba(196, 149, 106, 0.3);
  --transition: var(--transition-base);
  --ease-bounce: var(--transition-bounce);
  --warm-cream: rgba(253, 243, 225, 0.04);
  --peach: rgba(232, 168, 120, 0.12);
}

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

input, button, textarea, select { 
  font-family: inherit; 
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg) 50%, var(--bg-gradient-end) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  line-height: 1.6;
  position: relative;
}

/* ========== Ambient Background Effects ========== */
body::before {
  content: '';
  position: fixed;
  top: -30%; left: -10%;
  width: 70%; height: 70%;
  background: radial-gradient(ellipse at center, rgba(196, 149, 106, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: ambientPulse 8s ease-in-out infinite;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%; right: -5%;
  width: 50%; height: 50%;
  background: radial-gradient(ellipse at center, rgba(201, 145, 138, 0.06) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
  animation: ambientPulse 10s ease-in-out infinite reverse;
}

@keyframes ambientPulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* Hide overlays before Alpine initializes */
[x-cloak] { display: none !important; }

/* Skip to content link */
.skip-link {
  position: fixed;
  top: -50px;
  left: 16px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: 99999;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* Focus-visible styles */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* Grain texture overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
  background: rgba(196, 149, 106, 0.3); 
  border-radius: 4px; 
}
::-webkit-scrollbar-thumb:hover { background: rgba(196, 149, 106, 0.5); }

/* ========== Selection ========== */
::selection { 
  background: rgba(196, 149, 106, 0.3); 
  color: var(--text); 
}

/* ============================================================================
   UNIFIED COMPONENT LIBRARY — Pat's Atelier Design System
   ============================================================================ */

/* ---------- Spacing Tokens ---------- */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
}

/* ---------- Typography Classes ---------- */
.heading-1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--text);
}

.heading-2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--text);
}

.heading-3 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--text);
}

.heading-4 {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

.body {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-secondary);
}

.body-small {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
}

.label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.caption {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.text-rose { color: var(--rosé); }

/* ---------- Card Components ---------- */
.card {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

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

.card-header {
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-body {
  flex: 1;
}

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

.card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 var(--space-2);
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* Card with gold accent bar */
.card-accent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--rosé));
  opacity: 0;
  transition: opacity var(--transition-base);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-accent {
  position: relative;
  overflow: hidden;
}

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

/* ---------- Button Components ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-xl);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  text-decoration: none;
}

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

.btn-primary {
  background: transparent;
  color: var(--accent);
  font-weight: 500;
  border: 1px solid rgba(196, 149, 106, 0.5);
  box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
  background: rgba(196, 149, 106, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(196, 149, 106, 0.12);
  transform: none;
}

.btn-primary:active:not(:disabled) {
  background: rgba(196, 149, 106, 0.12);
  transform: none;
}

.btn-secondary {
  background: var(--glass);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
  background: linear-gradient(135deg, var(--rosé), #b5706a);
  color: #1a1216;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(201, 145, 138, 0.25);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(201, 145, 138, 0.35);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: none;
}

.btn-icon:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--text);
  transform: scale(1.05);
}

.btn-icon-circle {
  border-radius: 50%;
}

/* Button sizes */
.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 0.95rem;
}

/* ---------- Form Elements ---------- */
.input,
.textarea,
.select {
  width: 100%;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all var(--transition-base);
}

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

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

.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.7;
}

.select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a7585' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Checkbox — Custom circular style */
.checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  color: var(--bg);
  padding: 0;
}

.checkbox:hover {
  border-color: var(--accent);
}

.checkbox.checked,
.checkbox[data-checked="true"] {
  background: linear-gradient(135deg, var(--success), #6d9470);
  border-color: var(--success);
  box-shadow: 0 2px 8px rgba(138, 171, 142, 0.3);
  animation: checkPulse 0.3s var(--transition-bounce);
}

@keyframes checkPulse {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.checkbox.checked::after,
.checkbox[data-checked="true"]::after {
  content: '✓';
  font-size: 0.75rem;
  font-weight: bold;
}

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

.form-group > .label {
  display: block;
  margin-bottom: var(--space-2);
}

/* ---------- List Components ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.list-item-interactive {
  cursor: pointer;
}

.list-item-interactive:hover {
  border-color: var(--border-accent);
  transform: translateX(4px);
  background: var(--card-hover);
}

.list-item-done {
  opacity: 0.55;
}

.list-item-done .list-item-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.list-item-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ---------- Progress & Completion ---------- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--rosé));
  border-radius: var(--radius-full);
  transition: width 0.4s ease-out;
}

.progress-bar-success .progress-bar-fill {
  background: linear-gradient(90deg, var(--success), #6d9470);
}

/* Completion Ring (SVG-based) */
.completion-ring {
  --size: 60px;
  --stroke-width: 6px;
  width: var(--size);
  height: var(--size);
  position: relative;
}

.completion-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.completion-ring-bg {
  fill: none;
  stroke: var(--surface);
  stroke-width: var(--stroke-width);
}

.completion-ring-progress {
  fill: none;
  stroke: var(--success);
  stroke-width: var(--stroke-width);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease-out;
}

.completion-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

/* Streak Badge */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--accent), #b8845e);
  color: #1a1216;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.streak-badge::before {
  content: '🔥';
  font-size: 0.85rem;
}

/* ---------- Feedback Components ---------- */

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.badge-default {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-success {
  background: rgba(156, 175, 136, 0.15);
  color: var(--success);
}

.badge-rose {
  background: var(--rosé-soft);
  color: var(--rosé);
}

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

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

.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0 0 var(--space-2);
}

.empty-state-text {
  font-size: 0.88rem;
  max-width: 280px;
  margin: 0;
}

/* Toast — Already defined, adding variants */
.toast-success .toast-icon::before { content: '✓'; }
.toast-error .toast-icon::before { content: '✕'; }
.toast-info .toast-icon::before { content: 'ℹ'; }

/* ---------- Layout Utilities ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

/* Grid utilities */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

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

/* Spacing utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }

/* ---------- Completion Animations ---------- */
@keyframes completeFade {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
  100% { opacity: 0.55; transform: scale(1); }
}

@keyframes checkmarkDraw {
  0% { stroke-dashoffset: 20; }
  100% { stroke-dashoffset: 0; }
}

@keyframes gentleGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 149, 106, 0); }
  50% { box-shadow: 0 0 20px 4px rgba(196, 149, 106, 0.15); }
}

.animate-complete {
  animation: completeFade 0.4s ease-out forwards;
}

.animate-glow {
  animation: gentleGlow 2s ease-in-out infinite;
}

/* ============================================================================
   END UNIFIED COMPONENT LIBRARY
   ============================================================================ */

/* ========== Typography Scale ========== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); }
h4 { font-size: 1.1rem; }

p { line-height: 1.7; }

/* ========== Mobile Header ========== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
  z-index: 1000;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.mobile-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* ========== Sidebar ========== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition-slow);
}

.sidebar-brand {
  padding: 32px 28px 24px;
  border-bottom: var(--glass-border);
  position: relative;
}

.sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 28px;
  right: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}

.sidebar-brand h2 {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1.9rem;
  font-weight: 300;
  letter-spacing: 0.08em;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-top: 6px;
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  text-align: left;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.nav-item:hover {
  background: var(--accent-soft);
  color: var(--text);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent-soft), rgba(196, 149, 106, 0.05));
  color: var(--text);
  box-shadow: 0 2px 12px rgba(196, 149, 106, 0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: linear-gradient(180deg, var(--accent), var(--rosé));
  border-radius: 0 3px 3px 0;
}

.nav-item.drag-over {
  border-top: 2px solid var(--accent);
  margin-top: -2px;
}

.nav-drag-handle:hover { opacity: 0.7 !important; }

.nav-icon {
  font-size: 1.15rem;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  color: #c4956a;
  stroke: #c4956a;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-accent {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.8;
  box-shadow: 0 0 8px currentColor;
}

.add-space-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 16px 24px;
  padding: 12px 18px;
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--transition-base);
}

.add-space-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  background: none;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--transition-base);
}

.logout-btn:hover {
  border-color: rgba(255,255,255,0.15);
  color: var(--text);
  background: var(--card-hover);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ========== Main Content ========== */
.main-content {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  padding: 40px 48px;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

/* Welcome screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  animation: fadeInScale 600ms var(--transition-bounce);
}

.welcome-screen h1 {
  font-family: var(--font-display);
  color: var(--accent);
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 16px;
  letter-spacing: 0.03em;
}

.welcome-screen p {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 300;
  max-width: 480px;
}

/* Space header */
.space-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 16px;
}

.space-header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.space-icon-large {
  font-size: 2rem;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.03);
  backdrop-filter: blur(10px);
}

.space-title {
  margin-bottom: 4px;
  font-weight: 300;
  letter-spacing: 0.02em;
}

.space-subtitle {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  font-weight: 400;
}

/* Tab bar */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.tab {
  padding: 14px 28px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-base);
}

.tab:hover { 
  color: var(--text-secondary); 
  background: var(--glass);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Content header */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.content-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
  font-weight: 400;
}

/* ========== Buttons ========== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(196, 149, 106, 0.5);
  border-radius: var(--radius-xl);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: none;
}

.btn-primary:hover {
  background: rgba(196, 149, 106, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(196, 149, 106, 0.12);
  transform: none;
}

.btn-primary:active {
  background: rgba(196, 149, 106, 0.12);
  transform: none;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--glass);
  color: var(--text-secondary);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition-base);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  border-color: var(--border-accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover { 
  background: var(--accent-soft); 
  color: var(--text); 
  transform: scale(1.05);
}

/* ========== Cards with Glassmorphism ========== */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.note-card {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 26px;
  cursor: pointer;
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

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

.note-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  background: var(--card-hover);
}

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

.note-card-pin {
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--accent);
  opacity: 0.7;
}

.note-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.35;
}

.note-card-excerpt {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.note-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Note editor */
.note-editor {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
}

.note-editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 28px;
  border-bottom: var(--glass-border);
}

.note-title-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  outline: none;
  letter-spacing: 0.01em;
}

.note-title-input::placeholder { color: var(--text-muted); }

.note-editor-actions { display: flex; gap: 6px; }

.note-content-input {
  width: 100%;
  min-height: 280px;
  padding: 28px;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.9;
  resize: vertical;
  outline: none;
  border-bottom: var(--glass-border);
}

.note-content-input::placeholder { color: var(--text-muted); }

.note-preview {
  padding: 28px;
  font-size: 0.95rem;
  line-height: 1.9;
  max-height: 480px;
  overflow-y: auto;
}

/* ========== Tasks ========== */
.task-input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.task-input {
  flex: 1;
  padding: 14px 20px;
  background: var(--card);
  backdrop-filter: blur(8px);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-base);
}

.task-input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

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

.task-form-inline {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item, .task-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--card);
  backdrop-filter: blur(8px);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.task-item:hover, .task-card:hover {
  border-color: var(--border-accent);
  background: var(--card-hover);
  transform: translateX(4px);
}

.task-item.done, .task-card.done { opacity: 0.5; }

.task-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(196,149,106,0.3);
  background: rgba(20,18,14,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  color: transparent;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
}

.task-checkbox:hover {
  border-color: var(--accent);
  background: rgba(196,149,106,0.1);
}

.task-checkbox.checked {
  background: #1a1510;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(196,149,106,0.25), inset 0 0 8px rgba(196,149,106,0.08);
}

.task-text {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 400;
}

.task-done-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-delete {
  opacity: 0;
  transition: all var(--transition-fast);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.task-item:hover .task-delete, .task-card:hover .task-delete { 
  opacity: 1; 
}

.task-delete:hover { color: var(--rosé); }

/* ========== Lessons ========== */
.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lesson-card {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
}

.lesson-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.lesson-card-header {
  padding: 18px 28px;
  border-bottom: var(--glass-border);
  background: linear-gradient(135deg, var(--accent-glow), var(--rosé-soft));
}

.lesson-date {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lesson-content { padding: 28px; }

/* ========== Markdown body ========== */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-family: var(--font-display);
  color: var(--accent);
  margin: 1.6em 0 0.8em;
  font-weight: 400;
}

.markdown-body h1 { font-size: 1.6rem; }
.markdown-body h2 { font-size: 1.35rem; }
.markdown-body h3 { font-size: 1.15rem; }
.markdown-body h1:first-child, .markdown-body h2:first-child, .markdown-body h3:first-child { margin-top: 0; }

.markdown-body p { 
  margin: 0.8em 0; 
  color: var(--text-secondary); 
  font-size: 0.93rem; 
  line-height: 1.85; 
}

.markdown-body ul, .markdown-body ol { 
  padding-left: 1.6em; 
  margin: 0.8em 0; 
}

.markdown-body li { 
  margin: 0.5em 0; 
  font-size: 0.92rem; 
  color: var(--text-secondary); 
  line-height: 1.7; 
}

.markdown-body strong { 
  color: var(--text); 
  font-weight: 600; 
}

.markdown-body em { 
  color: var(--text-secondary); 
  font-style: italic; 
}

.markdown-body code {
  font-family: var(--font-mono);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.85em;
  color: var(--accent);
}

.markdown-body pre {
  background: var(--surface-solid);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-x: auto;
  margin: 1.2em 0;
}

.markdown-body pre code { 
  background: none; 
  padding: 0; 
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 1.2em 0;
  color: var(--text-muted);
  font-style: italic;
}

.markdown-body hr {
  border: none;
  border-top: var(--glass-border);
  margin: 2.5em 0;
}

/* ========== Chat Panel with Glassmorphism ========== */
.chat-panel {
  width: 0;
  min-width: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-slow), min-width var(--transition-slow);
  z-index: 150;
}

.chat-panel.open {
  width: var(--chat-w);
  min-width: var(--chat-w);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: var(--glass-border);
  min-height: 68px;
}

.chat-header h3 {
  flex: 1;
  font-family: var(--font-display);
  color: var(--accent);
  font-weight: 300;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.chat-space-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  font-style: italic;
}

.chat-bubble {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  animation: messageSlide 300ms var(--transition-bounce);
}

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

.chat-bubble.user { align-self: flex-end; }
.chat-bubble.assistant { align-self: flex-start; }

.chat-bubble-content {
  padding: 14px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  line-height: 1.65;
}

.chat-bubble.user .chat-bubble-content {
  background: linear-gradient(135deg, var(--accent), #b8845e);
  color: #1a1216;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px rgba(196,149,106,0.25);
}

.chat-bubble.assistant .chat-bubble-content {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: var(--glass-border);
  color: var(--text-secondary);
  border-bottom-left-radius: 6px;
}

.chat-bubble-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  padding: 0 8px;
  letter-spacing: 0.03em;
}

.chat-bubble.user .chat-bubble-time { text-align: right; }

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: var(--glass-border);
  background: rgba(28, 25, 31, 0.5);
}

.chat-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--card);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: none;
  outline: none;
  max-height: 140px;
  line-height: 1.55;
  transition: all var(--transition-base);
}

.chat-input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

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

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b8845e);
  color: #1a1216;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(196, 149, 106, 0.25);
}

.chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(196, 149, 106, 0.35);
}

.chat-send-btn:disabled { 
  opacity: 0.3; 
  cursor: not-allowed; 
  transform: none; 
  box-shadow: none; 
}

/* Chat overlay for mobile */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 140;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.chat-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ========== Modal with Glassmorphism ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 90%;
  max-width: 460px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: all var(--transition-bounce);
}

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

.modal h3 {
  font-family: var(--font-display);
  color: var(--accent);
  font-weight: 300;
  font-size: 1.5rem;
  margin-bottom: 28px;
  letter-spacing: 0.03em;
}

.form-group { margin-bottom: 22px; }

.form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="color"] {
  width: 100%;
  padding: 14px 18px;
  background: var(--card);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-base);
}

.form-group input[type="text"]:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-group input[type="color"] {
  height: 48px;
  padding: 6px;
  cursor: pointer;
}

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

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: 72px 28px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-style: italic;
  animation: fadeIn 600ms ease;
}

/* Tab Content */
.tab-content { min-height: 200px; }

/* ========== Dashboard Home Enhanced ========== */
.dashboard-home {
  animation: fadeInScale 500ms var(--transition-bounce);
  max-width: 1100px;
  margin: 0 auto;
}

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

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 20px;
}

.dash-header-left h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 8px 0;
}

.dash-header-left p {
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

/* Analog Clock */
.analog-clock-wrapper {
  flex-shrink: 0;
}

.analog-clock {
  width: 140px;
  height: 140px;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.4));
}

/* Stats Grid */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.dash-stat-card {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.dash-stat-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.dash-stat-card.accent {
  border-color: var(--border-accent);
  background: linear-gradient(135deg, var(--accent-glow), var(--rosé-soft));
}

.dash-stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text);
  transition: transform var(--transition-fast);
}

.dash-stat-card:hover .dash-stat-num {
  transform: scale(1.1);
}

.dash-stat-card.accent .dash-stat-num { color: var(--accent); }

.dash-stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

/* Quote */
.dash-quote {
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 22px 28px;
  margin-bottom: 36px;
  backdrop-filter: blur(4px);
}

.dash-quote-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 300;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
}

/* Sections */
.dash-section { margin-bottom: 36px; }

.dash-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 18px;
  letter-spacing: 0.03em;
}

/* Spaces Grid */
.dash-spaces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.dash-space-card {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  cursor: pointer;
  transition: all var(--transition-slow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.dash-space-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  background: var(--card-hover);
}

.dash-space-card-icon { 
  font-size: 1.6rem; 
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  transition: transform var(--transition-fast);
}

.dash-space-card:hover .dash-space-card-icon {
  transform: scale(1.1);
}

.dash-space-card-name {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Space View */
.space-view { 
  animation: fadeInScale 400ms var(--transition-bounce); 
}

/* ========== Responsive Design ========== */
@media (max-width: 1200px) {
  .main-content { padding: 32px 36px; }
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .main-content { padding: 28px 24px; }
  .dash-header { flex-direction: column; text-align: center; }
  .analog-clock { width: 120px; height: 120px; }
}

@media (max-width: 768px) {
/* Improved mobile header spacing and touch targets */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
  z-index: 1000;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.mobile-header .icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.mobile-header .icon-btn:focus,
.mobile-header .icon-btn:hover {
  background-color: var(--accent-soft);
}

/* Improved sidebar nav for better touch targets */
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  text-align: left;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
  min-height: 52px;
}

/* Better focus states for accessibility */
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.add-space-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 16px 24px;
  padding: 14px 18px;
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 52px;
}

.add-space-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Improved modal accessibility */
.modal {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 460px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: all var(--transition-bounce);
  position: relative;
}

/* Better focus management for modals */
.modal:focus {
  outline: none;
}

/* Enhanced search modal for mobile */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 10002;
}

.search-box {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 560px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  overflow: hidden;
  animation: fadeInScale 200ms var(--transition-bounce);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: var(--glass-border);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.1rem;
  outline: none;
  padding: 8px 0;
  min-height: 44px;
}

.search-results {
  overflow-y: auto;
  flex: 1;
  max-height: calc(70vh - 80px);
}

/* Improved chat panel for mobile */
.chat-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--chat-w);
  min-width: var(--chat-w);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 250;
  transform: translateX(100%);
  transition: transform var(--transition-base);
}

.chat-panel.open {
  transform: translateX(0);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: var(--glass-border);
  flex-shrink: 0;
}

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

.chat-input-area {
  padding: 16px 24px;
  border-top: var(--glass-border);
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--card);
  border: var(--glass-border);
  border-radius: 22px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: none;
  outline: none;
  max-height: 140px;
  line-height: 1.55;
  transition: all var(--transition-base);
  min-height: 48px;
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b8845e);
  color: #1a1216;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(196, 149, 106, 0.25);
}

/* Better focus states for accessibility */
.chat-send-btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Improved skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--accent);
  color: var(--bg);
  padding: 8px;
  z-index: 1001;
  border-radius: 4px;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 6px;
}

/* Better loading bar accessibility */
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(196, 149, 106, 0.2);
  z-index: 1001;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.loading-bar.active {
  transform: scaleY(1);
}

.loading-bar::-webkit-progress-bar {
  background: transparent;
}

.loading-bar::-webkit-progress-value {
  background: var(--accent);
}

.loading-bar::-moz-progress-bar {
  background: var(--accent);
}

  body { padding-top: 60px; }
  
  .mobile-header { display: flex; }

  .sidebar {
    position: fixed;
    top: 60px; left: 0; bottom: 0;
    height: auto;
    transform: translateX(-100%);
    box-shadow: 8px 0 48px rgba(0, 0, 0, 0.5);
    width: 85vw;
    max-width: 320px;
  }
  
  .sidebar.open { transform: translateX(0); }

  .main-content { 
    padding: 20px 16px; 
  }
  
  .space-header { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 16px;
  }
  
  .notes-grid { 
    grid-template-columns: 1fr; 
  }

  .chat-panel {
    position: fixed;
    top: 60px; right: 0; bottom: 0;
    width: 0 !important;
    min-width: 0 !important;
    height: auto;
    z-index: 300;
  }

  .chat-panel.open {
    width: 100% !important;
    min-width: 100% !important;
  }

  .dash-stats-grid { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 12px;
  }
  
  .dash-stat-card { padding: 18px 14px; }
  .dash-stat-num { font-size: 1.6rem; }
  
  .dash-spaces-grid { 
    grid-template-columns: repeat(2, 1fr); 
  }
  
  .dash-header {
    padding: 16px 0 20px;
    text-align: center;
    justify-content: center;
  }
  
  .dash-header-left h1 { font-size: 1.6rem; }
  .analog-clock { width: 100px; height: 100px; }
}

@media (max-width: 480px) {
  .dash-stats-grid { 
    grid-template-columns: 1fr 1fr; 
    gap: 10px;
  }
  
  .dash-stat-card { 
    padding: 16px 12px; 
  }
  
  .dash-stat-num { 
    font-size: 1.4rem; 
  }
  
  .dash-spaces-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .dash-space-card {
    padding: 18px 14px;
  }
  
  .task-form-inline {
    flex-direction: column;
  }
  
  .btn-primary, .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

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

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

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

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

/* Staggered animation for lists */
.note-card:nth-child(1) { animation: slideUp 350ms var(--transition-bounce) 50ms both; }
.note-card:nth-child(2) { animation: slideUp 350ms var(--transition-bounce) 100ms both; }
.note-card:nth-child(3) { animation: slideUp 350ms var(--transition-bounce) 150ms both; }
.note-card:nth-child(4) { animation: slideUp 350ms var(--transition-bounce) 200ms both; }
.note-card:nth-child(5) { animation: slideUp 350ms var(--transition-bounce) 250ms both; }
.note-card:nth-child(6) { animation: slideUp 350ms var(--transition-bounce) 300ms both; }

/* Loading shimmer effect */
.loading-shimmer {
  background: linear-gradient(
    90deg,
    var(--card) 0%,
    var(--card-hover) 50%,
    var(--card) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 0.88rem;
  color: var(--text);
  min-width: 260px;
  max-width: 480px;
  animation: toastIn 300ms var(--transition-bounce);
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.toast:hover { opacity: 0.85; }

.toast.toast-leaving {
  animation: toastOut 250ms ease forwards;
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--rosé); }
.toast.info { border-left: 3px solid var(--accent); }

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--rosé); }
.toast.info .toast-icon { color: var(--accent); }

.toast-msg { flex: 1; line-height: 1.4; }

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

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(80px); }
}

@media (max-width: 480px) {
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: unset; max-width: unset; }
}

/* ========== Confirm Modal ========== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.confirm-box {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: fadeInScale 250ms var(--transition-bounce);
}

.confirm-box p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-actions .btn-danger {
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--rosé), #b5706a);
  color: #1a1216;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 16px rgba(201, 145, 138, 0.25);
}

.confirm-actions .btn-danger:hover {
  box-shadow: 0 6px 24px rgba(201, 145, 138, 0.35);
  transform: translateY(-2px);
}

/* ========== Loading Bar ========== */
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.loading-bar.active { opacity: 1; }

.loading-bar::after {
  content: '';
  position: absolute;
  top: 0; left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #c4956a, #c4a0a8, transparent);
  animation: loadingSlide 1.2s ease-in-out infinite;
}

@keyframes loadingSlide {
  from { left: -40%; }
  to { left: 100%; }
}

@media (max-width: 768px) {
  .loading-bar { top: 60px; }
}

/* ========== Notes List in General Space ========== */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.note-card.clickable {
  cursor: pointer;
}

.note-card .note-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.note-card:hover .note-card-actions {
  opacity: 1;
}

/* ========== Task Deadline & Priority ========== */
.task-deadline-input, .task-priority-select {
  padding: 12px 14px;
  background: var(--card);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-base);
}

.task-deadline-input { max-width: 160px; }
.task-priority-select { max-width: 90px; }

.task-deadline-input:focus, .task-priority-select:focus {
  border-color: var(--border-accent);
}

.task-card.overdue {
  border-left: 3px solid var(--rosé);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.task-deadline-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.task-card.overdue .task-deadline-badge {
  color: var(--rosé);
  font-weight: 500;
}

.task-priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.task-priority-dot.priority-high { background: var(--rosé); box-shadow: 0 0 6px var(--rosé); }
.task-priority-dot.priority-medium { background: var(--accent); }
.task-priority-dot.priority-low { background: var(--text-muted); }

@media (max-width: 480px) {
  .task-deadline-input, .task-priority-select { max-width: unset; }
}

/* ========== Search Modal ========== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 10002;
}

.search-box {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 560px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  overflow: hidden;
  animation: fadeInScale 200ms var(--transition-bounce);
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: var(--glass-border);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
}

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

.search-shortcut {
  font-size: 0.65rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}

.search-results {
  max-height: 360px;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.search-result:hover {
  background: var(--accent-soft);
}

.search-result-icon { font-size: 1.1rem; }

.search-result-info { flex: 1; display: flex; flex-direction: column; }

.search-result-title {
  font-size: 0.9rem;
  color: var(--text);
}

.search-result-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.search-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ========== Kanban Board ========== */
.kb-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  min-height: 300px;
}

@media (max-width: 900px) {
  .kb-board {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.kb-column {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.kb-column.kb-drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow), 0 8px 32px rgba(196, 149, 106, 0.15);
}

.kb-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: var(--glass-border);
}

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

.kb-dot-todo { background: var(--text-muted); box-shadow: 0 0 8px rgba(122, 117, 133, 0.4); }
.kb-dot-doing { background: var(--accent); box-shadow: 0 0 8px rgba(196, 149, 106, 0.5); }
.kb-dot-done { background: var(--success); box-shadow: 0 0 8px rgba(138, 171, 142, 0.5); }

.kb-column-title {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.kb-column-count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 2px 8px;
  min-width: 24px;
  text-align: center;
}

.kb-cards {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 420px;
}

.kb-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: grab;
  transition: all var(--transition-base);
  position: relative;
}

.kb-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  background: var(--card-hover);
}

.kb-card:active {
  cursor: grabbing;
}

.kb-card.kb-dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}

.kb-card.kb-overdue {
  border-left: 3px solid var(--rosé);
}

.kb-card-done {
  opacity: 0.55;
}

.kb-card-done .kb-card-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.kb-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kb-card-space {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kb-priority-badge {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
}

.kb-p-high { background: rgba(201, 145, 138, 0.15); color: var(--rosé); }
.kb-p-medium { background: rgba(196, 149, 106, 0.12); color: var(--accent); }
.kb-p-low { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); }

.kb-card-text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.kb-card-bottom {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-card-deadline {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kb-card-deadline::before {
  content: '⏳';
  font-size: 0.72rem;
}

.kb-card-deadline.overdue {
  color: var(--rosé);
  font-weight: 500;
}

.kb-card-deadline.overdue::before {
  content: '⚠️';
}

.kb-empty {
  padding: 24px 16px;
  text-align: center;
}

.kb-empty p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* Kanban quick-add */
.kb-add-form {
  border-top: var(--glass-border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.kb-add-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.kb-add-input:focus {
  border-color: var(--border-accent);
}

.kb-add-input::placeholder { color: var(--text-muted); }

.kb-add-space {
  flex: 1;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.78rem;
  outline: none;
}

.kb-add-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent), #b8845e);
  color: #1a1216;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.kb-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(196, 149, 106, 0.3);
}

/* Column-specific accents */
.kb-todo .kb-column-header { border-bottom-color: rgba(122, 117, 133, 0.2); }
.kb-doing .kb-column-header { border-bottom-color: rgba(196, 149, 106, 0.2); }
.kb-done .kb-column-header { border-bottom-color: rgba(138, 171, 142, 0.2); }

.kb-doing.kb-drag-over { border-color: var(--accent); }
.kb-done.kb-drag-over { border-color: var(--success); }
.kb-todo.kb-drag-over { border-color: var(--text-muted); }

/* Animation for cards entering */
.kb-card {
  animation: kbCardIn 250ms var(--transition-bounce);
}

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

/* ========================================
   MARVIN CHAT — WhatsApp-Style Interface
   ======================================== */

.marvin-chat-view {
  height: calc(100vh - 80px);
  max-width: 1100px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

.marvin-chat-layout {
  display: flex;
  height: 100%;
}

/* Conversation Sidebar */
.marvin-convos {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.marvin-convos-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text);
}

.marvin-convo-new {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--accent);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.marvin-convo-new:hover {
  background: rgba(196,149,106,0.08);
  border-color: var(--accent);
}

.marvin-convos-list {
  flex: 1;
  overflow-y: auto;
}

.marvin-convo-item {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}
.marvin-convo-item:hover {
  background: rgba(196,149,106,0.04);
}
.marvin-convo-item.active {
  background: rgba(196,149,106,0.08);
  border-left-color: var(--accent);
}

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

.marvin-convo-name {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.marvin-convo-preview {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marvin-convo-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.marvin-convo-time {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.marvin-convo-delete {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  transition: all 0.15s ease;
}
.marvin-convo-item:hover .marvin-convo-delete { opacity: 0.5; }
.marvin-convo-delete:hover { opacity: 1 !important; color: #e88; }

/* Chat Main Area */
.marvin-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

@media (max-width: 768px) {
  .marvin-convos { width: 100%; position: absolute; z-index: 10; }
  .marvin-chat-layout { position: relative; }
}

/* Header — WhatsApp-style compact */
.marvin-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.marvin-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.marvin-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marvin-chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.marvin-chat-name {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.marvin-chat-status {
  font-size: 0.75rem;
  color: #7ec87e;
  display: flex;
  align-items: center;
  gap: 6px;
}

.marvin-chat-status::before {
  content: '';
  width: 7px; height: 7px;
  background: #7ec87e;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(126, 200, 126, 0.5);
  animation: pulseOnline 2s ease-in-out infinite;
}

@keyframes pulseOnline {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.marvin-chat-new-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.marvin-chat-new-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Messages Area */
.marvin-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(196, 149, 106, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(196, 149, 106, 0.015) 1px, transparent 1px);
  background-size: 48px 48px, 72px 72px;
  scroll-behavior: smooth;
}

/* Welcome State */
.marvin-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 40px 20px;
}

.marvin-welcome-icon {
  margin-bottom: 20px;
}

.marvin-welcome-icon img {
  width: 96px; height: 96px;
  border-radius: 50%;
  box-shadow: 0 4px 30px rgba(196, 149, 106, 0.25), 0 0 50px rgba(196, 149, 106, 0.08);
  animation: welcomeGlow 3s ease-in-out infinite;
}

@keyframes welcomeGlow {
  0%, 100% { box-shadow: 0 4px 30px rgba(196, 149, 106, 0.25), 0 0 50px rgba(196, 149, 106, 0.08); }
  50% { box-shadow: 0 4px 40px rgba(196, 149, 106, 0.35), 0 0 70px rgba(196, 149, 106, 0.12); }
}

.marvin-welcome-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text);
  margin: 0 0 8px;
}

.marvin-welcome-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 320px;
}

.marvin-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 420px;
}

.marvin-suggestion {
  padding: 10px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.marvin-suggestion:hover {
  border-color: rgba(196,149,106,0.4);
  color: var(--text);
  transform: translateY(-1px);
  background: rgba(196,149,106,0.06);
}

/* Message Bubbles — WhatsApp style */
.marvin-message {
  display: flex;
  gap: 8px;
  max-width: 75%;
  margin-bottom: 2px;
  animation: msgIn 250ms ease-out;
}

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

.marvin-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.marvin-message.assistant {
  align-self: flex-start;
}

.marvin-message-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600;
  margin-top: 4px;
  overflow: hidden;
}

.marvin-message.user .marvin-message-avatar {
  background: linear-gradient(135deg, var(--accent), #b8845e);
  color: var(--bg);
}

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

.marvin-message-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.marvin-message-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
  position: relative;
}

/* User bubble — warm amber tint */
.marvin-message.user .marvin-message-bubble {
  background: rgba(196, 149, 106, 0.15);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

/* Marvin bubble — dark surface */
.marvin-message.assistant .marvin-message-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.marvin-message-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
  padding: 0 4px;
}

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

/* Typing indicator — three dots */
.marvin-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
}

.marvin-typing span {
  width: 8px; height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  opacity: 0.5;
  animation: typingDot 1.4s ease-in-out infinite;
}

.marvin-typing span:nth-child(1) { animation-delay: 0s; }
.marvin-typing span:nth-child(2) { animation-delay: 0.2s; }
.marvin-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input Area — WhatsApp bottom bar */
.marvin-chat-input-area {
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.marvin-chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 750px;
  margin: 0 auto;
}

.marvin-chat-input {
  flex: 1;
  padding: 12px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.2s ease;
}

.marvin-chat-input:focus {
  border-color: rgba(196,149,106,0.4);
}

.marvin-chat-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.marvin-chat-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.marvin-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(196, 149, 106, 0.3);
}

.marvin-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.marvin-input-hint {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin: 6px 0 0;
}

/* Responsive */
@media (max-width: 768px) {
  .marvin-chat-view { height: calc(100vh - 60px); }
  .marvin-message { max-width: 88%; }
  .marvin-chat-messages { padding: 12px; }
}

/* ========================================
   KANBAN BOARD — Feature Requests
   ======================================== */

.kanban-space { padding: 0; }

.kanban-board {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  overflow-x: auto;
  min-height: 500px;
}

.kanban-column {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease;
}
.kanban-column.drag-over { border-color: var(--accent); background: rgba(196,149,106,0.03); }

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.kanban-column-title { font-weight: 600; font-size: 0.85rem; color: var(--text); }
.kanban-column-subtitle { font-size: 0.7rem; color: var(--text-muted); }
.kanban-column-count {
  margin-left: auto;
  font-size: 0.7rem; color: var(--text-muted);
  background: var(--card); border-radius: 10px; padding: 2px 8px;
}

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

.kanban-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.kanban-card:hover { border-color: rgba(196,149,106,0.3); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card-done { opacity: 0.5; }
.kanban-card-done .kanban-card-title { text-decoration: line-through; color: #9caf88; }

.kanban-card-title { font-size: 0.85rem; color: var(--text); font-weight: 500; margin-bottom: 6px; }
.kanban-card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.kanban-badge { font-size: 0.68rem; padding: 2px 8px; border-radius: 10px; }
.kanban-badge-feature { background: rgba(196,149,106,0.12); color: var(--accent); }
.kanban-badge-bug { background: rgba(220,80,80,0.12); color: #dc5050; }

.kanban-priority { font-size: 0.7rem; }
.kanban-comment-count { font-size: 0.68rem; color: var(--text-muted); }
.kanban-retry { font-size: 0.68rem; color: var(--text-muted); }

.kanban-fix-indicator, .kanban-qa-indicator {
  font-size: 0.7rem; color: var(--accent); margin-top: 6px; opacity: 0.8;
  animation: pulse 2s ease-in-out infinite;
}
.kanban-qa-indicator { color: #9b8ec4; }
@keyframes pulse { 0%,100% { opacity: 0.8; } 50% { opacity: 0.4; } }

.kanban-review-actions { display: flex; gap: 8px; margin-top: 8px; }
.kanban-approve-btn, .kanban-reject-btn {
  font-size: 0.72rem; padding: 4px 12px; border-radius: 8px; border: none; cursor: pointer;
  transition: all 0.15s ease;
}
.kanban-approve-btn { background: rgba(156,175,136,0.15); color: #9caf88; }
.kanban-approve-btn:hover { background: rgba(156,175,136,0.25); }
.kanban-reject-btn { background: rgba(220,80,80,0.1); color: #dc5050; }
.kanban-reject-btn:hover { background: rgba(220,80,80,0.2); }

/* Add form */
.kanban-add-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.kanban-add-input {
  width: 100%; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 0.82rem; font-family: var(--font-body);
}
.kanban-add-input:focus { border-color: var(--accent); outline: none; }
.kanban-add-row { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.kanban-type-toggle {
  font-size: 0.72rem; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: none; color: var(--text-muted); cursor: pointer;
}
.kanban-type-toggle.active { border-color: var(--accent); color: var(--accent); background: rgba(196,149,106,0.06); }
.kanban-add-btn {
  font-size: 0.72rem; padding: 4px 14px; border-radius: 8px;
  border: none; background: var(--accent); color: var(--bg); cursor: pointer; margin-left: auto;
}

/* Detail Modal */
.kanban-detail-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center;
  z-index: 10001;
}
.kanban-detail-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  width: 90%; max-width: 560px; max-height: 85vh; overflow-y: auto; padding: 24px;
}
.kanban-detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.kanban-detail-title {
  flex: 1; font-size: 1.1rem; font-family: var(--font-display); color: var(--text);
  background: none; border: none; border-bottom: 1px solid var(--border); padding: 4px 0;
}
.kanban-detail-title:focus { border-color: var(--accent); outline: none; }
.kanban-detail-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }

.kanban-detail-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.kanban-detail-row label { font-size: 0.78rem; color: var(--text-muted); width: 80px; flex-shrink: 0; }
.kanban-detail-row select {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 0.82rem;
}
.kanban-detail-column { font-size: 0.82rem; color: var(--text-muted); text-transform: capitalize; }
.kanban-detail-retry { font-size: 0.82rem; color: var(--accent); }

.kanban-detail-description { margin-bottom: 16px; }
.kanban-detail-description label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }
.kanban-detail-description textarea {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 0.85rem; font-family: var(--font-body);
  resize: vertical;
}

.kanban-detail-footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.kanban-delete-btn {
  font-size: 0.78rem; padding: 6px 16px; border-radius: 8px;
  border: 1px solid rgba(220,80,80,0.3); background: none; color: #dc5050; cursor: pointer;
}

/* Comments */
.kanban-comments { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.kanban-comments label { display: block; font-size: 0.85rem; color: var(--text); margin-bottom: 12px; font-weight: 500; }
.kanban-comment { padding: 10px; background: var(--card); border-radius: 8px; margin-bottom: 8px; }
.kanban-comment-reply { margin-left: 24px; border-left: 2px solid var(--accent); }
.kanban-comment-header { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.kanban-comment-author { font-size: 0.78rem; font-weight: 600; color: var(--accent); }
.kanban-comment-time { font-size: 0.65rem; color: var(--text-muted); }
.kanban-comment-content { font-size: 0.82rem; color: var(--text); line-height: 1.4; }
.kanban-comment-actions { display: flex; gap: 8px; margin-top: 6px; }
.kanban-comment-reply-btn, .kanban-comment-delete {
  font-size: 0.68rem; padding: 2px 8px; border: none; background: none;
  color: var(--text-muted); cursor: pointer;
}
.kanban-comment-reply-btn:hover { color: var(--accent); }
.kanban-comment-delete:hover { color: #dc5050; }

.kanban-reply-form, .kanban-add-comment { display: flex; gap: 8px; margin-top: 8px; }
.kanban-reply-form input, .kanban-add-comment input {
  flex: 1; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 0.8rem;
}
.kanban-reply-form button, .kanban-add-comment button {
  padding: 6px 12px; border-radius: 8px; border: none;
  background: var(--accent); color: var(--bg); font-size: 0.78rem; cursor: pointer;
}
.kanban-reply-cancel { background: var(--surface) !important; color: var(--text-muted) !important; border: 1px solid var(--border) !important; }

/* Column accent colors */
.kanban-fix { border-top: 3px solid var(--accent); }
.kanban-qa { border-top: 3px solid #9b8ec4; }
.kanban-review { border-top: 3px solid #7ea8c8; }
.kanban-done { border-top: 3px solid #9caf88; }

/* Responsive */
@media (max-width: 768px) {
  .kanban-board { flex-direction: column; }
  .kanban-column { max-width: none; min-width: auto; }
}

/* Ideas Tab */
.fr-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.fr-tab {
  padding: 8px 20px; border-radius: 20px; border: 1px solid var(--border);
  background: none; color: var(--text-muted); font-size: 0.85rem; cursor: pointer;
  transition: all 0.15s ease;
}
.fr-tab.active { border-color: var(--accent); color: var(--accent); background: rgba(196,149,106,0.06); }

.fr-ideas-header { margin-bottom: 20px; }
.fr-ideas-header h3 { font-family: var(--font-display); font-size: 1.1rem; color: var(--text); margin: 0 0 4px; }
.fr-ideas-sub { font-size: 0.82rem; color: var(--text-muted); margin: 0; }

.fr-ideas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.fr-idea-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; transition: all 0.15s ease;
}
.fr-idea-card:hover { border-color: rgba(196,149,106,0.3); }
.fr-idea-icon { font-size: 1.5rem; margin-bottom: 8px; }
.fr-idea-title { font-size: 0.95rem; color: var(--text); font-weight: 500; margin-bottom: 6px; }
.fr-idea-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 12px; }
.fr-idea-actions { display: flex; gap: 8px; }
.fr-idea-backlog {
  font-size: 0.78rem; padding: 6px 14px; border-radius: 8px;
  border: 1px solid rgba(196,149,106,0.3); background: none; color: var(--accent); cursor: pointer;
}
.fr-idea-backlog:hover { background: rgba(196,149,106,0.08); }
.fr-idea-dismiss {
  font-size: 0.85rem; padding: 6px 10px; border-radius: 8px;
  border: none; background: none; color: var(--text-muted); cursor: pointer;
}
.fr-ideas-empty { text-align: center; padding: 40px; color: var(--text-muted); font-style: italic; }

/* Kanban Attachments */
.kanban-attachments { margin-bottom: 16px; }
.kanban-attachments > label { display: block; font-size: 0.85rem; color: var(--text); margin-bottom: 10px; font-weight: 500; }
.kanban-att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-bottom: 10px; }
.kanban-att-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.kanban-att-item:hover .kanban-att-del { opacity: 1; }
.kanban-att-img { width: 100%; height: 80px; object-fit: cover; display: block; cursor: pointer; }
.kanban-att-file {
  display: block; padding: 8px; font-size: 0.72rem; color: var(--text-muted);
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
}
.kanban-att-del {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.6); color: #fff;
  font-size: 0.65rem; cursor: pointer; opacity: 0; transition: opacity 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.kanban-att-upload-btn {
  display: inline-block; padding: 6px 14px; border-radius: 8px;
  border: 1px dashed var(--border); color: var(--text-muted); font-size: 0.8rem;
  cursor: pointer; transition: all 0.15s;
}
.kanban-att-upload-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Kanban Chat Panel */
.kanban-chat-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 0.85rem;
  cursor: pointer; transition: all 0.15s; margin-left: auto;
}
.kanban-chat-btn:hover { border-color: var(--accent); }
.kanban-chat-btn.active { border-color: var(--accent); background: rgba(196,149,106,0.08); }

.kanban-chat-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 90vw;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
}
.kanban-chat-panel.open { transform: translateX(0); }

.kanban-chat-header {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.kanban-chat-close {
  background: none; border: none; color: var(--text-muted); font-size: 1.2rem;
  cursor: pointer; padding: 4px;
}

.kanban-chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.kanban-chat-msg { display: flex; }
.kanban-chat-msg.user { justify-content: flex-end; }
.kanban-chat-bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 16px;
  font-size: 0.85rem; line-height: 1.5;
}
.kanban-chat-msg.user .kanban-chat-bubble {
  background: linear-gradient(135deg, var(--accent), rgba(196,149,106,0.8));
  color: var(--bg);
}
.kanban-chat-msg.assistant .kanban-chat-bubble {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border);
}

.kanban-chat-input-wrap {
  display: flex; gap: 10px; padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.kanban-chat-input {
  flex: 1; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 0.85rem; font-family: var(--font-body);
  resize: none; max-height: 120px;
}
.kanban-chat-input:focus { border-color: var(--accent); outline: none; }
.kanban-chat-send {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: var(--accent); color: var(--bg);
  font-size: 1rem; cursor: pointer; flex-shrink: 0;
  transition: all 0.15s;
}
.kanban-chat-send:disabled { opacity: 0.3; cursor: not-allowed; }

.typing-indicator { display: flex; gap: 4px; padding: 4px 0; }
.typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted);
  animation: typing-bounce 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

@media (max-width: 768px) {
  .kanban-chat-panel {
    width: 100vw;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 80px;
    height: auto;
    transform: translateX(100%);
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
  }
  .kanban-chat-panel.open {
    transform: translateX(0);
  }
  .kanban-chat-input-wrap {
    padding: 12px 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }
  .kanban-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
}

/* Kanban Chat Improvements */
.kanban-chat-bubble {
  position: relative;
}
.kanban-chat-bubble > div {
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.kanban-chat-bubble pre {
  background: rgba(0,0,0,0.2);
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.8rem;
  margin: 6px 0;
}
.kanban-chat-bubble code {
  background: rgba(0,0,0,0.15);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.82em;
  font-family: var(--font-mono);
}
.kanban-chat-bubble pre code {
  background: none;
  padding: 0;
}
.kanban-chat-bubble p {
  margin: 0 0 8px 0;
}
.kanban-chat-bubble p:last-child {
  margin-bottom: 0;
}
.kanban-chat-bubble ul, .kanban-chat-bubble ol {
  margin: 4px 0;
  padding-left: 20px;
}
.kanban-chat-time {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
  text-align: right;
}
.kanban-chat-msg.assistant .kanban-chat-time {
  color: var(--text-muted);
  text-align: left;
}

.kanban-chat-input {
  min-height: 40px;
  max-height: 150px;
  overflow-y: auto;
}

.kanban-send-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* More chat polish */
.kanban-chat-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(196,149,106,0.2) transparent;
}
.kanban-chat-messages::-webkit-scrollbar {
  width: 6px;
}
.kanban-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.kanban-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(196,149,106,0.2);
  border-radius: 3px;
}
.kanban-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(196,149,106,0.3);
}

.kanban-chat-msg {
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kanban-chat-bubble a {
  color: inherit;
  text-decoration: underline;
  opacity: 0.9;
}
.kanban-chat-bubble a:hover {
  opacity: 1;
}

/* Kanban Chat Backdrop */
.kanban-chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;
}
.kanban-chat-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Improved close button */
.kanban-chat-close {
  transition: all 0.15s ease;
}
.kanban-chat-close:hover {
  color: var(--accent);
  transform: scale(1.1);
}

/* Color Palette Picker */
.color-palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.color-swatch:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.3);
}
.color-swatch.active {
  border-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.05);
}
.color-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.6);
  font-size: 1rem;
  font-weight: bold;
}

/* ===== Global Hover Effects ===== */

/* Cards - lift on hover */
.journal-type-card,
.journal-resource-card,
.lesson-card,
.kanban-item,
.note-card,
.space-card,
.sw-vocab-card,
.sw-grammar-card,
.sw-log-card,
.sw-win-card,
.reading-list-content li {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.journal-type-card:hover,
.journal-resource-card:hover,
.lesson-card:hover,
.note-card:hover,
.sw-vocab-card:hover,
.sw-grammar-card:hover,
.sw-log-card:hover,
.sw-win-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

/* Buttons - subtle highlight */
button:not(.journal-tab):not(.sw-tab):not(.fr-tab):hover {
  filter: brightness(1.1);
}

/* Input fields - border highlight on focus */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.1);
}

/* Calendar events - highlight on hover */
.cal-event {
  transition: all 0.15s;
}

.cal-event:hover {
  background: var(--accent) !important;
  color: white !important;
  transform: scale(1.02);
  z-index: 10;
}

/* Kanban items - lift and highlight */
.kanban-item {
  cursor: pointer;
}

.kanban-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  border-color: var(--accent);
}

/* Space selector cards - glow on hover */
.space-card:hover {
  border-color: var(--accent);
  background: rgba(196, 149, 106, 0.03);
}

/* Task/habit items - subtle highlight */
.journal-task-item:hover,
.habit-item:hover {
  background: var(--surface);
}

/* Note list items */
.note-list-item {
  transition: all 0.2s;
}

.note-list-item:hover {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateX(4px);
}

/* Meaning cards (Swedish dashboard) - lift */
.sw-meaning-card {
  transition: all 0.25s;
}

.sw-meaning-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border-color: var(--accent);
}

/* Vocabulary/Grammar cards - subtle lift */
.sw-vocab-card:hover .sw-vocab-word,
.sw-grammar-card:hover .sw-grammar-title {
  color: var(--accent);
}

/* Icon buttons - scale on hover */
.icon-btn {
  transition: all 0.15s;
}

.icon-btn:hover {
  transform: scale(1.1);
  color: var(--accent);
}

/* Delete buttons - red on hover */
.icon-btn:hover svg,
button:hover svg {
  stroke: currentColor;
}

button[title*="Delete"]:hover,
button[title*="delete"]:hover {
  color: #c9918a;
}

/* Links - underline on hover */
a:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* Flashcard hover */
.fc-card {
  transition: all 0.3s;
}

.fc-card:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* PDF/Resource download buttons */
a[download]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(196, 149, 106, 0.3);
}

/* Smooth cursor transitions */
[role="button"],
button,
.clickable,
a {
  cursor: pointer;
}

/* Disabled state - no hover */
button:disabled,
input:disabled,
[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

button:disabled:hover,
input:disabled:hover {
  transform: none;
  box-shadow: none;
}
