:root {
  /* ==============================================
     DESIGN SYSTEM TOKENS
     ============================================== */

  /* Colors - Primary Palette */
  --ink: #141320;
  --ink-2: #2b2a3a;
  --muted: #5a556d;
  /* Updated: 5.3:1 contrast ratio (was 4.4:1) - WCAG AA compliant */
  --paper: #f8f5f1;
  --paper-2: #f2efe9;
  --surface: #ffffff;
  /* Card/container backgrounds */

  /* Colors - Brand Accents */
  --accent: #ff6b5a;
  /* Primary - Coral/Orange */
  --accent-2: #f7c44c;
  /* Secondary - Yellow */
  --accent-3: #53c6b7;
  /* Tertiary - Teal */
  --accent-purple: #6366f1;
  /* Feature highlight - Purple */
  --accent-purple-2: #8b5cf6;
  /* Feature highlight - Purple light */

  /* Colors - Semantic */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  /* Password Strength Colors */
  --strength-weak: #ef4444;
  --strength-fair: #f97316;
  --strength-good: #f59e0b;
  --strength-strong: #22c55e;

  /* Colors - Gradients */
  --gradient-primary: linear-gradient(135deg, var(--accent) 0%, #ff9f43 100%);
  --gradient-purple: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-purple-2) 100%);
  --gradient-sidebar: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);

  /* Typography - Font Sizes (using modular scale ~1.25) */
  --text-xs: 0.75rem;
  /* 12px */
  --text-sm: 0.875rem;
  /* 14px */
  --text-base: 1rem;
  /* 16px */
  --text-lg: 1.125rem;
  /* 18px */
  --text-xl: 1.25rem;
  /* 20px */
  --text-2xl: 1.5rem;
  /* 24px */
  --text-3xl: 1.875rem;
  /* 30px */
  --text-4xl: 2.25rem;
  /* 36px */
  --text-5xl: 3rem;
  /* 48px */

  /* Typography - Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Typography - Font Families (Unified) */
  --font-brand: "Fraunces", Georgia, serif;
  --font-body: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;

  /* Border - Lightweight */
  --border-light: rgba(20, 19, 32, 0.06);
  --border-default: rgba(20, 19, 32, 0.10);
  --border-strong: rgba(20, 19, 32, 0.14);

  /* Spacing - 8px base grid system */
  --space-1: 0.25rem;
  /* 4px */
  --space-2: 0.5rem;
  /* 8px */
  --space-3: 0.75rem;
  /* 12px */
  --space-4: 1rem;
  /* 16px */
  --space-5: 1.25rem;
  /* 20px */
  --space-6: 1.5rem;
  /* 24px */
  --space-8: 2rem;
  /* 32px */
  --space-10: 2.5rem;
  /* 40px */
  --space-12: 3rem;
  /* 48px */
  --space-16: 4rem;
  /* 64px */

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 22px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(20, 19, 32, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 19, 32, 0.1);
  --shadow-lg: 0 16px 40px rgba(20, 19, 32, 0.14);
  --shadow-xl: 0 20px 60px rgba(20, 19, 32, 0.18);
  --shadow-hover: 0 12px 32px rgba(20, 19, 32, 0.16);
  --shadow-card-hover: 0 16px 48px rgba(20, 19, 32, 0.12);
  --shadow: var(--shadow-xl);
  /* Keep for backwards compatibility */
  --radius: var(--radius-2xl);
  /* Keep for backwards compatibility */
  --grid: minmax(0, 1fr);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Button sizing */
  --btn-padding-sm: 8px 14px;
  --btn-padding-md: 12px 22px;
  --btn-padding-lg: 16px 28px;
  --btn-radius: var(--radius-full);
  --btn-radius-square: var(--radius-md);

  /* Focus ring - unified to theme color */
  --focus-ring: 0 0 0 3px rgba(var(--theme-accent-rgb), 0.25);
  --focus-ring-teal: 0 0 0 3px rgba(var(--theme-accent-rgb), 0.25);
  --focus-ring-purple: 0 0 0 3px rgba(99, 102, 241, 0.2);
  --focus-ring-danger: 0 0 0 3px rgba(239, 68, 68, 0.2);

  /* Unified Primary Accent - wired dynamically to theme accent */
  --primary: var(--theme-accent);
  --primary-strong: color-mix(in srgb, var(--theme-accent), black 20%);
  --primary-light: color-mix(in srgb, var(--theme-accent), white 20%);
  --primary-soft: rgba(var(--theme-accent-rgb), 0.12);
  --primary-rgb: var(--theme-accent-rgb);

  /* Z-Index Layers (use these values consistently across all pages) */
  --z-dropdown: 50;
  --z-sticky: 60;
  --z-overlay: 90;
  --z-sidebar: 100;
  --z-modal: 1000;
  --z-toast: 1100;
  --z-loading: 2000;

  /* Custom Theme Color (can be overridden by user preference) */
  --theme-accent: var(--accent);
  --theme-accent-rgb: 255, 107, 90;
  --theme-gradient: linear-gradient(135deg, var(--theme-accent) 0%, #ff9f43 100%);
}

/* ==============================================
   DARK MODE SUPPORT
   ============================================== */
[data-theme="dark"] {
  /* Colors - Primary Palette (Dark) */
  --ink: #f0eff4;
  --ink-2: #b8b5c4;
  --muted: #9ca3af;
  /* Improved contrast: 4.6:1 ratio */
  --paper: #121218;
  --paper-2: #1a1a24;

  /* Border - Dark mode */
  --border-light: rgba(255, 255, 255, 0.08);
  --border-default: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.16);
  --surface: #1a1a24;
  /* Card/container backgrounds (dark) */

  /* Colors - Semantic (adjusted for dark) */
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;

  /* Password Strength Colors (Dark) */
  --strength-weak: #f87171;
  --strength-fair: #fb923c;
  --strength-good: #fbbf24;
  --strength-strong: #34d399;

  /* Colors - Gradients (Dark) */
  --gradient-sidebar: linear-gradient(180deg, #0d0d14 0%, #121220 100%);

  /* Shadows (Dark - more subtle) */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 16px 48px rgba(0, 0, 0, 0.3);

  /* Focus ring (Dark) */
  --focus-ring: 0 0 0 3px rgba(var(--theme-accent-rgb), 0.3);
  --focus-ring-purple: 0 0 0 3px rgba(99, 102, 241, 0.3);

  color-scheme: dark;
}

/* Theme transition - smooth color changes when switching themes */
html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    fill 0.3s ease,
    stroke 0.3s ease !important;
}

/* Theme transition overlay effect */
.theme-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
}

.theme-transition-overlay.active {
  animation: themeTransitionFlash 0.4s ease-out;
}

@keyframes themeTransitionFlash {
  0% {
    opacity: 0;
    background: radial-gradient(circle at var(--transition-x, 50%) var(--transition-y, 50%),
        rgba(83, 198, 183, 0.3) 0%,
        transparent 70%);
  }

  40% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    background: radial-gradient(circle at var(--transition-x, 50%) var(--transition-y, 50%),
        transparent 0%,
        transparent 100%);
  }
}

/* Dark mode transition uses different color */
[data-theme="dark"] .theme-transition-overlay.active {
  animation: themeTransitionFlashDark 0.4s ease-out;
}

@keyframes themeTransitionFlashDark {
  0% {
    opacity: 0;
    background: radial-gradient(circle at var(--transition-x, 50%) var(--transition-y, 50%),
        rgba(255, 255, 255, 0.15) 0%,
        transparent 70%);
  }

  40% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    background: radial-gradient(circle at var(--transition-x, 50%) var(--transition-y, 50%),
        transparent 0%,
        transparent 100%);
  }
}

/* Reduced motion - disable theme transition animation */
@media (prefers-reduced-motion: reduce) {

  html.theme-transitioning,
  html.theme-transitioning *,
  html.theme-transitioning *::before,
  html.theme-transitioning *::after {
    transition: none !important;
  }

  .theme-transition-overlay.active {
    animation: none;
  }
}

/* Dark mode body background */
[data-theme="dark"] body {
  background: radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.1), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(83, 198, 183, 0.08), transparent 60%),
    radial-gradient(circle at 10% 90%, rgba(255, 107, 90, 0.08), transparent 55%),
    var(--paper);
}

/* System preference detection (only if no explicit theme set) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f0eff4;
    --ink-2: #b8b5c4;
    --muted: #8a8698;
    --paper: #121218;
    --paper-2: #1a1a24;
    --surface: #1a1a24;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    --gradient-sidebar: linear-gradient(180deg, #0d0d14 0%, #121220 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-card-hover: 0 16px 48px rgba(0, 0, 0, 0.3);
    --focus-ring: 0 0 0 3px rgba(var(--theme-accent-rgb), 0.3);
    --focus-ring-purple: 0 0 0 3px rgba(99, 102, 241, 0.3);
    color-scheme: dark;
  }

  :root:not([data-theme="light"]) body {
    background: radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.1), transparent 55%),
      radial-gradient(circle at 80% 20%, rgba(83, 198, 183, 0.08), transparent 60%),
      radial-gradient(circle at 10% 90%, rgba(255, 107, 90, 0.08), transparent 55%),
      var(--paper);
  }
}

/* ==============================================
   CUSTOM THEME COLORS (User Preference)
   ============================================== */
/* Coral/Orange (Default) */
[data-accent="coral"] {
  --theme-accent: #ff6b5a;
  --theme-accent-rgb: 255, 107, 90;
  --theme-gradient: linear-gradient(135deg, #ff6b5a 0%, #ff9f43 100%);
}

/* Purple */
[data-accent="purple"] {
  --theme-accent: #6366f1;
  --theme-accent-rgb: 99, 102, 241;
  --theme-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

/* Teal */
[data-accent="teal"] {
  --theme-accent: #14b8a6;
  --theme-accent-rgb: 20, 184, 166;
  --theme-gradient: linear-gradient(135deg, #14b8a6 0%, #53c6b7 100%);
}

/* Blue */
[data-accent="blue"] {
  --theme-accent: #3b82f6;
  --theme-accent-rgb: 59, 130, 246;
  --theme-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

/* Pink */
[data-accent="pink"] {
  --theme-accent: #ec4899;
  --theme-accent-rgb: 236, 72, 153;
  --theme-gradient: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
}

/* Green */
[data-accent="green"] {
  --theme-accent: #22c55e;
  --theme-accent-rgb: 34, 197, 94;
  --theme-gradient: linear-gradient(135deg, #22c55e 0%, #4ade80 100%);
}

/* ==============================================
   SKELETON LOADING COMPONENTS
   ============================================== */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(90deg,
      var(--paper-2) 25%,
      rgba(255, 255, 255, 0.5) 50%,
      var(--paper-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: var(--radius-md);
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg,
      var(--paper-2) 25%,
      rgba(255, 255, 255, 0.08) 50%,
      var(--paper-2) 75%);
  background-size: 200% 100%;
}

/* Skeleton variants */
.skeleton-text {
  height: 1em;
  width: 100%;
  margin-bottom: var(--space-2);
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-title {
  height: 1.5em;
  width: 70%;
  margin-bottom: var(--space-3);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-avatar.large {
  width: 64px;
  height: 64px;
}

.skeleton-button {
  height: 40px;
  width: 120px;
  border-radius: var(--btn-radius);
}

.skeleton-card {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
}

.skeleton-card-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
}

.skeleton-image.square {
  aspect-ratio: 1;
  height: auto;
}

/* Skeleton list item */
.skeleton-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.skeleton-list-item .skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ==============================================
   SHARED COMPONENT STYLES
   ============================================== */

/* Sidebar Base - Unified sidebar styling */
.sidebar-base {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, var(--surface, #fff) 0%, var(--paper-2, #f2f4f7) 100%);
  border-right: 1px solid var(--border-default);
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, min-width 0.3s ease, transform 0.3s ease;
  position: relative;
  z-index: var(--z-sidebar);
}

[data-theme="dark"] .sidebar-base {
  background: linear-gradient(180deg, rgba(26, 26, 36, 0.98) 0%, rgba(18, 18, 24, 0.98) 100%);
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
}

/* List Item Base - Unified list item styling */
.list-item-base {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  color: var(--ink);
}

.list-item-base:hover {
  background: rgba(20, 19, 32, 0.04);
}

.list-item-base.active {
  background: rgba(var(--theme-accent-rgb), 0.12);
  border-color: rgba(var(--theme-accent-rgb), 0.24);
}

[data-theme="dark"] .list-item-base:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .list-item-base.active {
  background: rgba(var(--theme-accent-rgb), 0.16);
  border-color: rgba(var(--theme-accent-rgb), 0.3);
}

/* Card Base - Lightweight card styling */
.card-base {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.card-base:hover {
  border-color: var(--border-default);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .card-base {
  background: rgba(26, 26, 36, 0.96);
  border-color: var(--border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .card-base:hover {
  border-color: var(--border-default);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Card Interactive - selectable/clickable card variant */
.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--primary-rgb, 83, 198, 183), 0.3);
  box-shadow: 0 8px 24px rgba(var(--primary-rgb, 83, 198, 183), 0.08);
}

.card-interactive.selected,
.card-interactive.active {
  border-color: var(--primary, #53c6b7);
  background: rgba(var(--primary-rgb, 83, 198, 183), 0.04);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 83, 198, 183), 0.2);
}

[data-theme="dark"] .card-interactive:hover {
  border-color: rgba(var(--primary-rgb, 83, 198, 183), 0.4);
  box-shadow: 0 8px 24px rgba(var(--primary-rgb, 83, 198, 183), 0.12);
}

[data-theme="dark"] .card-interactive.selected,
[data-theme="dark"] .card-interactive.active {
  border-color: var(--primary, #53c6b7);
  background: rgba(var(--primary-rgb, 83, 198, 183), 0.08);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 83, 198, 183), 0.25);
}

/* Button Base - Unified button sizing */
.btn-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.btn-base:focus-visible {
  box-shadow: var(--focus-ring);
}

/* Button Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
}

.btn-md {
  padding: 10px 18px;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: 14px 24px;
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* Icon Button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  border: none;
}

.btn-icon:hover {
  background: rgba(20, 19, 32, 0.06);
  color: var(--ink);
}

[data-theme="dark"] .btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-icon.sm {
  width: 28px;
  height: 28px;
}

.btn-icon.lg {
  width: 44px;
  height: 44px;
}

/* Primary Button - Wired dynamically to theme accent */
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.22);
  /* Added filter to transition so brightness animates smoothly */
  transition: all 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.28);
  transform: translateY(-1px);
}

.btn-primary:active {
  filter: brightness(0.95);
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(var(--primary-rgb), 0.15);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-primary), 0 2px 8px rgba(var(--primary-rgb), 0.22);
}

/* Secondary Button */
.btn-secondary {
  background: rgba(20, 19, 32, 0.04);
  color: var(--ink);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: rgba(20, 19, 32, 0.08);
  border-color: var(--border-strong);
}

[data-theme="dark"] .btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-default);
}

[data-theme="dark"] .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-secondary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-teal);
}

/* ==============================================
   UNIFIED FOCUS STATES (Accessibility)
   ============================================== */

/* Global focus-visible styles for all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible:not([tabindex="-1"]) {
  outline: none;
  box-shadow: var(--focus-ring-teal, 0 0 0 3px rgba(83, 198, 183, 0.25));
}

/* Reset for elements that should manage their own focus styles */
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.toolbar-btn:focus-visible,
input[type="text"]:focus-visible,
input[type="search"]:focus-visible,
textarea:focus-visible,
select:focus-visible {
  box-shadow: var(--focus-ring-teal, 0 0 0 3px rgba(83, 198, 183, 0.25));
}

/* Focus state for icon-only buttons */
.icon-btn:focus-visible,
.toolbar-btn:focus-visible {
  outline: none;
  background: rgba(var(--primary-rgb, 83, 198, 183), 0.08);
  box-shadow: var(--focus-ring-teal);
}

/* Input focus states - with border color change */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--primary, #53c6b7);
  box-shadow: var(--focus-ring-teal);
}

/* Card/item focus states */
.card-base:focus-visible,
.card-interactive:focus-visible,
.history-item:focus-visible,
.project-item:focus-visible,
.task-card:focus-visible {
  outline: none;
  border-color: var(--primary, #53c6b7);
  box-shadow: var(--focus-ring-teal);
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--primary, #53c6b7);
  color: white;
  font-weight: 600;
  border-radius: var(--radius-md);
  z-index: var(--z-toast);
  transition: top 0.2s ease;
}

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

/* Glass Effect - Lightweight */
.glass-light {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

[data-theme="dark"] .glass-light {
  background: rgba(26, 26, 36, 0.88);
}

/* ==============================================
   HOVER RIPPLE EFFECT
   ============================================== */
/* Soft ripple effect on hover for list items */
.hover-ripple {
  position: relative;
  overflow: hidden;
}

.hover-ripple::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
      rgba(var(--theme-accent-rgb, 83, 198, 183), 0.15) 0%,
      transparent 60%);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.hover-ripple:hover::before {
  opacity: 1;
  transform: scale(1.2);
}

.hover-ripple>* {
  position: relative;
  z-index: 1;
}

/* Alternative: Subtle glow effect */
.hover-glow {
  position: relative;
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(var(--theme-accent-rgb, 83, 198, 183), 0.15);
}

/* ==============================================
   MINI SIDEBAR MODE
   ============================================== */
/* Mini sidebar base - 64px collapsed width with icons only */
.sidebar-mini {
  width: 64px !important;
  min-width: 64px !important;
}

.sidebar-mini .sidebar-brand-text,
.sidebar-mini .nav-link-text,
.sidebar-mini .history-info,
.sidebar-mini .project-info,
.sidebar-mini .sidebar-section-title,
.sidebar-mini .new-chat-text,
.sidebar-mini .new-map-text,
.sidebar-mini .sidebar-search,
.sidebar-mini .load-more-btn {
  display: none !important;
}

.sidebar-mini .sidebar-header {
  justify-content: center;
  padding: var(--space-3);
}

.sidebar-mini .sidebar-brand {
  justify-content: center;
}

.sidebar-mini .sidebar-nav-link {
  justify-content: center;
  padding: var(--space-3);
}

.sidebar-mini .sidebar-nav-link svg {
  margin: 0;
}

.sidebar-mini .history-item,
.sidebar-mini .task-project-item {
  justify-content: center;
  padding: var(--space-3);
}

.sidebar-mini .history-item-icon,
.sidebar-mini .project-icon {
  margin: 0;
}

.sidebar-mini .new-chat-btn,
.sidebar-mini .new-map-btn,
.sidebar-mini .new-project-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  margin: var(--space-3) auto;
  border-radius: var(--radius-md);
}

.sidebar-mini .new-chat-btn svg,
.sidebar-mini .new-map-btn svg,
.sidebar-mini .new-project-btn svg {
  margin: 0;
}

/* Tooltip for mini sidebar items */
.sidebar-mini [data-tooltip] {
  position: relative;
}

.sidebar-mini [data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
}

.sidebar-mini [data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ==============================================
   CONTENT SKELETON SCREENS
   ============================================== */
/* Chat message skeleton */
.skeleton-message {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  max-width: 70%;
}

.skeleton-message.user {
  align-self: flex-end;
}

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

.skeleton-message .skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.skeleton-message .skeleton-bubble {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--skeleton-bg);
}

.skeleton-message.user .skeleton-bubble {
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(90deg,
      rgba(var(--theme-accent-rgb), 0.3) 0%,
      rgba(var(--theme-accent-rgb), 0.15) 50%,
      rgba(var(--theme-accent-rgb), 0.3) 100%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.5s ease-in-out infinite;
}

.skeleton-message.assistant .skeleton-bubble {
  border-radius: 18px 18px 18px 6px;
}

/* Task card skeleton */
.skeleton-task-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.skeleton-task-card .skeleton-checkbox {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.skeleton-task-card .skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-task-card .skeleton-title {
  height: 16px;
  width: 60%;
  border-radius: var(--radius-sm);
}

.skeleton-task-card .skeleton-desc {
  height: 12px;
  width: 80%;
  border-radius: var(--radius-sm);
}

.skeleton-task-card .skeleton-meta {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.skeleton-task-card .skeleton-tag {
  height: 20px;
  width: 50px;
  border-radius: var(--radius-full);
}

/* Mind map node skeleton */
.skeleton-mindmap-node {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.skeleton-mindmap-node .skeleton-icon {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
}

.skeleton-mindmap-node .skeleton-text {
  height: 14px;
  width: 80px;
  border-radius: var(--radius-sm);
}

/* Skeleton shine animation */
@keyframes skeleton-shine {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

/* ==============================================
   KEYBOARD SHORTCUTS HINT BAR
   ============================================== */
.shortcuts-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  font-size: var(--text-xs);
  font-family: var(--font-body);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: var(--z-toast);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.shortcuts-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.shortcuts-bar .shortcut-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.shortcuts-bar .shortcut-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.shortcuts-bar .shortcut-label {
  color: rgba(255, 255, 255, 0.8);
}

.shortcuts-bar .shortcut-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.2);
}

.shortcuts-bar .shortcuts-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: var(--space-2);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.shortcuts-bar .shortcuts-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Toggle button to show shortcuts */
.shortcuts-toggle {
  position: fixed;
  bottom: var(--space-4);
  right: calc(var(--space-6) + 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  z-index: var(--z-dropdown);
}

.shortcuts-toggle:hover {
  background: var(--paper-2);
  color: var(--ink);
  transform: scale(1.05);
}

[data-theme="dark"] .shortcuts-bar {
  background: var(--surface);
  border: 1px solid var(--border-default);
}

[data-theme="dark"] .shortcuts-bar .shortcut-key {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Hide shortcuts bar on mobile */
@media (max-width: 768px) {

  .shortcuts-bar,
  .shortcuts-toggle {
    display: none;
  }
}

/* ==============================================
   MICRO-INTERACTIONS & ANIMATIONS
   ============================================== */
/* Button press effect */
.btn-press {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-press:active {
  transform: scale(0.96);
}

/* Ripple effect container */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple-effect 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-effect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* List item animations */
@keyframes listItemSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes listItemSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
    max-height: 100px;
  }

  to {
    opacity: 0;
    transform: translateX(20px);
    max-height: 0;
    padding: 0;
    margin: 0;
  }
}

.list-item-enter {
  animation: listItemSlideIn var(--transition-normal) ease forwards;
}

.list-item-exit {
  animation: listItemSlideOut var(--transition-normal) ease forwards;
}

/* Fade animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.fade-in {
  animation: fadeIn var(--transition-normal) ease;
}

.fade-out {
  animation: fadeOut var(--transition-normal) ease;
}

/* Scale animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

.scale-in {
  animation: scaleIn var(--transition-normal) ease;
}

.scale-out {
  animation: scaleOut var(--transition-normal) ease;
}

/* Bounce effect */
@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

.bounce {
  animation: bounce 0.4s ease;
}

/* Shake effect (for errors) */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-8px);
  }

  40%,
  80% {
    transform: translateX(8px);
  }
}

.shake {
  animation: shake 0.4s ease;
}

/* Pulse effect */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Success checkmark animation */
@keyframes checkmark {
  0% {
    stroke-dashoffset: 50;
  }

  100% {
    stroke-dashoffset: 0;
  }
}

.checkmark-animate {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: checkmark 0.4s ease forwards;
}

/* Hover lift effect */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

/* Click feedback */
.click-feedback {
  transition: transform var(--transition-fast);
}

.click-feedback:active {
  transform: scale(0.98);
}

/* Stagger animation helper */
.stagger-item {
  opacity: 0;
  animation: listItemSlideIn var(--transition-normal) ease forwards;
}

.stagger-item:nth-child(1) {
  animation-delay: 0ms;
}

.stagger-item:nth-child(2) {
  animation-delay: 50ms;
}

.stagger-item:nth-child(3) {
  animation-delay: 100ms;
}

.stagger-item:nth-child(4) {
  animation-delay: 150ms;
}

.stagger-item:nth-child(5) {
  animation-delay: 200ms;
}

.stagger-item:nth-child(6) {
  animation-delay: 250ms;
}

.stagger-item:nth-child(7) {
  animation-delay: 300ms;
}

.stagger-item:nth-child(8) {
  animation-delay: 350ms;
}

.stagger-item:nth-child(9) {
  animation-delay: 400ms;
}

.stagger-item:nth-child(10) {
  animation-delay: 450ms;
}

/* ==============================================
   ACCESSIBILITY - REDUCED MOTION
   ============================================== */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .skeleton {
    animation: none;
    background: var(--paper-2);
  }

  .hover-lift:hover {
    transform: none;
  }

  .btn-press:active {
    transform: none;
  }
}

/* ==============================================
   THEME TOGGLE BUTTON
   ============================================== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 19, 32, 0.06);
  cursor: pointer;
  transition: background var(--transition-normal), transform var(--transition-fast);
  color: var(--ink);
}

.theme-toggle:hover {
  background: rgba(20, 19, 32, 0.1);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-normal);
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* System preference dark mode for toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ink);
  }

  :root:not([data-theme="light"]) .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
  }
}

/* ==============================================
   THEME SETTINGS PANEL
   ============================================== */
.theme-settings {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-dropdown);
}

.theme-settings-trigger {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-purple);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.theme-settings-trigger:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-xl);
}

.theme-settings-trigger svg {
  width: 22px;
  height: 22px;
}

.theme-settings-panel {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 280px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.95);
  transition: opacity var(--transition-normal),
    visibility var(--transition-normal),
    transform var(--transition-normal);
  overflow: hidden;
}

[data-theme="dark"] .theme-settings-panel {
  background: var(--paper-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-settings.open .theme-settings-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.theme-settings-header {
  padding: var(--space-4);
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
  font-weight: 600;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-theme="dark"] .theme-settings-header {
  border-color: rgba(255, 255, 255, 0.08);
}

.theme-settings-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background var(--transition-fast);
}

.theme-settings-close:hover {
  background: rgba(20, 19, 32, 0.06);
}

[data-theme="dark"] .theme-settings-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.theme-settings-section {
  padding: var(--space-4);
}

.theme-settings-section+.theme-settings-section {
  border-top: 1px solid rgba(20, 19, 32, 0.08);
}

[data-theme="dark"] .theme-settings-section+.theme-settings-section {
  border-color: rgba(255, 255, 255, 0.08);
}

.theme-settings-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: var(--space-3);
}

/* Theme mode selector */
.theme-mode-options {
  display: flex;
  gap: var(--space-2);
}

.theme-mode-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(20, 19, 32, 0.1);
  border-radius: var(--radius-md);
  background: transparent;
  font-size: var(--text-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
  color: var(--ink);
}

.theme-mode-btn:hover {
  border-color: rgba(20, 19, 32, 0.2);
  background: rgba(20, 19, 32, 0.03);
}

.theme-mode-btn.active {
  border-color: var(--theme-accent);
  background: rgba(var(--theme-accent-rgb), 0.1);
  color: var(--theme-accent);
}

.theme-mode-btn svg {
  width: 16px;
  height: 16px;
}

[data-theme="dark"] .theme-mode-btn {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-mode-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

/* Accent color picker */
.accent-options {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.accent-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

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

.accent-btn.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--paper);
}

[data-theme="dark"] .accent-btn.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--paper);
}

.accent-btn[data-accent="coral"] {
  background: linear-gradient(135deg, #ff6b5a 0%, #ff9f43 100%);
}

.accent-btn[data-accent="purple"] {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.accent-btn[data-accent="teal"] {
  background: linear-gradient(135deg, #14b8a6 0%, #53c6b7 100%);
}

.accent-btn[data-accent="blue"] {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.accent-btn[data-accent="pink"] {
  background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
}

.accent-btn[data-accent="green"] {
  background: linear-gradient(135deg, #22c55e 0%, #4ade80 100%);
}

/* Custom color button */
.accent-btn.accent-custom {
  background: conic-gradient(from 0deg, #ff6b5a, #f472b6, #8b5cf6, #3b82f6, #14b8a6, #22c55e, #ff9f43, #ff6b5a);
  display: flex;
  align-items: center;
  justify-content: center;
}

.accent-btn.accent-custom svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Custom color picker */
.custom-color-picker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: rgba(20, 19, 32, 0.04);
  border-radius: var(--radius-md);
}

[data-theme="dark"] .custom-color-picker {
  background: rgba(255, 255, 255, 0.06);
}

.custom-color-picker input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--border-default);
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.custom-color-picker input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.custom-color-picker input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.custom-color-picker input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.custom-color-picker .custom-color-label {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ==============================================
   DARK MODE - COMPONENT OVERRIDES
   ============================================== */
/* Navigation */
[data-theme="dark"] .nav {
  background: rgba(18, 18, 24, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .nav-user {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Buttons in dark mode */
[data-theme="dark"] .btn.primary {
  background: var(--ink);
  color: var(--paper);
}

[data-theme="dark"] .btn.secondary {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Sidebar user section in dark mode */
[data-theme="dark"] .sidebar-user {
  border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sidebar-user .user-info:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Cards and containers */
[data-theme="dark"] .feature,
[data-theme="dark"] .slide,
[data-theme="dark"] .card {
  background: var(--paper-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .hero-visual {
  background: var(--surface);
  border-color: var(--border-default);
}

[data-theme="dark"] .hero-badge {
  background: rgba(255, 107, 90, 0.12);
  border-color: rgba(255, 107, 90, 0.18);
}

[data-theme="dark"] .hero-copy h1 {
  color: var(--ink);
}

/* Form inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--paper-2);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

[data-theme="dark"] input:hover:not(:disabled):not(:focus),
[data-theme="dark"] textarea:hover:not(:disabled):not(:focus),
[data-theme="dark"] select:hover:not(:disabled):not(:focus) {
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] ::placeholder {
  color: var(--muted);
}

/* Scrollbars in dark mode */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] * {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* System preference dark scrollbars */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav {
    background: rgba(18, 18, 24, 0.9);
  }

  :root:not([data-theme="light"]) .nav::after {
    background: linear-gradient(to bottom,
        rgba(18, 18, 24, 0.9),
        rgba(18, 18, 24, 0));
  }

  :root:not([data-theme="light"]) .btn.secondary {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
  }

  :root:not([data-theme="light"]) .feature,
  :root:not([data-theme="light"]) .slide,
  :root:not([data-theme="light"]) .card {
    background: var(--paper-2);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  :root:not([data-theme="light"]) input[type="text"],
  :root:not([data-theme="light"]) input[type="email"],
  :root:not([data-theme="light"]) input[type="password"],
  :root:not([data-theme="light"]) textarea,
  :root:not([data-theme="light"]) select {
    background: var(--paper-2);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--ink);
  }

  :root:not([data-theme="light"]) ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
  }

  :root:not([data-theme="light"]) * {
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  }
}

/*
 * Responsive Breakpoints (Standard)
 * ---------------------------------
 * Mobile:  max-width: 768px
 * Tablet:  max-width: 1024px
 * Desktop: max-width: 1280px
 *
 * Use these breakpoints consistently across all pages.
 * @media (max-width: 768px)  - Mobile-first sidebar overlay, simplified UI
 * @media (max-width: 1024px) - Tablet adjustments, reduced controls panel
 * @media (max-width: 1280px) - Desktop adjustments if needed
 */

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

body {
  font-family: "Archivo", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

html,
body {
  height: 100%;
  /* Default: allow scrolling for content pages (Home, Workflow, Profile) */
  overflow: auto;
}

/* Prevent scrolling for workspace pages (Chat, Map, Build) */
body.workspace-page {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Default: allow content to scroll for content pages */
  overflow: auto;
}

/* Fixed height for workspace pages */
body.workspace-page .page {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* ================================================
   Workspace Common Components
   Shared styles for Chat, Map, Build, Task pages
   ================================================ */

/* Sidebar Toggle Button (inside dark sidebar) - hidden by default since toolbar has collapse button */
.sidebar-toggle {
  display: none;
  /* Hidden - use toolbar .sidebar-collapse-btn instead to avoid redundancy */
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  border-radius: var(--radius-sm, 6px);
  transition: background var(--transition-normal, 0.2s ease),
    color var(--transition-normal, 0.2s ease);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Sidebar Collapse Button (in main area, light background) */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--muted, #666);
  cursor: pointer;
  border-radius: var(--radius-md, 8px);
  transition: background var(--transition-normal, 0.2s ease),
    color var(--transition-normal, 0.2s ease);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: rgba(20, 19, 32, 0.06);
  color: var(--ink, #141320);
}

.sidebar-collapse-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-normal, 0.2s ease);
}

/* Sidebar toggle in toolbar (consistent with toolbar-btn styling) */
.toolbar-btn.sidebar-toggle-btn {
  padding: 8px;
}

/* Dark mode adjustments for sidebar collapse button */
[data-theme="dark"] .sidebar-collapse-btn {
  color: var(--muted, #8a8698);
}

[data-theme="dark"] .sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink, #f0eff4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar-collapse-btn {
    color: var(--muted, #8a8698);
  }

  :root:not([data-theme="light"]) .sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink, #f0eff4);
  }
}

/* Sidebar Footer Navigation (shared across Chat, Map, Build, Task) */
.sidebar-footer,
.sidebar-nav {
  padding: 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  flex-shrink: 0;
}

.sidebar-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-nav-link span {
  flex: 1;
}

.sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-nav-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: #fff;
}

/* Light sidebar navigation overrides (Chat, Map, Task pages) */
.chat-page .sidebar-nav-link,
.map-page .sidebar-nav-link,
.task-page .sidebar-nav-link {
  color: var(--muted, #667079);
}

.chat-page .sidebar-nav-link:hover,
.map-page .sidebar-nav-link:hover,
.task-page .sidebar-nav-link:hover {
  background: rgba(20, 19, 32, 0.04);
  color: var(--ink, #1b1f24);
}

.chat-page .sidebar-nav-link.active,
.map-page .sidebar-nav-link.active,
.task-page .sidebar-nav-link.active {
  background: rgba(83, 198, 183, 0.12);
  color: #2c8a7d;
}

.chat-page .sidebar-nav-link.active svg,
.map-page .sidebar-nav-link.active svg,
.task-page .sidebar-nav-link.active svg {
  color: #2c8a7d;
}

/* Sidebar User Section */
.sidebar-user {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
}

.sidebar-user .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.sidebar-user .user-info:hover {
  background: rgba(0, 0, 0, 0.06);
}

.sidebar-user .user-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user .user-avatar.has-photo {
  background-size: cover;
  background-position: center;
}

.sidebar-user .user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: inherit;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  padding: 16px 7vw;
  background: rgba(248, 245, 241, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  justify-self: start;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: 0 4px 12px rgba(255, 107, 90, 0.15);
}

.nav-links {
  display: flex;
  gap: 26px;
  font-size: 0.95rem;
  color: var(--muted);
  justify-self: center;
}

.nav-links a.active {
  color: var(--ink);
  font-weight: 600;
}

.nav-cta {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-self: end;
}

.nav-user {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(20, 19, 32, 0.08);
  font-weight: 600;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: #1b1a28;
  font-weight: 700;
  background-size: cover;
  background-position: center;
}

.nav-avatar.has-photo {
  color: transparent;
}

.nav-username {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-only {
  display: none;
}

/* ==============================================
   UNIFIED BUTTON SYSTEM
   ============================================== */
.btn {
  padding: var(--btn-padding-md);
  border-radius: var(--btn-radius);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  transition: transform var(--transition-normal),
    box-shadow var(--transition-normal),
    background var(--transition-normal),
    border-color var(--transition-normal);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn.loading {
  position: relative;
  color: transparent !important;
  cursor: wait;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  animation: spinCentered 0.6s linear infinite;
}

/* Loading spinner color variants for different button types */
.btn.secondary.loading::after,
.btn.ghost.loading::after {
  border-color: var(--ink);
  border-top-color: transparent;
}

/* Button Variants */
.btn.primary {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

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

.btn.primary.accent {
  background: var(--gradient-primary);
  box-shadow: 0 8px 24px rgba(255, 107, 90, 0.25);
}

.btn.primary.accent:hover:not(:disabled) {
  box-shadow: 0 12px 32px rgba(255, 107, 90, 0.35);
}

.btn.primary.purple {
  background: var(--gradient-purple);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.btn.primary.purple:hover:not(:disabled) {
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.35);
}

.btn.secondary {
  border-color: rgba(20, 19, 32, 0.15);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(20, 19, 32, 0.2);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25);
}

.btn.danger:hover:not(:disabled) {
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.35);
  transform: translateY(-2px);
}

/* Button Sizes */
.btn.small {
  padding: var(--btn-padding-sm);
  font-size: var(--text-xs);
  gap: var(--space-2);
}

.btn.small.loading {
  padding-right: 36px;
}

.btn.small.loading::after {
  width: 12px;
  height: 12px;
  right: 12px;
  border-width: 2px;
}

.btn.large {
  padding: var(--btn-padding-lg);
  font-size: var(--text-base);
  gap: var(--space-3);
}

/* Square buttons (for feature pages) */
.btn.square {
  border-radius: var(--btn-radius-square);
}

.btn.ghost {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  background: transparent;
}

.btn.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.btn.disabled,
.btn[aria-disabled="true"],
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

/* ==============================================
   GLOBAL SCROLLBAR STYLES
   ============================================== */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(20, 19, 32, 0.15);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 19, 32, 0.25);
}

/* Dark scrollbar for dark backgrounds */
.dark-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.dark-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 19, 32, 0.15) transparent;
}

/* ==============================================
   FORM INPUT ENHANCEMENTS
   ============================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
textarea,
select {
  font-family: inherit;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgba(20, 19, 32, 0.15);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

input:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus) {
  border-color: rgba(20, 19, 32, 0.25);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Purple focus variant (for chat/map pages) */
input.focus-purple:focus,
textarea.focus-purple:focus,
select.focus-purple:focus {
  border-color: var(--accent-purple);
  box-shadow: var(--focus-ring-purple);
}

/* Input validation states */
input.error,
textarea.error,
select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

input.success,
textarea.success,
select.success {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

input:disabled,
textarea:disabled,
select:disabled {
  background: var(--paper-2);
  cursor: not-allowed;
  opacity: 0.7;
}

/* Placeholder styling */
::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

/* ==============================================
   CARD SHADOW ENHANCEMENTS
   ============================================== */
.card,
.feature,
.slide,
.plan,
.quote {
  transition: transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.card:hover,
.feature:hover,
.slide:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

/* ==============================================
   UNIFIED LOADING SPINNER
   ============================================== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid rgba(20, 19, 32, 0.1);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.spinner.small {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner.large {
  width: 32px;
  height: 32px;
  border-width: 4px;
}

.spinner.white {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
}

.spinner.purple {
  border-top-color: var(--accent-purple);
}

/* ==============================================
   MODAL ANIMATION (UNIFIED)
   ============================================== */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.96);
  }
}

.modal-card {
  animation: modalSlideIn var(--transition-slow) ease;
}

/* ==============================================
   TYPOGRAPHY - VISUAL HIERARCHY
   ============================================== */
/* Heading styles using design tokens */
.heading-1 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: var(--text-5xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: var(--space-6);
}

.heading-2 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: var(--space-5);
}

.heading-3 {
  font-family: "Archivo", "Segoe UI", sans-serif;
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--ink);
  margin-bottom: var(--space-4);
}

.heading-4 {
  font-family: "Archivo", "Segoe UI", sans-serif;
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--ink);
  margin-bottom: var(--space-3);
}

.heading-5 {
  font-family: "Archivo", "Segoe UI", sans-serif;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--leading-normal);
  color: var(--ink);
  margin-bottom: var(--space-3);
}

/* Paragraph styles */
.text-body {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--ink-2);
  margin-bottom: var(--space-4);
}

.text-body-lg {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--ink-2);
  margin-bottom: var(--space-5);
}

.text-small {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--muted);
}

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

/* Content spacing for consecutive elements */
.content>*+* {
  margin-top: var(--space-4);
}

.content>h2+*,
.content>h3+*,
.content>h4+* {
  margin-top: var(--space-3);
}

.content>*+h2 {
  margin-top: var(--space-10);
}

.content>*+h3 {
  margin-top: var(--space-8);
}

.content>*+h4 {
  margin-top: var(--space-6);
}

/* ==============================================
   UNIFIED EMPTY STATE DESIGN
   ============================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  min-height: 200px;
  animation: emptyStateFadeIn 0.4s ease-out;
}

@keyframes emptyStateFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state-icon {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-2xl);
  background: linear-gradient(135deg,
      rgba(var(--primary-rgb, 83, 198, 183), 0.12) 0%,
      rgba(var(--primary-rgb, 83, 198, 183), 0.06) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
  position: relative;
  box-shadow: 0 8px 32px rgba(var(--primary-rgb, 83, 198, 183), 0.1);
}

.empty-state-icon::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: linear-gradient(135deg,
      rgba(var(--primary-rgb, 83, 198, 183), 0.15) 0%,
      transparent 50%);
  z-index: -1;
  opacity: 0.6;
}

.empty-state-icon svg {
  width: 40px;
  height: 40px;
  color: var(--primary-strong, #2c8a7d);
  filter: drop-shadow(0 2px 4px rgba(var(--primary-rgb, 83, 198, 183), 0.2));
}

.empty-state-icon.purple {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
}

.empty-state-icon.purple svg {
  color: var(--accent-purple);
}

.empty-state h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-3);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--muted);
  max-width: 320px;
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
}

/* Compact empty state variant */
.empty-state.compact {
  padding: var(--space-8) var(--space-4);
  min-height: 150px;
}

.empty-state.compact .empty-state-icon {
  width: 60px;
  height: 60px;
  margin-bottom: var(--space-4);
}

.empty-state.compact .empty-state-icon svg {
  width: 28px;
  height: 28px;
}

.empty-state.compact h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.empty-state.compact p {
  margin-bottom: var(--space-4);
}

/* ==============================================
   MOBILE HAMBURGER MENU
   ============================================== */
.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: var(--z-sticky);
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: var(--radius-full);
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.hamburger-menu.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile navigation overlay */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 19, 32, 0.5);
  backdrop-filter: blur(4px);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.mobile-nav-overlay.active {
  opacity: 1;
}

/* Mobile navigation panel */
.mobile-nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform var(--transition-slow) ease;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
}

.mobile-nav-panel.active {
  transform: translateX(0);
}

.mobile-nav-panel .nav-links {
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-8);
}

.mobile-nav-panel .nav-links a {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--ink-2);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.mobile-nav-panel .nav-links a:hover,
.mobile-nav-panel .nav-links a.active {
  background: var(--paper-2);
  color: var(--ink);
}

.mobile-nav-panel .nav-cta {
  flex-direction: column;
  margin-top: auto;
  padding-top: var(--space-6);
  border-top: 1px solid rgba(20, 19, 32, 0.08);
}

.mobile-nav-panel .nav-cta .btn {
  width: 100%;
}

/* Show hamburger on mobile */
@media (max-width: 768px) {
  .hamburger-menu {
    display: flex;
  }

  .mobile-nav-overlay {
    display: block;
    pointer-events: none;
  }

  .mobile-nav-overlay.active {
    pointer-events: auto;
  }

  .nav .nav-links,
  .nav .nav-cta {
    display: none;
  }
}

.hero {
  padding: 40px 7vw 72px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 48px;
  align-items: center;
}

.hero-copy h1 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(2.8rem, 3.8vw, 4.6rem);
  line-height: 1.05;
  margin-bottom: 20px;
}

.hero-copy p {
  font-size: 1.1rem;
  color: var(--ink-2);
  margin-bottom: 26px;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 32px;
}

.hero-meta {
  display: flex;
  gap: 20px;
  align-items: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255, 107, 90, 0.1);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 107, 90, 0.15);
}

.page-header .hero-badge {
  margin-bottom: 24px;
}

.hero-visual {
  position: relative;
  padding: 22px;
  background: var(--surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.deck {
  display: grid;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.slide {
  background: var(--paper);
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border-light);
  display: grid;
  gap: 10px;
}

.slide .tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bars {
  display: grid;
  gap: 8px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}

.bar.short {
  width: 65%;
}

.bar.mid {
  width: 82%;
}

.bar.long {
  width: 100%;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, var(--grid));
  gap: 10px;
}

.metric {
  background: var(--paper-2);
  border-radius: 14px;
  padding: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 1.1rem;
  color: var(--ink);
}

.section {
  padding: 64px 7vw;
}

.chat-section {
  padding: 16px 7vw 20px;
  flex: 1;
  display: flex;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.section h2 {
  font-family: var(--font-brand);
  font-size: clamp(2.2rem, 3.5vw, 3.2rem);
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.section p.lead {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 680px;
  margin-bottom: 48px;
  line-height: 1.6;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
}

.feature {
  background: var(--surface);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.feature strong {
  font-size: 1.4rem;
  font-family: var(--font-brand);
  color: var(--ink);
}

.feature p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 8px;
}

.feature .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 107, 90, 0.15);
  font-size: 1.2rem;
}

.demo {
  display: grid;
  gap: 20px;
  background: var(--surface);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.demo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.demo-tab {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(20, 19, 32, 0.06);
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.demo-tab.active {
  background: var(--ink);
  color: #fff;
}

.demo-panels {
  display: grid;
  gap: 16px;
}

.demo-panel {
  display: none;
  background: var(--paper);
  border-radius: 14px;
  padding: 22px;
  border: 1px solid var(--border-light);
}

.demo-panel.active {
  display: grid;
  gap: 10px;
}

.demo-panel ul {
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
}

.step {
  border-radius: 18px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.step span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

.step h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
}

.step p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* Workflow Flow - Chat to Visualization */
.workflow-flow {
  display: grid;
  gap: 32px;
}

.flow-example {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: 32px;
  align-items: center;
  padding: 40px;
  background: var(--surface);
  border-radius: 28px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.flow-start {
  display: grid;
  gap: 12px;
}

.flow-start strong {
  font-size: 1.25rem;
  color: var(--ink);
  font-family: var(--font-brand);
}

.flow-start p {
  font-size: 1rem;
  color: var(--muted);
  font-style: normal;
  background: var(--paper-2);
  padding: 12px 16px;
  border-radius: 12px;
  border-left: 3px solid var(--primary);
}

.flow-arrow {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  color: var(--primary);
  flex-shrink: 0;
  transition: all 0.3s ease;
  border: 1px solid var(--border-light);
}

.flow-example:hover .flow-arrow {
  transform: scale(1.1) rotate(5deg);
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 16px rgba(var(--primary-rgb), 0.2);
}

.proof {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.quote {
  background: var(--surface);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quote p {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.quote-content p {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--ink);
  font-family: var(--font-brand);
  font-style: italic;
}

.quote .who {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.quote .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  flex-shrink: 0;
}

.quote .who-meta {
  display: flex;
  flex-direction: column;
}

.quote .who-meta strong {
  color: var(--ink);
  font-size: 1rem;
}

.quote .who-meta span {
  color: var(--muted);
  font-size: 0.85rem;
}

[data-theme="dark"] .quote,
[data-theme="dark"] .flow-example,
[data-theme="dark"] .step,
[data-theme="dark"] .feature {
  background: rgba(255, 255, 255, 0.03);
}

.flow-outputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flow-output {
  padding: 10px 18px;
  background: var(--paper);
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--ink-2);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-output::before {
  content: "✦";
  color: var(--primary);
}

.flow-output:first-child {
  background: rgba(83, 198, 183, 0.15);
}

.flow-output:nth-child(2) {
  background: rgba(247, 196, 76, 0.2);
}

.flow-output:nth-child(3) {
  background: rgba(124, 107, 176, 0.15);
}

@media (max-width: 768px) {
  .flow-example {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .flow-arrow {
    margin: 0 auto;
    transform: rotate(90deg);
  }

  .flow-outputs {
    justify-content: center;
  }
}

/* Compare table section header */
.compare-row.compare-section {
  background: rgba(20, 19, 32, 0.04);
  font-weight: 600;
}

.compare-row.compare-section span:first-child {
  font-weight: 600;
  color: var(--ink);
}

.compare-row.compare-header {
  background: var(--ink);
  color: white;
  border-radius: 12px 12px 0 0;
}

.compare-row.compare-header strong {
  color: white;
}

/* .proof and .quote duplicates removed — canonical rules are above */

.pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}

.plan {
  background: var(--surface);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 14px;
  border: 1px solid var(--border-light);
}

.plan.highlight {
  border: 2px solid var(--ink);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.plan h3 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.price {
  font-size: 2.2rem;
  font-weight: 700;
  font-family: var(--font-brand);
  margin-bottom: 4px;
}

.price span {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.6;
}

.plan ul {
  list-style: none;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.compare {
  display: grid;
  gap: 16px;
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 15px 35px rgba(20, 19, 32, 0.08);
}

.compare-row {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.compare-row span {
  font-size: 0.95rem;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 107, 90, 0.15);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
}

.cta {
  padding: 80px 7vw;
}

.cta-card {
  background: var(--ink);
  color: #fff;
  border-radius: 22px;
  padding: 48px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.cta-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 15% 30%, rgba(255, 107, 90, 0.15), transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(83, 198, 183, 0.12), transparent 50%);
  pointer-events: none;
}

.cta-card>* {
  position: relative;
  z-index: 1;
}

.cta-card h2 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.footer {
  padding: 20px 7vw;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
  border-top: 1px solid var(--border-light);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--ink);
}

.page-header {
  padding: 24px 7vw 16px;
  flex-shrink: 0;
}

.page-header h1 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(2rem, 2.5vw, 2.6rem);
  margin-bottom: 8px;
}

.page-header p {
  color: var(--ink-2);
  max-width: 620px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.form-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--surface);
  padding: 30px;
  border-radius: 22px;
  box-shadow: 0 20px 45px rgba(20, 19, 32, 0.12);
  display: grid;
  gap: 16px;
}

.form-card label {
  font-size: 0.9rem;
  color: var(--muted);
}

.form-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  font-family: inherit;
}

.form-card .hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  background: rgba(20, 19, 32, 0.06);
  padding: 6px;
  border-radius: 999px;
}

.form-tab {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.form-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 10px 20px rgba(20, 19, 32, 0.12);
}

.form-intro {
  display: grid;
  gap: 6px;
}

.form-intro strong {
  font-size: 1.15rem;
}

.form-intro span {
  color: var(--muted);
  font-size: 0.9rem;
}

.form-error {
  display: none;
  color: #b74136;
  font-size: 0.9rem;
}

.form-status {
  display: none;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Password input wrapper with toggle button */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color var(--transition-fast);
  border-radius: 4px;
}

.password-toggle:hover {
  color: var(--ink);
  background: rgba(20, 19, 32, 0.05);
}

.password-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-3);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Input validation states */
.form-card input.valid {
  border-color: var(--success);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-card input.invalid {
  border-color: var(--danger);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.password-input-wrapper input.valid,
.password-input-wrapper input.invalid {
  padding-right: 44px;
  background-position: right 44px center;
}

.form-field-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-field-error.visible {
  display: block;
}

/* Forgot password link */
.form-links {
  display: flex;
  justify-content: flex-end;
  margin-top: -8px;
}

.forgot-password-link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.forgot-password-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Modal overlay and card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 19, 32, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.show .modal-card {
  transform: scale(1);
}

.modal-header {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
}

.modal-header strong {
  font-size: 1.15rem;
}

.modal-header span {
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-body {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.modal-body label {
  font-size: 0.9rem;
  color: var(--muted);
}

.modal-body input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  font-family: inherit;
}

.modal-body input:focus {
  outline: none;
  border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(83, 198, 183, 0.15);
}

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

/* Password strength indicator */
.password-strength {
  display: none;
  margin-top: 8px;
}

.password-strength .strength-bar {
  height: 4px;
  background: rgba(20, 19, 32, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.password-strength .strength-fill {
  height: 100%;
  width: 0;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 2px;
}

.password-strength .strength-text {
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.password-strength .strength-feedback {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.password-strength .strength-feedback li {
  padding: 2px 0;
}

.password-strength .strength-feedback li::before {
  content: "•";
  margin-right: 6px;
  color: #e74c3c;
}

.account-section {
  padding-bottom: 80px;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 22px;
  align-items: start;
}

.account-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(20, 19, 32, 0.1);
}

.account-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  background-size: cover;
  background-position: center;
}

.account-avatar.has-photo {
  color: transparent;
}

.account-details {
  display: grid;
  gap: 6px;
}

.account-details strong {
  font-size: 1.1rem;
}

.account-details span {
  color: var(--muted);
}

.account-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.account-meta>div:nth-child(3) {
  grid-column: 1 / -1;
}

.quota-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 19, 32, 0.12);
  overflow: hidden;
  margin-top: 6px;
}

.quota-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-3), var(--accent));
  border-radius: inherit;
}

.quota-warning {
  display: block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: #b74136;
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.account-panel {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 22px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  box-shadow: 0 20px 50px rgba(20, 19, 32, 0.12);
  display: grid;
  gap: 18px;
}

.build-section {
  padding-bottom: 90px;
}

/* Workflow Layout Styles */
.build-workflow-section {
  padding-top: 40px;
  padding-bottom: 90px;
}

.build-workflow-container {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0 20px;
  box-sizing: border-box;
}

.workflow-step {
  display: grid;
  gap: 16px;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.workflow-step.collapsed {
  opacity: 0;
  transform: translateY(20px);
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
}

.workflow-step.expanded {
  opacity: 1;
  transform: translateY(0);
  max-height: none;
  animation: expandStep 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes expandStep {
  from {
    opacity: 0;
    transform: translateY(20px);
    max-height: 0;
  }

  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 5000px;
  }
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(255, 107, 90, 0.35);
  flex-shrink: 0;
}

.step-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-info strong {
  font-size: 1.25rem;
  color: var(--ink);
  font-weight: 700;
}

.step-info span {
  font-size: 0.92rem;
  color: var(--muted);
}

.workflow-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(20, 19, 32, 0.12);
  border: 1px solid rgba(20, 19, 32, 0.06);
  transition: all 0.3s ease;
  overflow: hidden;
  min-width: 0;
}

.workflow-card:hover {
  box-shadow: 0 24px 60px rgba(20, 19, 32, 0.16);
  transform: translateY(-2px);
}

.build-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 22px;
  align-items: start;
}

.build-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(20, 19, 32, 0.12);
  border: 1px solid rgba(20, 19, 32, 0.08);
}

.build-form {
  display: grid;
  gap: 16px;
}

.build-form textarea {
  border-radius: 16px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--ink);
  resize: vertical;
  min-height: 160px;
}

.build-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.build-options select {
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  padding: 8px 10px;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
}

.build-divider {
  height: 1px;
  background: rgba(20, 19, 32, 0.08);
  margin: 18px 0;
}

.build-thread-card {
  display: grid;
  gap: 12px;
}

.build-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding: 14px;
  border-radius: 16px;
  background: rgba(20, 19, 32, 0.04);
  border: 1px solid rgba(20, 19, 32, 0.08);
}

.build-thread .message {
  font-size: 0.95rem;
  padding: 12px 16px;
  box-shadow: 0 10px 18px rgba(20, 19, 32, 0.12);
  max-width: 100%;
}

.build-thread-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 18px 10px;
}

.build-followup {
  display: grid;
  gap: 12px;
}

.build-followup textarea {
  border-radius: 14px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--ink);
  resize: vertical;
  min-height: 110px;
}

.build-followup-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.build-options input {
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  padding: 8px 10px;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
}

.build-status {
  display: grid;
  gap: 16px;
}

.status-card,
.preview-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  box-shadow: 0 18px 40px rgba(20, 19, 32, 0.1);
}

.layout-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  box-shadow: 0 18px 40px rgba(20, 19, 32, 0.1);
  display: grid;
  gap: 12px;
}

.status-header,
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-text {
  margin-top: 10px;
  color: var(--muted);
}

.status-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(20, 19, 32, 0.08);
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-badge.idle {
  background: rgba(20, 19, 32, 0.08);
}

.status-badge.queued {
  background: rgba(247, 196, 76, 0.22);
}

.status-badge.running,
.status-badge.rendering {
  background: rgba(83, 198, 183, 0.22);
}

.status-badge.uploading {
  background: rgba(255, 107, 90, 0.2);
}

.status-badge.done {
  background: rgba(83, 198, 183, 0.2);
}

.status-badge.failed {
  background: rgba(255, 107, 90, 0.2);
}

.status-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.status-actions .btn.disabled,
.status-actions .btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.preview-header span {
  color: var(--muted);
  font-size: 0.85rem;
}

.preview-frame {
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(20, 19, 32, 0.08);
  background: rgba(20, 19, 32, 0.04);
  height: clamp(360px, 56vh, 640px);
}

.preview-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Layout Studio - Modern Visual Editor */
.layout-editor-section {
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 241, 0.95));
}

.layout-slides-container {
  display: grid;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 16px;
  background: rgba(20, 19, 32, 0.03);
  border: 1px solid rgba(20, 19, 32, 0.06);
}

.layout-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 40px 20px;
}

.layout-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.1), rgba(83, 198, 183, 0.1));
  display: grid;
  place-items: center;
}

.layout-empty-icon svg {
  stroke: var(--muted);
  opacity: 0.6;
}

/* Slide Card - Collapsible */
.layout-slide-card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(20, 19, 32, 0.03);
}

.layout-slide-card:hover {
  border-color: rgba(255, 107, 90, 0.25);
}

.layout-slide-card.expanded {
  border-color: rgba(255, 107, 90, 0.4);
  box-shadow: 0 8px 24px rgba(20, 19, 32, 0.08);
}

.layout-slide-card.has-override {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.02), rgba(247, 196, 76, 0.01));
}

.layout-slide-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  min-height: 72px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.layout-slide-header:hover {
  background: rgba(20, 19, 32, 0.02);
}

.layout-slide-number {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 0;
}

.layout-slide-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
  padding: 2px 0;
}

.layout-slide-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.layout-slide-current {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.5;
  height: auto;
  min-height: 22px;
}

.layout-slide-current::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  flex-shrink: 0;
}

.layout-slide-card.has-override .layout-slide-current::before {
  background: var(--accent);
}

.layout-expand-icon {
  width: 28px;
  height: 28px;
  color: var(--muted);
  transition: transform 0.3s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
}

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

.layout-slide-card.expanded .layout-expand-icon {
  transform: rotate(180deg);
}

/* Layout Options Grid - Hidden by default */
.layout-options-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 0 14px 14px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.layout-slide-card.expanded .layout-options-grid {
  max-height: 200px;
  opacity: 1;
  padding-top: 4px;
}

.layout-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(20, 19, 32, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
}

.layout-option:hover {
  background: rgba(255, 107, 90, 0.1);
  border-color: rgba(255, 107, 90, 0.25);
  transform: translateY(-1px);
}

.layout-option.selected {
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.15), rgba(247, 196, 76, 0.1));
  border-color: var(--accent);
}

.layout-option-icon {
  width: 40px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid rgba(20, 19, 32, 0.1);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.layout-option-icon svg {
  width: 32px;
  height: 20px;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.layout-option.selected .layout-option-icon {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.08), rgba(247, 196, 76, 0.05));
}

.layout-option.selected .layout-option-icon svg {
  stroke: var(--accent);
}

.layout-option-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
}

.layout-option.selected .layout-option-label {
  color: var(--ink);
  font-weight: 600;
}

/* Layout Actions */
.layout-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.layout-actions .btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layout-actions .btn svg {
  flex-shrink: 0;
}

/* Override Badge */
.layout-override-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(255, 107, 90, 0.12);
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: auto;
}

/* ============================================
   NEW LAYOUT STUDIO - Modern Visual Editor
   ============================================ */

.layout-studio-container {
  display: none;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  overflow: hidden;
}

.layout-studio-container.active {
  display: flex;
}

/* Slide Carousel Navigation */
.layout-carousel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 245, 241, 0.9));
  border-radius: 16px;
  border: 1px solid rgba(20, 19, 32, 0.06);
  box-shadow: 0 4px 20px rgba(20, 19, 32, 0.04);
  min-width: 0;
  overflow: hidden;
}

.carousel-nav {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(20, 19, 32, 0.1);
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.carousel-nav:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

.carousel-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.carousel-track-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

.carousel-track {
  display: flex;
  gap: 12px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 4px 0;
}

/* Carousel Slide Thumbnail */
.carousel-slide-thumb {
  flex-shrink: 0;
  width: 100px;
  height: 64px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(20, 19, 32, 0.06);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.carousel-slide-thumb:hover {
  border-color: rgba(255, 107, 90, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20, 19, 32, 0.1);
}

.carousel-slide-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(255, 107, 90, 0.25);
}

.carousel-slide-thumb.modified::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #fff;
}

.carousel-slide-num {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--ink), var(--ink-2));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide-thumb.active .carousel-slide-num {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.carousel-thumb-icon {
  width: 60px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0.7;
}

.carousel-thumb-icon svg {
  width: 100%;
  height: 100%;
}

.carousel-slide-thumb.active .carousel-thumb-icon {
  color: var(--accent);
  opacity: 1;
}

/* Main Preview Area */
.layout-preview-area {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 241, 0.95));
  border-radius: 20px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(20, 19, 32, 0.06);
}

.layout-preview-slide {
  aspect-ratio: 16 / 9;
  max-height: 280px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  box-shadow:
    0 4px 20px rgba(20, 19, 32, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}

.layout-preview-slide svg {
  width: 70%;
  height: 70%;
  color: var(--muted);
  opacity: 0.5;
}

.layout-preview-slide.has-content svg {
  opacity: 0.85;
  color: var(--ink-2);
}

.layout-preview-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(20, 19, 32, 0.06);
}

.layout-preview-slide-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 4px 12px;
  border-radius: 999px;
}

.layout-preview-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Layout Picker */
.layout-picker {
  background: rgba(20, 19, 32, 0.02);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(20, 19, 32, 0.04);
}

.layout-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(20, 19, 32, 0.06);
}

.layout-picker-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.layout-picker-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.layout-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

/* Layout Picker Card */
.layout-picker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(20, 19, 32, 0.04);
}

.layout-picker-card:hover {
  border-color: rgba(255, 107, 90, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(20, 19, 32, 0.08);
}

.layout-picker-card.selected {
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(255, 107, 90, 0.08), rgba(247, 196, 76, 0.04));
  box-shadow: 0 4px 16px rgba(255, 107, 90, 0.15);
}

.layout-picker-icon {
  width: 64px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(20, 19, 32, 0.03), rgba(20, 19, 32, 0.06));
  border: 1px solid rgba(20, 19, 32, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.layout-picker-icon svg {
  width: 48px;
  height: 30px;
  color: var(--muted);
  transition: all 0.25s ease;
}

.layout-picker-card:hover .layout-picker-icon {
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.08), rgba(247, 196, 76, 0.05));
  border-color: rgba(255, 107, 90, 0.2);
}

.layout-picker-card:hover .layout-picker-icon svg {
  color: var(--accent);
}

.layout-picker-card.selected .layout-picker-icon {
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.12), rgba(247, 196, 76, 0.08));
  border-color: var(--accent);
}

.layout-picker-card.selected .layout-picker-icon svg {
  color: var(--accent);
}

.layout-picker-name {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  transition: all 0.2s ease;
}

.layout-picker-card:hover .layout-picker-name,
.layout-picker-card.selected .layout-picker-name {
  color: var(--ink);
  font-weight: 600;
}

/* Hide empty state when studio is active */
.layout-studio-container.active .layout-empty {
  display: none;
}

/* Responsive adjustments for Layout Studio */
@media (max-width: 768px) {
  .carousel-slide-thumb {
    width: 80px;
    height: 52px;
  }

  .layout-preview-slide {
    max-height: 200px;
  }

  .layout-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 8px;
  }

  .layout-picker-card {
    padding: 10px 6px;
  }

  .layout-picker-icon {
    width: 54px;
    height: 34px;
  }

  .layout-picker-icon svg {
    width: 40px;
    height: 24px;
  }
}

/* Large Layout Preview Icons */
.layout-preview-lg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.layout-preview-lg svg {
  width: 80%;
  height: 80%;
  max-width: 300px;
  max-height: 180px;
}

/* ============================================
   END NEW LAYOUT STUDIO
   ============================================ */

.history-container {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.4fr);
  gap: 24px;
  align-items: start;
}

.history-list-panel,
.history-detail-panel {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  box-shadow: 0 18px 40px rgba(20, 19, 32, 0.1);
  display: grid;
  gap: 16px;
}

.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-panel-header strong {
  font-size: 1.05rem;
}

.history-panel-header span {
  font-size: 0.86rem;
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 18px 10px;
}

.history-item {
  text-align: left;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 12px 26px rgba(20, 19, 32, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(20, 19, 32, 0.14);
  border-color: var(--accent);
}

.history-item.active {
  border-color: var(--accent);
  box-shadow: 0 18px 36px rgba(20, 19, 32, 0.16);
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.08), rgba(83, 198, 183, 0.08));
}

.history-item-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.history-item-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.history-item-extra {
  font-size: 0.82rem;
  color: var(--muted);
}

.history-item-prompt {
  font-size: 0.9rem;
  color: var(--ink-2);
  max-height: 3.6em;
  overflow: hidden;
}

.history-list-actions {
  display: flex;
  justify-content: center;
}

.history-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-detail-header strong {
  font-size: 1.1rem;
  color: var(--ink);
}

.history-detail-header span {
  color: var(--muted);
  font-size: 0.88rem;
}

.history-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.history-preview {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(20, 19, 32, 0.08);
  background: rgba(20, 19, 32, 0.02);
  min-height: 260px;
}

.history-preview iframe {
  width: 100%;
  height: 260px;
  border: none;
  display: none;
}

.history-preview iframe.active {
  display: block;
}

.history-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 260px;
  color: var(--muted);
}

.history-preview-placeholder svg {
  opacity: 0.3;
}

.history-preview-placeholder p {
  margin: 0;
  font-size: 0.95rem;
}

.history-preview-placeholder.hidden {
  display: none;
}

.history-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 16px;
  background: rgba(20, 19, 32, 0.04);
  border: 1px solid rgba(20, 19, 32, 0.08);
}

.history-messages .message {
  font-size: 0.92rem;
  padding: 10px 14px;
  box-shadow: 0 8px 18px rgba(20, 19, 32, 0.12);
}

.history-messages-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 18px 10px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-header strong {
  font-size: 1.05rem;
}

.panel-header span {
  color: var(--muted);
  font-size: 0.88rem;
}

.panel-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.profile-form {
  display: grid;
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.form-field input {
  border-radius: 14px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
}

.form-field input:disabled {
  background: rgba(20, 19, 32, 0.04);
}

.avatar-uploader {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.avatar-uploader input {
  display: none;
}

.avatar-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Avatar upload progress */
.upload-progress {
  width: 100%;
  display: none;
  margin-top: 12px;
}

.upload-progress.visible {
  display: block;
}

.upload-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(20, 19, 32, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-purple));
  transition: width 0.3s ease;
  border-radius: 3px;
}

.upload-progress-text {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 0.85fr);
  gap: 18px;
  align-items: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.chat-card {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(20, 19, 32, 0.2);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 16px;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(20, 19, 32, 0.06);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.chat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 15% 0%, rgba(83, 198, 183, 0.18), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(255, 107, 90, 0.16), transparent 50%);
  opacity: 0.9;
  animation: chatGlow 6s ease-in-out infinite;
  pointer-events: none;
}

.chat-card>* {
  position: relative;
  z-index: 1;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px 10px;
}

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

.chat-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(20, 19, 32, 0.15);
  border-radius: 8px;
  background: #f8f8f8;
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-action-btn:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: var(--accent);
}

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

.chat-action-btn svg {
  flex-shrink: 0;
}

.chat-action-btn svg.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Export dropdown */
.export-dropdown {
  position: relative;
}

.export-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(20, 19, 32, 0.12);
  border: 1px solid rgba(20, 19, 32, 0.08);
  min-width: 180px;
  padding: 4px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.export-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.export-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text, #141320);
  border-radius: 6px;
  transition: background 0.15s ease;
  text-align: left;
}

.export-option:hover {
  background: rgba(99, 102, 241, 0.08);
}

.export-option svg {
  color: var(--muted, #888);
  flex-shrink: 0;
}

.chat-title {
  font-weight: 700;
  font-size: 1.15rem;
}

.chat-subtitle {
  color: var(--muted);
  font-size: 0.92rem;
}

.chat-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(83, 198, 183, 0.18);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-messages {
  display: block;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.7));
  border: 1px solid rgba(20, 19, 32, 0.06);
}

/* Build page message styles - scoped to avoid conflicts with chat-page */
.build-page .chat-messages>.message {
  margin-bottom: 16px;
}

.build-page .chat-messages>.message:last-child {
  margin-bottom: 0;
}

.build-page .message {
  max-width: min(520px, 90%);
  width: fit-content;
  background: var(--surface);
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: 0 12px 24px rgba(20, 19, 32, 0.12);
  color: var(--ink-2);
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 1.02rem;
  word-break: break-word;
  overflow-wrap: anywhere;
  animation: messagePop 0.35s ease;
}

.build-page .message.user {
  margin-left: auto;
  background: linear-gradient(140deg, rgba(255, 107, 90, 0.2), rgba(83, 198, 183, 0.2));
  border: 1px solid rgba(20, 19, 32, 0.08);
}

.build-page .message.assistant {
  border: 1px solid rgba(20, 19, 32, 0.06);
  position: relative;
}

.build-page .message.assistant.streaming {
  position: relative;
  overflow: hidden;
}

.build-page .message.assistant.streaming::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
      rgba(255, 255, 255, 0) 20%,
      rgba(255, 255, 255, 0.7) 45%,
      rgba(255, 255, 255, 0) 70%);
  transform: translateX(-60%);
  animation: streamReveal 1.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes streamReveal {
  0% {
    transform: translateX(-60%);
  }

  60% {
    transform: translateX(10%);
  }

  100% {
    transform: translateX(60%);
  }
}

/* Message content wrapper */
.message-content {
  flex: 1;
  min-width: 0;
}

/* Message action buttons */
.message-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-top: 8px;
  justify-content: flex-end;
}

.build-page .message:hover .message-actions {
  opacity: 1;
}

.message-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(20, 19, 32, 0.06);
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted, #888);
  transition: background 0.2s, color 0.2s;
}

.message-action-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent, #6366f1);
}

.message-action-btn svg {
  flex-shrink: 0;
}

/* Message edit form */
.message-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.message-edit-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid rgba(20, 19, 32, 0.15);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.message-edit-textarea:focus {
  outline: none;
  border-color: var(--accent, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.message-edit-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.message-attachments .attachment-item {
  background: rgba(255, 255, 255, 0.9);
}

.message h1,
.message h2,
.message h3,
.message h4,
.message h5,
.message h6 {
  font-family: inherit;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.2;
}

.message h1 {
  font-size: 1.35rem;
}

.message h2 {
  font-size: 1.2rem;
}

.message h3 {
  font-size: 1.05rem;
}

.message h4 {
  font-size: 1rem;
}

.message h5 {
  font-size: 0.95rem;
}

.message h6 {
  font-size: 0.9rem;
}

.message p {
  margin: 0 0 8px;
}

.message p:last-child {
  margin-bottom: 0;
}

.message strong {
  color: var(--ink);
  font-weight: 700;
}

.message em {
  color: var(--ink-2);
}

.message code {
  font-family: inherit;
  background: rgba(20, 19, 32, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

.message pre {
  background: #12111c;
  color: #f4f0ea;
  padding: 14px 16px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 10px 0 12px;
  font-size: 0.95rem;
  line-height: 1.6;
  font-family: inherit;
}

.message pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.message ul,
.message ol {
  margin: 6px 0 12px 20px;
  display: grid;
  gap: 6px;
}

.message blockquote {
  margin: 8px 0 12px;
  padding: 10px 14px;
  border-left: 3px solid rgba(83, 198, 183, 0.6);
  background: rgba(83, 198, 183, 0.08);
  border-radius: 8px;
  color: var(--ink-2);
}

:not(.chat-page) .chat-input {
  display: grid;
  gap: 8px;
  background: var(--surface);
  border-radius: 16px;
  padding: 8px;
  border: 1px solid rgba(20, 19, 32, 0.1);
  position: relative;
}

.chat-input-bar {
  display: none;
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(20, 19, 32, 0.1);
}

.attach-btn:hover {
  background: rgba(20, 19, 32, 0.06);
  border-color: rgba(20, 19, 32, 0.15);
}

.attach-btn span {
  display: none;
}

.attach-btn::before {
  content: "📎";
  font-size: 1.1rem;
}

.attach-btn input {
  display: none;
}

/* Template button and dropdown */
.template-dropdown {
  position: relative;
}

.template-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(20, 19, 32, 0.1);
}

.template-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent, #6366f1);
}

.template-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(20, 19, 32, 0.15);
  border: 1px solid rgba(20, 19, 32, 0.08);
  min-width: 180px;
  padding: 6px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.template-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.template-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text, #141320);
  border-radius: 8px;
  transition: background 0.15s ease;
  text-align: left;
}

.template-option:hover {
  background: rgba(99, 102, 241, 0.08);
}

.template-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.template-label {
  font-weight: 500;
}

.drop-zone {
  display: none;
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(83, 198, 183, 0.5);
  border-radius: 16px;
  padding: 20px;
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(83, 198, 183, 0.08);
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  z-index: 10;
}

.drop-zone.dragover {
  display: flex;
  border-color: rgba(83, 198, 183, 0.8);
  background: rgba(83, 198, 183, 0.15);
  color: var(--ink);
}

.attachment-preview {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-preview:not(:empty) {
  display: flex;
}

.attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(20, 19, 32, 0.1);
  background: rgba(248, 245, 241, 0.6);
  font-size: 0.82rem;
}

.attachment-item img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
}

.attachment-meta {
  display: grid;
  gap: 1px;
}

.attachment-item strong {
  font-weight: 600;
  font-size: 0.82rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta span {
  color: var(--muted);
  font-size: 0.72rem;
}

.attachment-remove {
  border: none;
  background: rgba(20, 19, 32, 0.08);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--ink);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-remove:hover {
  background: rgba(255, 107, 90, 0.15);
  color: #ff6b5a;
}

:not(.chat-page) .chat-compose {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: flex-end;
}

:not(.chat-page) .chat-input textarea {
  resize: vertical;
  min-height: 40px;
  max-height: 120px;
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  padding: 8px 12px;
  font-family: inherit;
  background: rgba(248, 245, 241, 0.4);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.2s ease, background 0.2s ease;
}

:not(.chat-page) .chat-input textarea:focus {
  outline: none;
  border-color: rgba(83, 198, 183, 0.4);
  background: rgba(248, 245, 241, 0.6);
}

:not(.chat-page) .chat-input textarea::placeholder {
  color: #8a8798;
  font-size: 0.92rem;
}

:not(.chat-page) .chat-input .btn {
  font-size: 0.95rem;
  padding: 10px 20px;
  position: relative;
  overflow: hidden;
  height: 40px;
}

:not(.chat-page) .chat-input .btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.6), transparent 60%);
  opacity: 0;
  transform: scale(0.4);
  animation: pulseParticles 2.8s ease-in-out infinite;
}

:not(.chat-page) .chat-input .btn:disabled::after {
  animation-play-state: paused;
  opacity: 0;
}

.chat-helper {
  display: none;
}

.chat-aside {
  display: grid;
  gap: 14px;
  overflow: visible;
  height: 100%;
  min-height: 0;
}

.history-card {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 22px;
  padding: 20px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 50px rgba(20, 19, 32, 0.15);
  height: 100%;
  min-height: 0;
  overflow: visible;
  position: relative;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
  flex-shrink: 0;
}

.history-header strong {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.history-new {
  border: none;
  background: rgba(20, 19, 32, 0.08);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  cursor: pointer;
}

.history-search {
  position: relative;
  margin: 8px 0;
  flex-shrink: 0;
}

.history-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.history-search input:focus {
  outline: none;
  border-color: var(--accent, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.history-search input::placeholder {
  color: rgba(20, 19, 32, 0.4);
}

.history-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(20, 19, 32, 0.4);
  pointer-events: none;
}

.history-item.pinned {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.03);
}

.history-item.pinned .pin-indicator {
  display: inline-flex;
  color: var(--accent, #6366f1);
  margin-right: 4px;
}

.pin-indicator {
  display: none;
}

.history-title-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.history-title-wrap strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-aside .history-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  overflow-x: visible;
  padding-right: 6px;
  padding-bottom: 10px;
  align-content: flex-start;
  position: relative;
  flex: 1;
  min-height: 0;
  max-height: 100%;
}

.chat-aside .history-item {
  border: 1px solid rgba(20, 19, 32, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(20, 19, 32, 0.05);
  z-index: 1;
  overflow: visible;
}

.history-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20, 19, 32, 0.1);
  border-color: rgba(83, 198, 183, 0.3);
  z-index: 5;
}

.history-info {
  display: grid;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.history-info strong {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.history-actions {
  position: relative;
}

.history-menu-btn {
  border: none;
  background: rgba(20, 19, 32, 0.08);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 19, 32, 0.25), 0 0 0 1px rgba(20, 19, 32, 0.05);
  border: 1px solid rgba(20, 19, 32, 0.1);
  padding: 6px;
  display: none;
  z-index: 1000;
  min-width: 100px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.history-menu.open {
  display: grid;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.history-item:has(.history-menu.open) {
  z-index: 100;
}

.history-item:nth-last-child(-n+3) .history-menu {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 4px;
  transform: translateY(4px);
}

.history-item:nth-last-child(-n+3) .history-menu.open {
  transform: translateY(0);
}

.history-menu button {
  border: none;
  background: transparent;
  color: var(--text, #141320);
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  text-align: left;
  border-radius: 6px;
  transition: background 0.2s ease;
  font-size: 0.85rem;
  width: 100%;
}

.history-menu button:hover {
  background: rgba(99, 102, 241, 0.08);
}

.history-menu button.danger {
  color: #b74136;
  font-weight: 600;
}

.history-menu button.danger:hover {
  background: rgba(183, 65, 54, 0.1);
}

.history-item.active {
  border-color: rgba(83, 198, 183, 0.6);
  background: rgba(83, 198, 183, 0.08);
}

.history-item span {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.history-empty {
  font-size: 0.85rem;
  color: var(--muted);
  flex-shrink: 0;
}

.chat-aside .feature {
  background: rgba(255, 255, 255, 0.65);
  box-shadow: none;
  border: 1px solid rgba(20, 19, 32, 0.06);
  transform: translateZ(0);
  opacity: 0.85;
  padding: 16px;
}

.chat-aside .feature p {
  color: var(--muted);
  font-size: 0.88rem;
}

.chat-aside .feature strong {
  font-size: 0.95rem;
}

.chat-messages::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
  background: rgba(20, 19, 32, 0.2);
  border-radius: 999px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 19, 32, 0.35);
}

.chat-messages::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
  background: rgba(20, 19, 32, 0.05);
  border-radius: 999px;
}

.typing-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  height: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding-left: 6px;
}

.typing-indicator.show {
  opacity: 1;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(20, 19, 32, 0.35);
  animation: typingBounce 1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

.typing-indicator .typing-text {
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  animation: none;
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 6px;
}

@keyframes chatGlow {

  0%,
  100% {
    opacity: 0.75;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-6px);
  }
}

@keyframes messagePop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes typingBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@keyframes pulseParticles {

  0%,
  100% {
    opacity: 0.2;
    transform: scale(0.6);
  }

  50% {
    opacity: 0.7;
    transform: scale(1);
  }
}

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

/* Loading Spinner Animations */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: inherit;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: all;
}

[data-theme="dark"] .loading-overlay {
  background: rgba(18, 18, 24, 0.95);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .loading-overlay {
    background: rgba(18, 18, 24, 0.95);
  }
}

.spinner {
  width: 48px;
  height: 48px;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
      var(--accent),
      var(--accent-2),
      var(--accent-3),
      var(--accent));
  animation: spinGradient 1.2s linear infinite;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center;
  box-shadow: 0 8px 24px rgba(255, 107, 90, 0.3);
}

.spinner::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--surface);
}

.spinner-small {
  width: 32px;
  height: 32px;
  aspect-ratio: 1 / 1;
}

.spinner-small::before {
  inset: 3px;
}

.loading-text {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spinGradient {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

/* History list loading state */
.history-list.loading {
  position: relative;
  min-height: 120px;
}

/* Message area loading state */
.chat-messages.loading {
  position: relative;
  min-height: 200px;
}

/* Deleting state for history items */
.history-item.deleting {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
  transform: scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.history-item.deleting .history-info {
  opacity: 0.5;
}

.history-item.deleting .history-actions {
  opacity: 0;
}

.history-item.deleting::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid rgba(255, 107, 90, 0.2);
  border-top-color: var(--accent);
  animation: spinCentered 0.8s linear infinite;
  z-index: 10;
}

@keyframes spinCentered {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Reveal animation — handled by IntersectionObserver + .visible class (see below) */
/* Removed duplicate fadeIn animation that conflicted with scroll-triggered reveals */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .nav-links {
    display: none;
  }

  .hero {
    padding-top: 10px;
  }

  .compare-row {
    grid-template-columns: 1fr;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .chat-section {
    padding-bottom: 20px;
  }

  .chat-card {
    min-height: 400px;
  }

  .history-card {
    max-height: 300px;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .build-grid {
    grid-template-columns: 1fr;
  }
}

/* Progress Circle Styles */
.progress-container {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 20px 0;
}

.progress-circle {
  position: relative;
  flex-shrink: 0;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: rgba(20, 19, 32, 0.08);
  stroke-width: 8;
}

.progress-ring-fill {
  fill: none;
  stroke: url(#progressGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.progress-percent {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.progress-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.progress-status h3 {
  font-size: 1.4rem;
  color: var(--ink);
  margin: 0;
}

.progress-status p {
  font-size: 1rem;
  color: var(--muted);
  margin: 0;
}

/* Preview Container Styles */
.preview-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-actions-top {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.preview-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(20, 19, 32, 0.08);
  background: rgba(20, 19, 32, 0.02);
  min-height: 500px;
}

.preview-frame iframe {
  width: 100%;
  height: 500px;
  border: none;
  display: none;
}

.preview-frame iframe.active {
  display: block;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 500px;
  color: var(--muted);
}

.preview-placeholder svg {
  opacity: 0.3;
}

.preview-placeholder p {
  font-size: 1.05rem;
  margin: 0;
}

.preview-placeholder.hidden {
  display: none;
}

/* Refine Container Styles */
.refine-container {
  display: grid;
  gap: 28px;
  min-width: 0;
  overflow: hidden;
}

.refine-section {
  display: grid;
  gap: 16px;
  min-width: 0;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(20, 19, 32, 0.08);
}

.section-header svg {
  color: var(--accent);
  flex-shrink: 0;
}

.section-header strong {
  font-size: 1.1rem;
  color: var(--ink);
}

.section-header span {
  font-size: 0.9rem;
  color: var(--muted);
  margin-left: auto;
}

.followup-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* Large Button Style */
.btn.large {
  padding: 16px 32px;
  font-size: 1.1rem;
  gap: 12px;
}

.btn.large svg {
  width: 22px;
  height: 22px;
}

/* Floating Action Buttons */
.fab-container {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 500;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 12px;
}

.fab-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  box-shadow: 0 12px 40px rgba(255, 107, 90, 0.4);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-button:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 16px 50px rgba(255, 107, 90, 0.5);
}

.fab-button:active {
  transform: scale(0.95);
}

.fab-menu {
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-menu.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid rgba(20, 19, 32, 0.12);
  box-shadow: 0 8px 24px rgba(20, 19, 32, 0.15);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.fab-menu-item:hover:not(:disabled) {
  transform: translateX(-4px);
  box-shadow: 0 12px 30px rgba(20, 19, 32, 0.2);
  border-color: var(--accent);
}

.fab-menu-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fab-menu-item svg {
  flex-shrink: 0;
}

/* Smart Sidebar */
.smart-sidebar {
  position: fixed;
  top: 80px;
  left: -420px;
  width: 420px;
  height: calc(100vh - 80px);
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 241, 0.96));
  backdrop-filter: blur(20px);
  border-radius: 0 24px 24px 0;
  box-shadow: 8px 0 40px rgba(20, 19, 32, 0.15);
  border: 1px solid rgba(20, 19, 32, 0.08);
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 400;
  display: flex;
  flex-direction: column;
}

.smart-sidebar.open {
  left: 0;
}

/* Floating sidebar toggle button (for smart-sidebar only) */
.smart-sidebar .sidebar-toggle {
  position: absolute;
  right: -48px;
  top: 20px;
  width: 44px;
  height: 44px;
  border-radius: 0 12px 12px 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(20, 19, 32, 0.08);
  border-left: none;
  box-shadow: 4px 4px 20px rgba(20, 19, 32, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: all 0.3s ease;
}

.smart-sidebar .sidebar-toggle:hover {
  background: var(--surface);
  transform: translateX(4px);
}

/* Dark mode for floating sidebar toggle */
[data-theme="dark"] .smart-sidebar .sidebar-toggle {
  background: rgba(26, 26, 36, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.3);
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .smart-sidebar .sidebar-toggle:hover {
  background: var(--paper-2, #1a1a24);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .smart-sidebar .sidebar-toggle {
    background: rgba(26, 26, 36, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.3);
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .smart-sidebar .sidebar-toggle:hover {
    background: var(--paper-2, #1a1a24);
  }
}

.sidebar-content {
  padding: 28px;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
}

.sidebar-header {
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(20, 19, 32, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-header strong {
  font-size: 1.3rem;
  color: var(--ink);
}

.sidebar-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-section-header h4 {
  margin: 0;
}

.sidebar-history-section {
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.deck-history-list {
  display: grid;
  gap: 12px;
  flex: 1;
  max-height: none;
  overflow-y: auto;
  overflow-x: visible;
  padding-right: 4px;
  min-height: 0;
}

.deck-history-empty {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 18px 10px;
}

.deck-history-item {
  position: relative;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 14px 30px rgba(20, 19, 32, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.deck-history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(20, 19, 32, 0.16);
  border-color: rgba(83, 198, 183, 0.45);
}

.deck-history-item:focus-visible {
  outline: 2px solid rgba(255, 107, 90, 0.6);
  outline-offset: 2px;
}

.deck-history-item.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.08), rgba(83, 198, 183, 0.08));
}

.deck-history-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.deck-history-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-word;
}

.deck-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.deck-history-time {
  font-weight: 600;
}

.deck-history-meta-text {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20, 19, 32, 0.06);
  font-weight: 600;
}

.deck-history-prompt {
  font-size: 0.86rem;
  color: var(--ink-2);
  max-height: 3.2em;
  overflow: hidden;
  line-height: 1.45;
}

.deck-history-side {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.deck-history-menu {
  position: relative;
}

/* Ensure parent item has higher z-index when menu is open */
.deck-history-item:has(.deck-history-menu-btn.active),
.deck-history-item.menu-open {
  z-index: 1002;
}

.deck-history-menu-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(20, 19, 32, 0.1);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.deck-history-menu-btn:hover,
.deck-history-menu-btn.active {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(20, 19, 32, 0.12);
}

.deck-history-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  box-shadow: 0 12px 30px rgba(20, 19, 32, 0.2);
  padding: 6px;
  min-width: 140px;
  display: none;
  z-index: 1001;
}

.deck-history-menu-panel.open {
  display: grid;
}

.deck-history-item:nth-last-child(-n+2) .deck-history-menu-panel {
  top: auto;
  bottom: calc(100% + 6px);
}

.deck-history-menu-delete {
  border: none;
  background: transparent;
  color: #b74136;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.deck-history-menu-delete:hover {
  background: rgba(183, 65, 54, 0.12);
}

.sidebar-history-actions {
  display: flex;
  justify-content: flex-end;
}

.sidebar-section h4 {
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  font-size: 0.85rem;
}

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

.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 14px;
  background: linear-gradient(160deg, #fff, rgba(255, 255, 255, 0.7));
  border: 1px solid rgba(20, 19, 32, 0.08);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}

.template-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(20, 19, 32, 0.16);
  border-color: var(--accent-2);
}

.template-icon {
  font-size: 2rem;
}

.template-card span:last-child {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.history-list-compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item-compact {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.08);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.history-item-compact:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(20, 19, 32, 0.12);
  transform: translateY(-2px);
}

.history-item-compact-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.history-item-compact-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-empty-compact {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

/* Progress Gradient Definition */
svg defs {
  position: absolute;
}

@media (max-width: 920px) {
  .build-workflow-container {
    padding: 0 5vw;
  }

  .progress-container {
    flex-direction: column;
    text-align: center;
  }

  .history-container {
    grid-template-columns: 1fr;
  }

  .history-list {
    max-height: 320px;
  }

  .fab-container {
    bottom: 20px;
    right: 20px;
  }

  .smart-sidebar {
    width: 100%;
    left: -100%;
    border-radius: 0;
  }

  .sidebar-toggle {
    right: -52px;
  }

}

@media (max-width: 700px) {
  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .cta-card {
    padding: 30px;
  }

  .chat-compose {
    gap: 6px;
  }

  .chat-compose .attach-btn {
    width: 32px;
    height: 32px;
  }

  :not(.chat-page) .chat-input .btn {
    padding: 10px 16px;
    font-size: 0.9rem;
  }

  .build-options {
    grid-template-columns: 1fr;
  }

  .workflow-card {
    padding: 20px;
  }

  .step-number {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .step-info strong {
    font-size: 1.1rem;
  }

  .preview-frame,
  .preview-frame iframe {
    min-height: 350px;
    height: 350px;
  }

  .deck-history-item {
    grid-template-columns: 1fr;
  }

  .deck-history-side {
    grid-auto-flow: column;
    justify-content: space-between;
    width: 100%;
  }

  .fab-button {
    width: 52px;
    height: 52px;
  }

  .fab-menu-item span {
    display: none;
  }

  .fab-menu-item {
    width: 48px;
    height: 48px;
    padding: 12px;
    border-radius: 50%;
    justify-content: center;
  }
}

/* Custom Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 19, 32, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 40px 100px rgba(20, 19, 32, 0.4);
  max-width: 440px;
  width: 100%;
  display: grid;
  gap: 24px;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  animation: modalSlideUp 0.4s ease forwards;
}

.modal-overlay.show .modal-card {
  transform: scale(1) translateY(0);
}

.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.15), rgba(255, 107, 90, 0.25));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: var(--accent);
}

.modal-icon svg {
  width: 32px;
  height: 32px;
}

.modal-content {
  text-align: center;
  display: grid;
  gap: 12px;
}

.modal-content h3 {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.5rem;
  color: var(--ink);
  margin: 0;
  font-weight: 600;
}

.modal-content p {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.modal-actions .btn {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  justify-content: center;
  text-align: center;
}

.avatar-crop-card {
  max-width: 520px;
}

/* ==============================================
   UNIFIED MODAL HEADER DESIGN
   ============================================== */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 var(--space-4) 0;
  border-bottom: 1px solid var(--border-light);
  margin: -8px -8px 0 -8px;
  padding: 0 8px var(--space-4) 8px;
}

.modal-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.modal-header h3 svg {
  width: 20px;
  height: 20px;
  color: var(--primary-strong, #2c8a7d);
}

.modal-header span {
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: rgba(20, 19, 32, 0.04);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(20, 19, 32, 0.08);
  color: var(--ink);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

/* ==============================================
   UNIFIED MODAL FOOTER DESIGN
   ============================================== */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) 0 0 0;
  border-top: 1px solid var(--border-light);
  margin: 0 -8px -8px -8px;
  padding: var(--space-4) 8px 0 8px;
}

.modal-footer .btn {
  min-width: 100px;
  justify-content: center;
}

.modal-footer .btn.secondary {
  order: 1;
}

.modal-footer .btn.primary {
  order: 2;
  background: var(--primary, #53c6b7);
  color: white;
}

.modal-footer .btn.primary:hover {
  background: var(--primary-light, #6dd5c7);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb, 83, 198, 183), 0.25);
}

.modal-footer .btn.danger {
  order: 2;
  background: var(--danger, #ef4444);
  color: white;
}

.modal-footer .btn.danger:hover {
  background: #f87171;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* Modal body with consistent padding */
.modal-body {
  padding: var(--space-4) 0;
}

/* Dark mode modal adjustments */
[data-theme="dark"] .modal-header {
  border-bottom-color: var(--border-light);
}

[data-theme="dark"] .modal-footer {
  border-top-color: var(--border-light);
}

[data-theme="dark"] .modal-close {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

[data-theme="dark"] .modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

.avatar-cropper {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 18px;
  background: rgba(20, 19, 32, 0.04);
  border: 1px solid rgba(20, 19, 32, 0.08);
}

.avatar-cropper canvas {
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(20, 19, 32, 0.08);
}

.crop-zoom {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.crop-zoom input {
  width: 100%;
}

.btn.danger {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 30px rgba(255, 107, 90, 0.3);
  border: none;
}

.btn.danger:hover {
  background: #ff5545;
  box-shadow: 0 16px 40px rgba(255, 107, 90, 0.4);
}

.btn.danger.loading {
  background: #ff8575;
  cursor: wait;
  pointer-events: none;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(30px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ============================================
   BUILD STUDIO - New Efficient Layout
   ============================================ */

.build-studio {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.build-footer {
  flex-shrink: 0;
  padding: 12px 24px;
}

/* Create Mode - Centered Input Form */
.studio-create-mode {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.create-form-container {
  width: 100%;
  max-width: 780px;
  background: linear-gradient(135deg,
      rgba(255, 250, 245, 0.95) 0%,
      rgba(255, 243, 235, 0.92) 25%,
      rgba(245, 248, 252, 0.92) 50%,
      rgba(248, 252, 245, 0.95) 75%,
      rgba(255, 248, 240, 0.95) 100%);
  border-radius: 28px;
  padding: 48px 56px;
  box-shadow:
    0 30px 90px rgba(20, 19, 32, 0.15),
    0 0 0 1px rgba(255, 107, 90, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(20, 19, 32, 0.06);
  position: relative;
  overflow: hidden;
}

.create-form-container::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -25%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle,
      rgba(255, 107, 90, 0.12) 0%,
      rgba(247, 196, 76, 0.08) 40%,
      transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: float 8s ease-in-out infinite;
}

.create-form-container::after {
  content: "";
  position: absolute;
  bottom: -45%;
  left: -25%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle,
      rgba(83, 198, 183, 0.1) 0%,
      rgba(83, 198, 183, 0.05) 40%,
      transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(20px, -20px) scale(1.05);
  }
}

.create-header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.create-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
}

.create-header p {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0;
}

.create-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.create-form textarea {
  border-radius: 14px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  padding: 14px 16px;
  font-size: 1rem;
  color: var(--ink);
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.create-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.15);
  outline: none;
}

.create-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.create-options input,
.create-options select {
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  padding: 10px 14px;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
}

/* Length Options (Radio Buttons) */
.length-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.length-option {
  position: relative;
  cursor: pointer;
  display: block;
}

.length-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.length-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 2px solid rgba(20, 19, 32, 0.12);
  background: var(--surface);
  transition: all 0.2s ease;
  text-align: center;
}

.length-label strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.length-label small {
  font-size: 0.75rem;
  color: var(--muted);
}

.length-option input[type="radio"]:checked+.length-label {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.08), rgba(247, 196, 76, 0.08));
  box-shadow: 0 4px 12px rgba(255, 107, 90, 0.15);
}

.length-option input[type="radio"]:checked+.length-label strong {
  color: var(--accent);
}

.length-option:hover .length-label {
  border-color: rgba(255, 107, 90, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(20, 19, 32, 0.08);
}

.create-form .btn.large {
  margin-top: 8px;
}

/* Workspace Mode - Split Layout */
.studio-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 0;
  min-height: 0;
  animation: fadeIn 0.4s ease;
  overflow: hidden;
}

.studio-workspace.hidden {
  display: none;
}

/* Left Panel: Preview */
.workspace-preview {
  position: relative;
  background: linear-gradient(145deg, #f8f5f1, #fff);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Progress Overlay */
.preview-progress-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.preview-progress-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.progress-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.progress-circle {
  position: relative;
  width: 100px;
  height: 100px;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: rgba(20, 19, 32, 0.08);
  stroke-width: 6;
}

.progress-ring-fill {
  fill: none;
  stroke: url(#progressGradient);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 263.89;
  stroke-dashoffset: 263.89;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.progress-percent {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
}

.progress-info h3 {
  font-size: 1.3rem;
  color: var(--ink);
  margin: 0 0 6px;
}

.progress-info p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

/* Preview Main */
.preview-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(20, 19, 32, 0.06);
  border: 1px solid rgba(20, 19, 32, 0.06);
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink);
}

.preview-title svg {
  color: var(--accent);
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.preview-frame-container {
  flex: 1;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(20, 19, 32, 0.08);
  box-shadow: 0 8px 32px rgba(20, 19, 32, 0.08);
  position: relative;
  min-height: 400px;
}

.preview-frame-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
  position: absolute;
  top: 0;
  left: 0;
}

.preview-frame-container iframe.active {
  display: block;
}

.preview-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
}

.preview-placeholder svg {
  opacity: 0.3;
}

.preview-placeholder p {
  font-size: 1rem;
  margin: 0;
}

.preview-placeholder.hidden {
  display: none;
}

/* Right Panel: Controls */
.workspace-controls {
  background: var(--surface);
  border-left: 1px solid rgba(20, 19, 32, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Status Bar */
.control-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.05), rgba(247, 196, 76, 0.03));
  border-bottom: 1px solid rgba(20, 19, 32, 0.06);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-label {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Tabs */
.control-tabs {
  display: flex;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
  padding: 0 16px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  background: none;
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  color: var(--ink);
}

.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-btn svg {
  flex-shrink: 0;
}

/* Tab Content */
.tab-content {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

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

/* Chat Tab (for tab-based layouts only) */
.tab-content .chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(248, 245, 241, 0.5);
}

.tab-content .chat-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 32px 16px;
}

.tab-content .chat-messages .message {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 90%;
  box-shadow: 0 2px 8px rgba(20, 19, 32, 0.06);
}

.tab-content .chat-messages .message.user {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.tab-content .chat-messages .message:not(.user) {
  background: var(--surface);
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-input-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid rgba(20, 19, 32, 0.06);
}

.chat-input-form textarea {
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.1);
  padding: 12px 14px;
  font-size: 0.92rem;
  color: var(--ink);
  resize: none;
  transition: border-color 0.2s;
}

.chat-input-form textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.chat-input-form .btn {
  align-self: flex-end;
}

/* Layout Tab */
.layout-studio-wrapper {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.layout-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
  padding: 32px;
}

.layout-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.1), rgba(83, 198, 183, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
}

.layout-empty-icon svg {
  opacity: 0.5;
}

.layout-empty-state p {
  font-size: 0.9rem;
  margin: 0;
}

.layout-studio {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.layout-studio.active {
  display: flex;
}

/* Compact Layout Carousel */
.layout-carousel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(248, 245, 241, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(20, 19, 32, 0.06);
}

.carousel-nav {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(20, 19, 32, 0.1);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.carousel-nav:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.carousel-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.carousel-track-wrapper {
  flex: 1;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  gap: 8px;
  transition: transform 0.3s ease;
}

.carousel-slide-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 44px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.carousel-slide-thumb:hover {
  border-color: rgba(255, 107, 90, 0.4);
}

.carousel-slide-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(255, 107, 90, 0.25);
}

.carousel-slide-thumb.modified::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.carousel-slide-num {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide-thumb.active .carousel-slide-num {
  background: var(--accent);
}

.carousel-thumb-icon {
  width: 40px;
  height: 24px;
  color: var(--muted);
  opacity: 0.6;
}

.carousel-thumb-icon svg {
  width: 100%;
  height: 100%;
}

/* Layout Preview */
.layout-preview {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(20, 19, 32, 0.06);
  box-shadow: 0 4px 16px rgba(20, 19, 32, 0.04);
}

.layout-preview-slide {
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #fafafa, #f5f5f5);
  border-radius: 10px;
  border: 1px solid rgba(20, 19, 32, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.layout-preview-slide svg {
  width: 60%;
  height: 60%;
  color: var(--muted);
  opacity: 0.4;
}

.layout-preview-slide.has-content svg {
  opacity: 0.7;
  color: var(--ink-2);
}

.layout-preview-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.layout-preview-info span:first-child {
  font-weight: 600;
  color: var(--ink);
}

.layout-preview-info span:last-child {
  color: var(--muted);
}

/* Layout Picker */
.layout-picker {
  background: rgba(248, 245, 241, 0.5);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(20, 19, 32, 0.06);
}

.layout-picker-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.layout-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.layout-picker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
  background: var(--surface);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.layout-picker-card:hover {
  border-color: rgba(255, 107, 90, 0.3);
  transform: translateY(-1px);
}

.layout-picker-card.selected {
  border-color: var(--accent);
  background: rgba(255, 107, 90, 0.05);
}

.layout-picker-icon {
  width: 32px;
  height: 20px;
  color: var(--muted);
}

.layout-picker-icon svg {
  width: 100%;
  height: 100%;
}

.layout-picker-card.selected .layout-picker-icon {
  color: var(--accent);
}

.layout-picker-name {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
}

.layout-picker-card.selected .layout-picker-name {
  color: var(--ink);
  font-weight: 600;
}

/* Layout Actions */
.layout-studio-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* Theme Picker */
.theme-picker {
  background: rgba(248, 245, 241, 0.5);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(20, 19, 32, 0.06);
  margin-bottom: 8px;
}

.theme-picker-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-picker-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 70px;
}

.theme-card:hover {
  border-color: rgba(255, 107, 90, 0.3);
  transform: translateY(-1px);
}

.theme-card.selected {
  border-color: var(--accent);
  background: rgba(255, 107, 90, 0.05);
}

.theme-colors {
  display: flex;
  gap: 3px;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
}

.theme-color-swatch {
  width: 14px;
  height: 20px;
}

.theme-name {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.theme-card.selected .theme-name {
  color: var(--ink);
  font-weight: 600;
}

/* Export Dropdown */
.export-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dropdown-arrow {
  transition: transform 0.2s;
}

.export-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(20, 19, 32, 0.15);
  border: 1px solid rgba(20, 19, 32, 0.08);
  padding: 6px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
}

.export-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}

.dropdown-item:hover {
  background: rgba(255, 107, 90, 0.08);
  color: var(--accent);
}

.dropdown-item svg {
  opacity: 0.6;
}

.dropdown-item:hover svg {
  opacity: 1;
}

.dropdown-item.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.dropdown-item.loading {
  position: relative;
  color: transparent;
}

.dropdown-item.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 107, 90, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Regenerate Button */
.regenerate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
}

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

.regenerate-btn.loading {
  position: relative;
  color: transparent;
}

.regenerate-btn.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 107, 90, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Layout Preview Info */
.layout-preview-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.preview-info-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-info-left span:first-child {
  font-weight: 600;
  color: var(--ink);
}

.preview-info-left span:last-child {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Drag Handle for Carousel */
.carousel-slide-thumb {
  cursor: grab;
}

.carousel-slide-thumb:active {
  cursor: grabbing;
}

.carousel-slide-thumb.sortable-ghost {
  opacity: 0.4;
  border-color: var(--accent);
}

.carousel-slide-thumb.sortable-drag {
  box-shadow: 0 4px 16px rgba(255, 107, 90, 0.3);
}

.carousel-drag-hint {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.layout-carousel:hover .carousel-drag-hint {
  opacity: 1;
}

/* Layout Loading Skeleton */
.layout-loading {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.layout-loading-carousel {
  display: flex;
  gap: 8px;
  overflow: hidden;
}

.layout-loading-thumb {
  width: 56px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f0ede9 25%, #e8e5e0 50%, #f0ede9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.layout-loading-preview {
  height: 120px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f0ede9 25%, #e8e5e0 50%, #f0ede9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.layout-loading-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.layout-loading-card {
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f0ede9 25%, #e8e5e0 50%, #f0ede9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

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

  100% {
    background-position: -200% 0;
  }
}

.layout-loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
  font-size: 0.9rem;
  gap: 10px;
}

.layout-loading-spinner::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 107, 90, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@media (max-width: 800px) {
  .layout-loading-picker {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .layout-loading-picker {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .layout-loading-picker {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive Workspace */
@media (max-width: 1200px) {
  .studio-workspace {
    grid-template-columns: 1fr 360px;
  }
}

@media (max-width: 960px) {
  .studio-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 50vh 1fr;
  }

  .workspace-controls {
    border-left: none;
    border-top: 1px solid rgba(20, 19, 32, 0.08);
  }
}

@media (max-width: 800px) {
  .layout-picker-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .create-form-container {
    padding: 28px 24px;
    border-radius: 20px;
  }

  .create-header h1 {
    font-size: 1.6rem;
  }

  .create-options {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .preview-actions {
    justify-content: center;
  }

  .layout-picker-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .layout-picker-card {
    padding: 6px 3px;
  }

  .layout-picker-name {
    font-size: 0.6rem;
  }
}

@media (max-width: 480px) {
  .layout-picker-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .layout-picker-card {
    padding: 10px 6px;
    gap: 6px;
  }

  .layout-picker-icon {
    width: 40px;
    height: 25px;
  }

  .layout-picker-name {
    font-size: 0.7rem;
  }
}

/* =============================================
   MIND MAP STYLES
   ============================================= */

.map-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

.map-sidebar {
  width: 280px;
  background: rgba(255, 255, 255, 0.7);
  border-right: 1px solid rgba(20, 19, 32, 0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.map-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
}

.map-sidebar-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.map-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.map-history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.map-history-empty span {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
}

.map-history-empty p {
  font-size: 0.85rem;
}

.map-history-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--ink-2);
  gap: 12px;
}

.map-history-loading span {
  font-size: 0.85rem;
  color: var(--ink-3);
}

.history-loading-spinner {
  animation: spin 1.5s linear infinite;
  color: var(--primary);
}

.history-loading-spinner svg {
  display: block;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.map-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 6px;
}

.map-history-item:hover {
  background: rgba(20, 19, 32, 0.04);
}

.map-history-item.active {
  background: rgba(255, 107, 90, 0.1);
  border: 1px solid rgba(255, 107, 90, 0.2);
}

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

.map-history-info strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-history-info span {
  font-size: 0.75rem;
  color: var(--muted);
}

.map-history-delete {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  border-radius: 6px;
}

.map-history-item:hover .map-history-delete {
  opacity: 1;
}

.map-history-delete:hover {
  color: var(--accent);
  background: rgba(255, 107, 90, 0.1);
}

.map-load-more {
  margin: 12px;
  width: calc(100% - 24px);
}

.map-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(20, 19, 32, 0.1);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s;
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--paper-2);
  border-color: var(--ink-2);
}

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

.toolbar-btn.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.toolbar-btn.danger:hover:not(:disabled) {
  background: rgba(255, 107, 90, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

.toolbar-btn.loading {
  position: relative;
  pointer-events: none;
}

.toolbar-btn.loading::after {
  content: "";
  position: absolute;
  right: 8px;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.toolbar-btn span {
  display: none;
}

@media (min-width: 900px) {
  .toolbar-btn span {
    display: inline;
  }
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(20, 19, 32, 0.1);
  margin: 0 8px;
}

.toolbar-spacer {
  flex: 1;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zoom-level {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 45px;
  text-align: center;
}

.map-canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#mindmapCanvas {
  width: 100%;
  height: 100%;
  background: var(--paper);
}

.map-empty-state {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  background: var(--paper);
}

.map-empty-state .empty-icon {
  color: var(--muted);
  margin-bottom: 20px;
}

.map-empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.map-empty-state p {
  color: var(--muted);
  margin-bottom: 24px;
}

.empty-actions {
  display: flex;
  gap: 12px;
}

.map-status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(20, 19, 32, 0.08);
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
}

.status-save {
  margin-left: auto;
  color: var(--accent-3);
}

.map-footer {
  padding: 12px 20px;
}

/* Context Menu */
.context-menu {
  display: none;
  position: fixed;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  min-width: 180px;
  z-index: 1000;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  text-align: left;
}

.context-menu-item:hover {
  background: var(--paper-2);
}

.context-menu-item.danger:hover {
  background: rgba(255, 107, 90, 0.1);
  color: var(--accent);
}

.context-menu-divider {
  height: 1px;
  background: rgba(20, 19, 32, 0.08);
  margin: 6px 0;
}

/* Color Picker */
.color-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.color-option {
  position: relative;
  width: 100%;
  padding: 8px;
  border: 2px solid transparent;
  background: var(--paper-2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.color-option:hover {
  background: var(--paper-3);
  transform: translateY(-2px);
}

.color-option.active {
  border-color: var(--accent);
  background: rgba(255, 107, 90, 0.08);
}

.color-preview {
  display: block;
  width: 100%;
  height: 30px;
  border: 2px solid;
  border-radius: 6px;
}

/* Icon Picker */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.icon-option {
  padding: 12px 8px;
  border: 2px solid transparent;
  background: var(--paper-2);
  border-radius: 8px;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.icon-option:hover {
  background: var(--paper-3);
  transform: translateY(-2px);
}

.icon-option.active {
  border-color: var(--accent);
  background: rgba(255, 107, 90, 0.08);
}

.icon-option:first-child {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-weight: 500;
}

/* Modal sizes */
.modal-medium {
  max-width: 500px;
}

/* Modal styles for mind map pages - use IDs to override opacity-based modal */
#generateModal,
#nodeEditModal,
#deleteModal,
#nodeStyleModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 19, 32, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: none;
}

#generateModal.show,
#nodeEditModal.show,
#deleteModal.show,
#nodeStyleModal.show {
  display: flex;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
}

.modal.modal-small {
  max-width: 380px;
  overflow: visible;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

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

.modal-close:hover {
  color: var(--ink);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid rgba(20, 19, 32, 0.08);
}

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

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(20, 19, 32, 0.15);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: #888;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Button danger variant */
.btn.danger {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn.danger:hover {
  background: #e55a4a;
}

/* Responsive mind map */
@media (max-width: 768px) {
  .map-sidebar {
    display: none;
  }

  .map-toolbar {
    padding: 10px 12px;
    gap: 6px;
  }

  .toolbar-divider {
    display: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   Mind Map Templates
   ============================================= */

.modal-large {
  max-width: 720px;
  width: 95%;
}

.templates-description {
  color: #666;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

.template-card {
  background: #f8f8f8;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card:hover {
  background: #f0f0f0;
  border-color: var(--accent);
  transform: translateY(-2px);
}

.template-card-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.template-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: #333;
}

.template-card-description {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.4;
}

/* =============================================
   Toast Notification System
   ============================================= */

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(20, 19, 32, 0.16),
    0 2px 8px rgba(20, 19, 32, 0.08);
  border-left: 4px solid currentColor;
  pointer-events: auto;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
  word-wrap: break-word;
}

.toast.toast-enter {
  transform: translateX(0);
  opacity: 1;
}

.toast.toast-exit {
  transform: translateX(calc(100% + 24px));
  opacity: 0;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  min-width: 0;
}

.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s;
  padding: 0;
}

.toast-close:hover {
  background: rgba(20, 19, 32, 0.06);
  color: var(--ink);
}

.toast-close:active {
  transform: scale(0.95);
}

/* Toast Type Colors */
.toast-success {
  color: #10b981;
  border-left-color: #10b981;
}

.toast-success .toast-icon {
  color: #10b981;
}

.toast-error {
  color: #ef4444;
  border-left-color: #ef4444;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-warning {
  color: #f59e0b;
  border-left-color: #f59e0b;
}

.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast-info {
  color: #3b82f6;
  border-left-color: #3b82f6;
}

.toast-info .toast-icon {
  color: #3b82f6;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .toast-container {
    left: 16px;
    right: 16px;
    top: 16px;
    max-width: none;
  }

  .toast {
    padding: 14px 16px;
    font-size: 13px;
  }
}

/* =============================================
   Global Loading Overlay
   ============================================= */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 245, 241, 0.85);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loading-overlay.show {
  display: flex;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(20, 19, 32, 0.15);
}

.loading-spinner {
  animation: spin 1.5s linear infinite;
  color: var(--accent);
}

.loading-spinner svg {
  display: block;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.loading-subtext {
  font-size: 0.875rem;
  color: var(--ink-3);
  margin: 0;
}

/* Dark mode for global loading overlay */
[data-theme="dark"] .loading-overlay {
  background: rgba(18, 18, 24, 0.92);
}

[data-theme="dark"] .loading-content {
  background: var(--paper-2, #1a1a24);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .loading-overlay {
    background: rgba(18, 18, 24, 0.92);
  }

  :root:not([data-theme="light"]) .loading-content {
    background: var(--paper-2, #1a1a24);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  }
}

/* =============================================
   Search Overlay
   ============================================= */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 19, 32, 0.5);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.search-overlay.show {
  display: flex;
}

.search-container {
  width: 90%;
  max-width: 560px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(20, 19, 32, 0.3);
  overflow: hidden;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
}

.search-input-wrapper svg {
  color: var(--ink-3);
  flex-shrink: 0;
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  background: transparent;
  color: var(--ink);
}

.search-input-wrapper input::placeholder {
  color: var(--ink-3);
}

.search-shortcut {
  font-size: 0.75rem;
  color: var(--ink-3);
  background: var(--paper-2);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

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

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--paper-2);
}

.search-result-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.search-result-content {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-path {
  font-size: 0.8rem;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-results {
  padding: 24px 20px;
  text-align: center;
  color: var(--ink-3);
}

.search-hint {
  padding: 12px 20px;
  font-size: 0.8rem;
  color: var(--ink-3);
  background: var(--paper-2);
  display: flex;
  gap: 16px;
}

.search-hint kbd {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ===== Help Panel / Keyboard Shortcuts Overlay ===== */
.help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.help-overlay.show {
  opacity: 1;
  visibility: visible;
}

.help-panel {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 900px;
  width: 95%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.help-overlay.show .help-panel {
  transform: scale(1) translateY(0);
}

.help-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--paper-2) 0%, white 100%);
}

.help-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-header h2 svg {
  color: var(--primary);
}

.help-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  transition: all 0.15s ease;
}

.help-close:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.help-content {
  padding: 20px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  /* Ensure minimum column width for content */
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.shortcut-group {
  background: var(--paper-2);
  border-radius: 12px;
  padding: 16px;
  transition: transform 0.15s ease;
}

.shortcut-group:hover {
  transform: translateY(-2px);
}

.shortcut-group h3 {
  margin: 0 0 12px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.shortcut-group h3 svg {
  opacity: 0.8;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.shortcut-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.shortcut-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink);
  box-shadow: 0 2px 0 var(--border), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.shortcut-desc {
  font-size: 0.85rem;
  color: var(--ink-2);
  text-align: right;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Prevent text from being cut off */
  flex: 1;
  min-width: 0;
}

.help-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--paper-2);
  text-align: center;
}

.help-footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-3);
}

.help-footer kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink);
  box-shadow: 0 1px 0 var(--border);
  margin: 0 4px;
}

/* Help button styling */
.toolbar-btn.help-btn {
  margin-left: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
}

.toolbar-btn.help-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* Responsive: Adjust layout for different screen sizes */
@media (max-width: 900px) {
  .help-panel {
    max-width: 95%;
  }

  .help-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .help-panel {
    max-width: 95%;
    max-height: 90vh;
  }

  .help-content {
    padding: 16px 20px;
  }

  .shortcut-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .shortcut-desc {
    text-align: left;
  }

  .shortcut-group {
    padding: 12px;
  }
}

/* Touch Action Panel - Floating buttons for touch devices */
.touch-action-panel {
  display: none;
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 8px 12px;
  gap: 8px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.touch-action-panel.visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.touch-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: var(--paper-2);
  border-radius: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.touch-action-btn:hover {
  background: var(--paper-3);
}

.touch-action-btn:active {
  transform: scale(0.95);
  background: var(--paper-3);
}

.touch-action-btn.danger {
  color: var(--accent);
}

.touch-action-btn.danger:hover,
.touch-action-btn.danger:active {
  background: rgba(255, 107, 90, 0.1);
}

.touch-action-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.touch-action-btn svg {
  width: 20px;
  height: 20px;
}

/* Show touch panel on touch devices or when viewport is small */
@media (hover: none) and (pointer: coarse) {
  .touch-action-panel.visible {
    display: flex;
  }
}

/* Also show on small screens regardless of input type */
@media (max-width: 768px) {
  .touch-action-panel.visible {
    display: flex;
  }

  /* Make toolbar buttons stack better on mobile */
  .map-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .toolbar-group {
    flex-wrap: wrap;
  }

  .toolbar-btn span {
    display: none;
  }

  .toolbar-divider {
    display: none;
  }
}


/* ============================================
   REFINED STYLES - Elegant Enhancements
   ============================================ */

/* Better section spacing and visual hierarchy */
.section {
  padding: 90px 7vw;
}

.section h2 {
  text-align: center;
  margin-bottom: 16px;
}

.section p.lead {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 50px;
  font-size: 1.1rem;
  line-height: 1.7;
}

/* Refined hero section */
.hero {
  padding: 50px 7vw 100px;
  min-height: 75vh;
}

.hero-copy h1 {
  letter-spacing: -0.02em;
}

.hero-badge {
  box-shadow: 0 4px 20px rgba(255, 107, 90, 0.3);
}

/* Better feature cards */
.feature {
  padding: 28px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px rgba(20, 19, 32, 0.12);
}

.feature .icon {
  width: 52px;
  height: 52px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
}

.feature strong {
  font-size: 1.15rem;
  margin-top: 4px;
}

.feature p {
  color: var(--muted);
  line-height: 1.6;
}

/* Refined step cards */
.step {
  padding: 28px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: rgba(255, 255, 255, 0.85);
}

.step:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(20, 19, 32, 0.1);
}

.step span {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.step h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--ink);
}

.step p {
  color: var(--muted);
  line-height: 1.6;
}

/* Better quote cards */
.quote {
  padding: 28px;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quote:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 50px rgba(20, 19, 32, 0.12);
}

.quote::before {
  content: '"';
  position: absolute;
  top: 16px;
  left: 20px;
  font-family: "Fraunces", serif;
  font-size: 4rem;
  color: var(--accent);
  opacity: 0.15;
  line-height: 1;
}

.quote p {
  position: relative;
  z-index: 1;
  font-style: italic;
  padding-left: 8px;
}

.quote .who strong {
  color: var(--ink);
}

/* Better pricing cards */
.plan {
  padding: 32px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.plan:hover {
  transform: translateY(-4px);
}

.plan.highlight {
  background: linear-gradient(135deg, var(--ink) 0%, #2b2a3a 100%);
  color: white;
  transform: translateY(-8px) scale(1.02);
}

.plan.highlight:hover {
  transform: translateY(-12px) scale(1.02);
}

.plan.highlight h3,
.plan.highlight .price,
.plan.highlight p {
  color: white;
}

.plan.highlight ul {
  color: rgba(255, 255, 255, 0.8);
}

/* .plan h3, .price, .price span — canonical rules moved to main .plan block above */

.plan p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.plan ul {
  text-align: left;
  margin-bottom: 24px;
  padding-left: 0;
}

.plan ul li {
  padding: 8px 0;
  padding-left: 24px;
  position: relative;
}

.plan ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-3);
  font-weight: 700;
}

.plan.highlight ul li::before {
  color: var(--accent-2);
}

.plan .btn {
  width: 100%;
  justify-content: center;
}

/* Better demo section */
.demo {
  padding: 36px;
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(20, 19, 32, 0.08);
}

.demo-tab {
  transition: all 0.3s ease;
}

.demo-tab:hover:not(.active) {
  background: rgba(20, 19, 32, 0.1);
}

.demo-panel {
  padding: 28px;
}

.demo-panel strong {
  font-size: 1.2rem;
  color: var(--ink);
}

.demo-panel p {
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 16px;
}

.demo-panel ul li {
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
}

.demo-panel ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Better CTA card */
.cta-card {
  padding: 50px;
}

.cta-card h2 {
  margin-bottom: 12px;
}

.cta-card p {
  opacity: 0.9;
  line-height: 1.6;
}

/* Better hero visual */
.hero-visual {
  padding: 32px;
}

.slide {
  padding: 22px 24px;
  transition: transform 0.3s ease;
}

.slide:hover {
  transform: translateX(4px);
}

.slide strong {
  font-size: 1rem;
}

/* Page header refinements */
.page-header {
  padding: 40px 7vw 30px;
  text-align: center;
}

.page-header h1 {
  font-size: clamp(2.2rem, 3vw, 3rem);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.page-header p {
  margin-left: auto;
  margin-right: auto;
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 600px;
}

/* Better nav link hover */
.nav-links a {
  transition: color 0.2s ease;
  position: relative;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

/* Better footer */
.footer {
  padding: 24px 7vw;
  border-top: 1px solid rgba(20, 19, 32, 0.08);
  margin-top: auto;
}

/* Workflow flow improvements */
.flow-example {
  padding: 32px 40px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.flow-example:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(20, 19, 32, 0.1);
}

.flow-arrow {
  box-shadow: 0 8px 24px rgba(255, 107, 90, 0.3);
}

.flow-output {
  transition: transform 0.2s ease;
}

.flow-output:hover {
  transform: scale(1.05);
}

/* Smooth reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal.delay {
  transition-delay: 0.15s;
}

.reveal.delay-2 {
  transition-delay: 0.3s;
}

/* Responsive refinements */
@media (max-width: 768px) {
  .section {
    padding: 60px 5vw;
  }

  .hero {
    padding: 30px 5vw 60px;
    min-height: auto;
  }

  .page-header {
    padding: 30px 5vw 20px;
  }

  .pricing {
    gap: 16px;
  }

  .plan.highlight {
    transform: none;
  }

  .plan.highlight:hover {
    transform: translateY(-4px);
  }

  .cta-card {
    padding: 32px 24px;
    text-align: center;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-meta {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Popular badge for pricing */
.plan {
  position: relative;
}

.plan-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  background: var(--ink);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  white-space: nowrap;
}

/* ============================================
   MODERN TECH-STYLE ENHANCEMENTS
   ============================================ */

/* Hero heading — solid color, clean */
.hero-copy h1 {
  color: var(--ink);
}

/* Subtle background tint — single, static */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(255, 107, 90, 0.04), transparent),
    radial-gradient(ellipse 60% 50% at 85% 30%, rgba(83, 198, 183, 0.04), transparent);
  pointer-events: none;
  z-index: -1;
}

/* Lightweight overrides — removed heavy animations, glassmorphism, and decorations */

/* Page header enhancements */
.page-header {
  position: relative;
}

.page-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

/* Account page enhancements */
.account-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
  overflow: hidden;
}

.account-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}

.account-avatar {
  position: relative;
  box-shadow: 0 8px 25px rgba(255, 107, 90, 0.2);
}

.account-panel {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(20, 19, 32, 0.08);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
}

.panel-header strong {
  font-size: 1.1rem;
  display: block;
  margin-bottom: 4px;
}

.panel-header span {
  color: var(--muted);
  font-size: 0.9rem;
}

.form-field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.form-field span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-2);
}

.form-field input {
  padding: 14px 16px;
  border: 1px solid rgba(20, 19, 32, 0.1);
  border-radius: 12px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background: rgba(255, 255, 255, 0.8);
}

.form-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.1);
}

.form-field input:disabled {
  background: rgba(20, 19, 32, 0.04);
  color: var(--muted);
}

.avatar-uploader {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.avatar-uploader input[type="file"] {
  display: none;
}

.avatar-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-actions {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(20, 19, 32, 0.08);
}

/* Quota bar enhancement */
.quota-bar {
  width: 100%;
  height: 6px;
  background: rgba(20, 19, 32, 0.1);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.quota-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-2));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.quota-warning {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 4px;
}

/* Account meta grid */
.account-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.account-meta>div {
  padding: 12px;
  background: rgba(20, 19, 32, 0.03);
  border-radius: 10px;
}

.meta-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Footer enhancement */
.footer {
  position: relative;
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(20, 19, 32, 0.15), transparent);
}

/* Workflow flow enhancements */
.flow-arrow svg {
  animation: arrowPulse 2s ease-in-out infinite;
}

@keyframes arrowPulse {

  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(3px);
  }
}

/* Navigation enhancement */
.nav {
  background: rgba(248, 245, 241, 0.9);
  backdrop-filter: blur(20px);
}

.logo {
  animation: logoSpin 20s linear infinite;
}

@keyframes logoSpin {
  from {
    background-position: 0deg;
  }

  to {
    background-position: 360deg;
  }
}

/* Decorative dots pattern */
.hero::after {
  content: "";
  position: absolute;
  top: 20%;
  right: 5%;
  width: 150px;
  height: 150px;
  background-image: radial-gradient(circle, rgba(255, 107, 90, 0.15) 2px, transparent 2px);
  background-size: 20px 20px;
  opacity: 0.5;
  pointer-events: none;
}

/* Typing cursor animation for demo */
.demo-panel li::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 4px;
  animation: blink 1s step-end infinite;
  opacity: 0;
}

.demo-panel.active li:last-child::after {
  opacity: 1;
}

@keyframes blink {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero::after {
    display: none;
  }

  .account-meta {
    grid-template-columns: 1fr;
  }

  .account-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .account-actions {
    justify-content: center;
  }
}

/* Coming Soon page styles */
.coming-soon-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 7vw;
  position: relative;
}

.coming-soon-main::before {
  content: "";
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 107, 90, 0.1), transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.coming-soon-content {
  text-align: center;
  max-width: 500px;
  position: relative;
  z-index: 1;
}

.coming-soon-content h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.coming-soon-content p {
  color: var(--ink-2);
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 28px;
}

.coming-soon-content .hero-badge {
  margin-bottom: 20px;
}

/* =============================================
   TASK WORKSPACE STYLES
   ============================================= */

.task-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--paper);
}

/* Task Sidebar */
.task-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--paper-2);
  border-right: 1px solid rgba(20, 19, 32, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.task-sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
}

.task-sidebar-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.task-project-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.task-project-loading,
.task-project-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  gap: 8px;
}

.task-project-loading svg {
  animation: spin 1s linear infinite;
}

.task-project-empty span {
  font-weight: 500;
  color: var(--ink-2);
}

.task-project-empty p {
  font-size: 0.85rem;
  margin: 0;
}

.task-project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 4px;
}

.task-project-item:hover {
  background: rgba(20, 19, 32, 0.04);
}

.task-project-item.active {
  background: var(--paper);
  box-shadow: 0 2px 8px rgba(20, 19, 32, 0.08);
}

.task-project-item .project-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-project-item .project-title {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-project-item .project-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.task-project-item .project-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-project-item:hover .project-actions {
  opacity: 1;
}

/* Task Main Area */
.task-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Task Toolbar */
.task-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--paper);
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
  flex-wrap: wrap;
}

.task-toolbar .toolbar-btn.primary {
  background: var(--accent);
  color: white;
}

.task-toolbar .toolbar-btn.primary:hover:not(:disabled) {
  background: #e55a4a;
}

.task-toolbar .toolbar-select {
  padding: 8px 12px;
  border: 1px solid rgba(20, 19, 32, 0.12);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
}

.task-toolbar .toolbar-select:focus {
  outline: none;
  border-color: var(--accent);
}

.task-toolbar .filter-group {
  display: flex;
  gap: 8px;
}

.task-toolbar .task-count {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Task Content Area */
.task-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}

/* Task Empty States */
.task-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-2);
  height: 100%;
}

.task-empty-state .empty-icon {
  color: var(--muted);
  margin-bottom: 20px;
  opacity: 0.5;
}

.task-empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.task-empty-state p {
  color: var(--muted);
  margin-bottom: 24px;
  max-width: 320px;
}

.task-empty-state .empty-actions {
  display: flex;
  gap: 12px;
}

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

/* Task Card */
.task-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid rgba(20, 19, 32, 0.08);
  border-radius: 12px;
  transition: all 0.15s ease;
}

.task-card:hover {
  border-color: rgba(20, 19, 32, 0.15);
  box-shadow: 0 4px 12px rgba(20, 19, 32, 0.06);
}

.task-card.completed {
  opacity: 0.65;
}

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

.task-checkbox {
  padding-top: 2px;
}

.task-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.task-title {
  font-weight: 500;
  color: var(--ink);
  flex: 1;
  word-break: break-word;
}

.task-description {
  font-size: 0.9rem;
  color: var(--ink-2);
  margin: 0 0 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
}

.task-status {
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.75rem;
}

.task-status.status-todo {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.task-status.status-in_progress {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.task-status.status-done {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.task-due {
  color: var(--muted);
}

.task-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.task-tag {
  padding: 2px 8px;
  background: rgba(20, 19, 32, 0.06);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--ink-2);
}

.task-ai-badge {
  padding: 2px 6px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.task-priority {
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.75rem;
  white-space: nowrap;
}

.task-priority.priority-high {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.task-priority.priority-medium {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.task-priority.priority-low {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

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

/* Button Icon */
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: rgba(20, 19, 32, 0.06);
  color: var(--ink);
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Upload Modal Styles */
.upload-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 2px dashed rgba(20, 19, 32, 0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-drop-zone:hover,
.upload-drop-zone.active {
  border-color: var(--accent);
  background: rgba(255, 107, 90, 0.03);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.drop-zone-content svg {
  opacity: 0.5;
}

.drop-zone-content p {
  margin: 0;
  color: var(--ink-2);
}

.drop-zone-hint {
  font-size: 0.85rem;
}

.upload-preview {
  padding: 16px;
  background: var(--paper-2);
  border-radius: 10px;
}

.upload-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-file-info svg {
  color: var(--accent);
}

.upload-file-info span {
  flex: 1;
  font-weight: 500;
  color: var(--ink);
}

.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.progress-bar {
  height: 6px;
  background: rgba(20, 19, 32, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
  animation: progress-indeterminate 1.5s infinite;
}

@keyframes progress-indeterminate {
  0% {
    width: 0%;
    margin-left: 0;
  }

  50% {
    width: 50%;
    margin-left: 25%;
  }

  100% {
    width: 0%;
    margin-left: 100%;
  }
}

/* Extraction Review Styles */
.extraction-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--muted);
}

.extraction-loading svg {
  animation: spin 1s linear infinite;
}

.extraction-summary {
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
}

.extracted-task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.extracted-task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--paper-2);
  border-radius: 10px;
  border: 1px solid rgba(20, 19, 32, 0.06);
}

.extracted-task-checkbox {
  padding-top: 2px;
}

.extracted-task-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.extracted-task-body {
  flex: 1;
  min-width: 0;
}

.extracted-task-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.extracted-task-title {
  font-weight: 500;
  color: var(--ink);
  flex: 1;
  word-break: break-word;
}

.extracted-task-description {
  font-size: 0.85rem;
  color: var(--ink-2);
  margin: 0 0 8px;
  line-height: 1.5;
}

.extracted-task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
}

.extraction-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.extraction-results {
  display: flex;
  flex-direction: column;
}

/* Modal Large */
.modal-large {
  width: min(700px, 90vw);
}

/* Text muted helper */
.text-muted {
  color: var(--muted);
  font-style: italic;
}

/* Form row for side-by-side fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Responsive Task Workspace */
@media (max-width: 768px) {
  .task-workspace {
    flex-direction: column;
  }

  .task-sidebar {
    width: 100%;
    min-width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid rgba(20, 19, 32, 0.08);
  }

  .task-toolbar {
    padding: 12px 16px;
    gap: 8px;
  }

  .task-toolbar .toolbar-btn span {
    display: none;
  }

  .task-content {
    padding: 16px;
  }

  .task-card {
    padding: 12px 14px;
  }

  .task-actions {
    opacity: 1;
  }

  .task-project-item .project-actions {
    opacity: 1;
  }
}

/* ==============================================
   ADDITIONAL DARK MODE OVERRIDES
   ============================================== */

/* Form hints */
[data-theme="dark"] .form-hint {
  color: var(--muted, #8a8698);
}

/* Mind Map Templates */
[data-theme="dark"] .templates-description {
  color: var(--muted, #8a8698);
}

[data-theme="dark"] .template-card {
  background: var(--paper-2, #1a1a24);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .template-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .template-card-title {
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .template-card-description {
  color: var(--muted, #8a8698);
}

/* Toast Notifications */
[data-theme="dark"] .toast {
  background: var(--paper-2, #1a1a24);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Mobile Navigation Panel */
[data-theme="dark"] .mobile-nav-panel {
  background: var(--paper, #121218);
}

[data-theme="dark"] .mobile-nav-panel .nav-cta {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* Feature icons dark mode */
[data-theme="dark"] .feature .icon {
  background: rgba(255, 107, 90, 0.1);
}

/* Plan cards */
[data-theme="dark"] .plan {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Quote cards */
[data-theme="dark"] .quote {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Form card and login form components */
[data-theme="dark"] .form-card {
  background: var(--paper-2, #1a1a24);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .form-card input {
  background: var(--paper, #121218);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .form-card input:focus {
  border-color: var(--accent, #ff6b5a);
  box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.2);
}

[data-theme="dark"] .form-tabs {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .form-tab {
  color: var(--muted, #8a8698);
}

[data-theme="dark"] .form-tab.active {
  background: var(--paper, #121218);
  color: var(--ink, #f0eff4);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .form-intro strong {
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .form-error {
  color: #f87171;
}

[data-theme="dark"] .password-strength .strength-bar {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .password-strength .strength-feedback {
  color: var(--muted, #9ca3af);
}

/* Dropdown menus */
[data-theme="dark"] .dropdown-menu {
  background: var(--paper-2, #1a1a24);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .dropdown-item {
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Deck history items */
[data-theme="dark"] .deck-history-item {
  background: var(--paper-2, #1a1a24);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .deck-history-item:hover {
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
  border-color: rgba(83, 198, 183, 0.45);
}

[data-theme="dark"] .deck-history-item.active {
  background: linear-gradient(135deg, rgba(255, 107, 90, 0.12), rgba(83, 198, 183, 0.12));
}

[data-theme="dark"] .deck-history-title {
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .deck-history-meta {
  color: var(--muted, #8a8698);
}

/* Account cards and panels */
[data-theme="dark"] .account-card {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .account-panel {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .panel-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Hero meta in dark mode — no background, just text */

/* CTA card - keep dark background in dark mode */
[data-theme="dark"] .cta-card {
  background: #1a1a24;
  color: #fff;
}

[data-theme="dark"] .cta-card::after {
  opacity: 0.7;
}

/* Demo tabs */
[data-theme="dark"] .demo-tab {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-2);
}

[data-theme="dark"] .demo-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .demo-tab.active {
  background: var(--theme-accent, #ff6b5a);
  color: #fff;
}

/* Step cards */
[data-theme="dark"] .step {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Workflow flow examples */
[data-theme="dark"] .flow-example {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .flow-output {
  background: rgba(83, 198, 183, 0.2);
}

[data-theme="dark"] .flow-output:nth-child(2) {
  background: rgba(247, 196, 76, 0.25);
}

[data-theme="dark"] .flow-output:nth-child(3) {
  background: rgba(124, 107, 176, 0.2);
}

/* Demo section */
[data-theme="dark"] .demo {
  background: var(--paper-2);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .demo-panel {
  background: var(--surface);
  border-color: var(--border-default);
}

/* Media queries for system dark mode preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-hint {
    color: var(--muted, #8a8698);
  }

  :root:not([data-theme="light"]) .templates-description {
    color: var(--muted, #8a8698);
  }

  :root:not([data-theme="light"]) .template-card {
    background: var(--paper-2, #1a1a24);
    border-color: rgba(255, 255, 255, 0.08);
  }

  :root:not([data-theme="light"]) .template-card:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  :root:not([data-theme="light"]) .template-card-title {
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .template-card-description {
    color: var(--muted, #8a8698);
  }

  :root:not([data-theme="light"]) .toast {
    background: var(--paper-2, #1a1a24);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.3);
  }

  :root:not([data-theme="light"]) .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .mobile-nav-panel {
    background: var(--paper, #121218);
  }

  :root:not([data-theme="light"]) .mobile-nav-panel .nav-cta {
    border-top-color: rgba(255, 255, 255, 0.08);
  }

  :root:not([data-theme="light"]) .feature .icon::after {
    background: var(--paper, #121218);
  }

  :root:not([data-theme="light"]) .plan {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .quote {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .form-card {
    background: var(--paper-2, #1a1a24);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
  }

  :root:not([data-theme="light"]) .form-card input {
    background: var(--paper, #121218);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .form-tabs {
    background: rgba(255, 255, 255, 0.06);
  }

  :root:not([data-theme="light"]) .form-tab.active {
    background: var(--paper, #121218);
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .form-intro strong {
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .dropdown-menu {
    background: var(--paper-2, #1a1a24);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }

  :root:not([data-theme="light"]) .dropdown-item {
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .deck-history-item {
    background: var(--paper-2, #1a1a24);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
  }

  :root:not([data-theme="light"]) .deck-history-title {
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .deck-history-meta {
    color: var(--muted, #8a8698);
  }

  :root:not([data-theme="light"]) .account-card {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .account-panel {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .panel-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  :root:not([data-theme="light"]) .hero-meta span {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
  }

  /* CTA card - keep dark background in dark mode */
  :root:not([data-theme="light"]) .cta-card {
    background: #1a1a24;
    color: #fff;
  }

  :root:not([data-theme="light"]) .cta-card::after {
    opacity: 0.7;
  }

  /* Demo tabs */
  :root:not([data-theme="light"]) .demo-tab {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink-2, #b8b5c4);
  }

  :root:not([data-theme="light"]) .demo-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.12);
  }

  :root:not([data-theme="light"]) .demo-tab.active {
    background: var(--theme-accent, #ff6b5a);
    color: #fff;
  }

  /* Step cards */
  :root:not([data-theme="light"]) .step {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }

  /* Workflow flow examples */
  :root:not([data-theme="light"]) .flow-example {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .flow-output {
    background: rgba(83, 198, 183, 0.2);
  }

  :root:not([data-theme="light"]) .flow-output:nth-child(2) {
    background: rgba(247, 196, 76, 0.25);
  }

  :root:not([data-theme="light"]) .flow-output:nth-child(3) {
    background: rgba(124, 107, 176, 0.2);
  }

  /* Demo section */
  :root:not([data-theme="light"]) .demo {
    background: var(--paper-2, #1a1a24);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  }

  :root:not([data-theme="light"]) .demo-panel {
    background: var(--surface, #1a1a24);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  }
}

/* ==============================================
   GLOBAL NAVIGATION COMPONENT
   ============================================== */

.global-nav-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.global-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Body padding when global nav is present */
body.has-global-nav {
  padding-top: 56px;
}

/* Brand */
.global-nav-brand {
  flex-shrink: 0;
}

.global-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink, #141320);
}

.global-nav-logo svg {
  color: var(--primary, #53c6b7);
}

.global-nav-logo-text {
  font-family: var(--font-brand, "Fraunces", serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Navigation Links */
.global-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.global-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--muted, #6a6778);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.global-nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.global-nav-link:hover {
  color: var(--ink, #141320);
  background: rgba(20, 19, 32, 0.04);
}

.global-nav-link.active {
  color: var(--primary-strong, #2c8a7d);
  background: var(--primary-soft, rgba(83, 198, 183, 0.12));
}

.global-nav-link.active svg {
  color: var(--primary-strong, #2c8a7d);
}

/* Actions */
.global-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.global-nav-theme-btn,
.global-nav-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #6a6778);
  cursor: pointer;
  transition: all 0.2s ease;
}

.global-nav-theme-btn:hover,
.global-nav-search-btn:hover {
  background: rgba(20, 19, 32, 0.06);
  color: var(--ink, #141320);
}

/* Theme icon toggle */
.global-nav-theme-btn .theme-icon-dark {
  display: none;
}

[data-theme="dark"] .global-nav-theme-btn .theme-icon-light {
  display: none;
}

[data-theme="dark"] .global-nav-theme-btn .theme-icon-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .global-nav-theme-btn .theme-icon-light {
    display: none;
  }

  :root:not([data-theme="light"]) .global-nav-theme-btn .theme-icon-dark {
    display: block;
  }
}

/* User section */
.global-nav-user {
  position: relative;
  display: none;
}

.global-nav-user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.global-nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #53c6b7), var(--primary-strong, #2c8a7d));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.global-nav-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 8px;
  background: var(--surface, #fff);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(20, 19, 32, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 100;
}

.global-nav-user-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.global-nav-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--ink, #141320);
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.global-nav-menu-item:hover {
  background: rgba(20, 19, 32, 0.04);
}

.global-nav-menu-item svg {
  width: 16px;
  height: 16px;
  color: var(--muted, #6a6778);
}

.global-nav-menu-divider {
  height: 1px;
  margin: 6px 0;
  background: rgba(20, 19, 32, 0.08);
}

/* Login button */
.global-nav-login-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--primary, #53c6b7);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.global-nav-login-btn:hover {
  background: var(--primary-strong, #2c8a7d);
}

.global-nav-login-btn svg {
  width: 16px;
  height: 16px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .global-nav-label {
    display: none;
  }

  .global-nav-link {
    padding: 10px;
  }

  .global-nav-logo-text {
    display: none;
  }

  .global-nav {
    padding: 0 12px;
    height: 52px;
  }

  body.has-global-nav {
    padding-top: 52px;
  }
}

@media (max-width: 480px) {
  .global-nav-links {
    gap: 2px;
  }

  .global-nav-link {
    padding: 8px;
  }
}

/* Dark mode */
[data-theme="dark"] .global-nav {
  background: rgba(26, 26, 36, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .global-nav-logo {
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .global-nav-link {
  color: var(--muted, #8a8698);
}

[data-theme="dark"] .global-nav-link:hover {
  color: var(--ink, #f0eff4);
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .global-nav-link.active {
  color: var(--primary-light, #6dd5c7);
  background: rgba(83, 198, 183, 0.15);
}

[data-theme="dark"] .global-nav-theme-btn,
[data-theme="dark"] .global-nav-search-btn {
  color: var(--muted, #8a8698);
}

[data-theme="dark"] .global-nav-theme-btn:hover,
[data-theme="dark"] .global-nav-search-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .global-nav-user-menu {
  background: var(--paper, #1a1a24);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .global-nav-menu-item {
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .global-nav-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .global-nav-menu-divider {
  background: rgba(255, 255, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .global-nav {
    background: rgba(26, 26, 36, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
  }

  :root:not([data-theme="light"]) .global-nav-logo {
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .global-nav-link {
    color: var(--muted, #8a8698);
  }

  :root:not([data-theme="light"]) .global-nav-link:hover {
    color: var(--ink, #f0eff4);
    background: rgba(255, 255, 255, 0.06);
  }

  :root:not([data-theme="light"]) .global-nav-link.active {
    color: var(--primary-light, #6dd5c7);
    background: rgba(83, 198, 183, 0.15);
  }

  :root:not([data-theme="light"]) .global-nav-theme-btn,
  :root:not([data-theme="light"]) .global-nav-search-btn {
    color: var(--muted, #8a8698);
  }

  :root:not([data-theme="light"]) .global-nav-theme-btn:hover,
  :root:not([data-theme="light"]) .global-nav-search-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .global-nav-user-menu {
    background: var(--paper, #1a1a24);
    border-color: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .global-nav-menu-item {
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .global-nav-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  :root:not([data-theme="light"]) .global-nav-menu-divider {
    background: rgba(255, 255, 255, 0.1);
  }
}

/* ==============================================
   GLOBAL SEARCH MODAL
   ============================================== */

.global-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.global-search-overlay.show {
  opacity: 1;
  visibility: visible;
}

.global-search-modal {
  width: 100%;
  max-width: 600px;
  margin: 0 16px;
  background: var(--surface, #fff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transform: translateY(-20px) scale(0.95);
  transition: transform 0.2s ease;
}

.global-search-overlay.show .global-search-modal {
  transform: translateY(0) scale(1);
}

/* Header */
.global-search-header {
  padding: 16px;
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
}

.global-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.global-search-icon {
  color: var(--muted, #6a6778);
  flex-shrink: 0;
}

.global-search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 1rem;
  color: var(--ink, #141320);
  outline: none;
}

.global-search-input::placeholder {
  color: var(--muted, #6a6778);
}

.global-search-kbd {
  padding: 4px 8px;
  background: rgba(20, 19, 32, 0.06);
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-body);
  color: var(--muted, #6a6778);
}

/* Body */
.global-search-body {
  max-height: 400px;
  overflow-y: auto;
}

.global-search-results {
  padding: 8px;
}

/* Groups */
.global-search-group {
  margin-bottom: 8px;
}

.global-search-group:last-child {
  margin-bottom: 0;
}

.global-search-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #6a6778);
}

.global-search-group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Results */
.global-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.global-search-result:hover,
.global-search-result.selected {
  background: rgba(20, 19, 32, 0.04);
}

.global-search-result.selected {
  background: var(--primary-soft, rgba(83, 198, 183, 0.12));
}

.global-search-result-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(20, 19, 32, 0.04);
  flex-shrink: 0;
}

.global-search-result-content {
  flex: 1;
  min-width: 0;
}

.global-search-result-title {
  font-weight: 500;
  color: var(--ink, #141320);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-result-subtitle {
  font-size: 0.8125rem;
  color: var(--muted, #6a6778);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-result-arrow {
  color: var(--muted, #6a6778);
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.global-search-result.selected .global-search-result-arrow {
  opacity: 1;
}

/* Empty & Loading states */
.global-search-empty,
.global-search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--muted, #6a6778);
}

.global-search-empty svg {
  opacity: 0.5;
}

/* Footer */
.global-search-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(20, 19, 32, 0.08);
  background: rgba(20, 19, 32, 0.02);
}

.global-search-hints {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--muted, #6a6778);
}

.global-search-hints kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: rgba(20, 19, 32, 0.08);
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-body);
  margin-right: 4px;
}

/* Dark mode */
[data-theme="dark"] .global-search-overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .global-search-modal {
  background: var(--paper, #1a1a24);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .global-search-header {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .global-search-input {
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .global-search-kbd {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .global-search-result:hover,
[data-theme="dark"] .global-search-result.selected {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .global-search-result.selected {
  background: rgba(83, 198, 183, 0.15);
}

[data-theme="dark"] .global-search-result-icon {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .global-search-result-title {
  color: var(--ink, #f0eff4);
}

[data-theme="dark"] .global-search-footer {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .global-search-hints kbd {
  background: rgba(255, 255, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .global-search-overlay {
    background: rgba(0, 0, 0, 0.7);
  }

  :root:not([data-theme="light"]) .global-search-modal {
    background: var(--paper, #1a1a24);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  }

  :root:not([data-theme="light"]) .global-search-header {
    border-color: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .global-search-input {
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .global-search-kbd {
    background: rgba(255, 255, 255, 0.1);
  }

  :root:not([data-theme="light"]) .global-search-result:hover,
  :root:not([data-theme="light"]) .global-search-result.selected {
    background: rgba(255, 255, 255, 0.06);
  }

  :root:not([data-theme="light"]) .global-search-result.selected {
    background: rgba(83, 198, 183, 0.15);
  }

  :root:not([data-theme="light"]) .global-search-result-icon {
    background: rgba(255, 255, 255, 0.08);
  }

  :root:not([data-theme="light"]) .global-search-result-title {
    color: var(--ink, #f0eff4);
  }

  :root:not([data-theme="light"]) .global-search-footer {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
  }

  :root:not([data-theme="light"]) .global-search-hints kbd {
    background: rgba(255, 255, 255, 0.1);
  }
}

/* Mobile responsive */
@media (max-width: 640px) {
  .global-search-overlay {
    padding-top: 10vh;
  }

  .global-search-modal {
    margin: 0 8px;
    border-radius: 12px;
  }

  .global-search-body {
    max-height: 50vh;
  }

  .global-search-hints {
    display: none;
  }
}

/* ==============================================
   ENHANCED LOGIN & USERINFO PAGE STYLING
   ============================================== */

/* Login Page Enhancements */
.form-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-purple), var(--accent));
  z-index: 0;
}

.form-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 10%, rgba(83, 198, 183, 0.08), transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(99, 102, 241, 0.06), transparent 50%);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

.form-card>* {
  position: relative;
  z-index: 1;
}

.form-card:hover {
  box-shadow: 0 24px 60px rgba(20, 19, 32, 0.15);
  transform: translateY(-2px);
}

/* Enhanced Form Inputs */
.form-card input:not([type="file"]) {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--surface);
  font-size: 0.95rem;
  color: var(--ink);
}

.form-card input:focus {
  border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(83, 198, 183, 0.15), 0 2px 8px rgba(83, 198, 183, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.form-card input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* Enhanced Form Tabs */
.form-tabs {
  border-radius: 14px;
  overflow: hidden;
}

.form-tab {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-tab::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-purple));
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-tab.active::before {
  transform: translateX(-50%) scaleX(1);
}

.form-tab:hover:not(.active) {
  background: rgba(20, 19, 32, 0.04);
  color: var(--ink);
}

/* Enhanced Password Strength Indicator */
.password-strength {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.strength-bar {
  background: rgba(20, 19, 32, 0.08);
  border-radius: 4px;
  overflow: hidden;
  height: 4px;
  margin-top: 8px;
}

.strength-fill {
  height: 100%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
  border-radius: 4px;
}

.strength-text {
  font-size: 0.8rem;
  margin-top: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.strength-feedback {
  list-style: none;
  padding: 8px 0 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.strength-feedback li {
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.strength-feedback li::before {
  content: "•";
  color: var(--accent-3);
  font-weight: bold;
}

/* Enhanced Modal Styling */
.modal-overlay {
  backdrop-filter: blur(8px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-card {
  position: relative;
  overflow: hidden;
  animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-purple));
}

/* Modal Actions Enhancement */
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-actions .btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-actions .btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

/* Enhanced Buttons */
.form-card .btn.primary {
  position: relative;
  overflow: hidden;
  background: var(--primary);
  color: white;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(83, 198, 183, 0.3);
}

.form-card .btn.primary::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.form-card .btn.primary:hover::before {
  width: 300px;
  height: 300px;
}

.form-card .btn.primary:hover {
  background: var(--primary-strong);
  box-shadow: 0 6px 20px rgba(83, 198, 183, 0.4);
  transform: translateY(-2px);
}

.form-card .btn.primary:active {
  transform: translateY(0);
}

/* Enhanced Form Intro */
.form-intro {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-intro strong {
  background: linear-gradient(135deg, var(--ink), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Password Toggle Enhancement */
.password-toggle {
  transition: all 0.2s ease;
  border-radius: 6px;
}

.password-toggle:hover {
  transform: scale(1.1);
}

/* Form Error/Status Messages */
.form-error,
.form-status {
  animation: slideIn 0.3s ease-out;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.form-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-error::before {
  content: "⚠";
  font-size: 1rem;
  flex-shrink: 0;
}

.form-status {
  background: rgba(83, 198, 183, 0.1);
  color: var(--primary);
  border: 1px solid rgba(83, 198, 183, 0.2);
}

.panel-status {
  animation: slideIn 0.3s ease-out;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.panel-status.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.panel-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Account Page Enhancements */
.account-section {
  animation: fadeInUp 0.8s ease-out;
}

.account-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: scaleIn 0.6s ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.account-card:hover {
  box-shadow: 0 24px 60px rgba(20, 19, 32, 0.14);
  transform: translateY(-2px);
}

/* Enhanced Avatar */
.account-avatar {
  position: relative;
  transition: all 0.3s ease;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 25px rgba(83, 198, 183, 0.25);
}

.account-avatar::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-purple), var(--accent));
  z-index: -1;
  animation: avatarPulse 3s ease-in-out infinite;
}

@keyframes avatarPulse {

  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.account-avatar:hover {
  transform: scale(1.05) rotate(3deg);
}

/* Enhanced Account Details */
.account-details strong {
  background: linear-gradient(135deg, var(--ink), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Enhanced Account Meta Cards */
.account-meta>div {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid rgba(20, 19, 32, 0.06);
  box-shadow: 0 2px 8px rgba(20, 19, 32, 0.04);
}

.account-meta>div::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-purple));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.account-meta>div:hover::before {
  transform: scaleX(1);
}

.account-meta>div:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(20, 19, 32, 0.08);
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.account-meta strong {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Enhanced Quota Bar */
.quota-bar {
  position: relative;
  background: rgba(20, 19, 32, 0.08);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 10px;
  box-shadow: inset 0 2px 4px rgba(20, 19, 32, 0.06);
}

.quota-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-purple));
  border-radius: 8px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.quota-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.3),
      transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.quota-warning {
  font-size: 0.75rem;
  color: var(--warning);
  margin-top: 6px;
  font-weight: 600;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* Enhanced Account Panel */
.account-panel {
  position: relative;
  overflow: hidden;
  animation: slideInRight 0.6s ease-out 0.2s both;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.account-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-purple), var(--accent));
}

/* Enhanced Panel Header */
.panel-header {
  border-bottom: 1px solid rgba(20, 19, 32, 0.08);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.panel-header strong {
  background: linear-gradient(135deg, var(--ink), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Enhanced Form Fields */
.form-field input:not([type="file"]) {
  transition: all 0.3s ease;
}

.form-field input:focus {
  border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(83, 198, 183, 0.15);
  transform: translateY(-1px);
}

/* Enhanced Avatar Uploader */
.avatar-uploader button {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.avatar-uploader button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(83, 198, 183, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.avatar-uploader button:hover::before {
  width: 300px;
  height: 300px;
}

.avatar-uploader button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(20, 19, 32, 0.15);
}

/* Enhanced Upload Progress */
.upload-progress-bar {
  background: rgba(20, 19, 32, 0.08);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(20, 19, 32, 0.06);
}

.upload-progress-fill {
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(83, 198, 183, 0.5);
}

.upload-progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.4),
      transparent);
  animation: shimmer 1.5s infinite;
}

/* Enhanced Account Actions */
.account-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.account-actions .btn {
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-actions .btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

.account-actions .btn:hover {
  transform: translateY(-2px);
}

/* Form Actions Enhancement */
.form-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.form-actions .btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

/* Enhanced Avatar Crop Modal */
.avatar-crop-card {
  max-width: 500px;
}

.avatar-cropper {
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(20, 19, 32, 0.08);
  background: rgba(20, 19, 32, 0.02);
  margin: 16px 0;
  box-shadow: inset 0 2px 8px rgba(20, 19, 32, 0.06);
}

.avatar-cropper canvas {
  display: block;
  cursor: move;
  border-radius: 10px;
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.crop-zoom span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  min-width: 50px;
}

.crop-zoom input[type="range"] {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(20, 19, 32, 0.08);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.crop-zoom input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-3);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(83, 198, 183, 0.4);
  transition: all 0.2s ease;
}

.crop-zoom input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(83, 198, 183, 0.6);
}

.crop-zoom input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-3);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(83, 198, 183, 0.4);
  transition: all 0.2s ease;
}

.crop-zoom input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(83, 198, 183, 0.6);
}

/* Page Header Enhancements */
.page-header {
  animation: fadeInDown 0.8s ease-out;
  position: relative;
  z-index: 1;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header h1 {
  background: linear-gradient(135deg, var(--ink), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Decorative background pattern for login/account pages */
.page::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(83, 198, 183, 0.08), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.08), transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 107, 90, 0.05), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.page>* {
  position: relative;
  z-index: 1;
}

.hero-badge {
  position: relative;
  display: inline-block;
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }

  50% {
    opacity: 1;
    transform: scale(1.05);
  }

  70% {
    transform: scale(0.9);
  }

  100% {
    transform: scale(1);
  }
}

/* Dark Mode Adjustments */
[data-theme="dark"] .form-card {
  background: rgba(30, 30, 40, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .form-card::after {
  background: radial-gradient(circle at 20% 10%, rgba(83, 198, 183, 0.12), transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(99, 102, 241, 0.1), transparent 50%);
}

[data-theme="dark"] .account-card,
[data-theme="dark"] .account-panel {
  background: rgba(30, 30, 40, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .account-meta>div {
  background: rgba(20, 19, 32, 0.5);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .quota-bar {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .avatar-cropper {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .form-card {
    padding: 24px;
    margin: 0 16px;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .page-header p {
    font-size: 0.9rem;
  }

  .account-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .account-card {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 16px;
  }

  .account-actions {
    justify-content: center;
    width: 100%;
  }

  .account-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .account-meta {
    grid-template-columns: 1fr;
  }

  .account-meta strong {
    font-size: 1.2rem;
  }

  .modal-card {
    margin: 20px;
    padding: 24px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .form-actions .btn {
    width: 100%;
  }

  .avatar-uploader {
    flex-direction: column;
    align-items: stretch;
  }

  .avatar-uploader button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .form-card {
    padding: 20px;
  }

  .page-header {
    padding: 32px 16px;
  }

  .page-header h1 {
    font-size: 1.75rem;
  }

  .account-section {
    padding: 16px;
  }

  .account-card,
  .account-panel {
    padding: 20px;
  }

  .account-avatar {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }

  .account-details strong {
    font-size: 1rem;
  }

  .account-meta strong {
    font-size: 1.1rem;
  }
}

/* ==============================================
   BUTTON ENHANCEMENTS & LOADING STATES
   ============================================== */

/* Enhanced form buttons with icon support */
.form-card .btn.primary {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.form-card .btn.primary svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
  flex-shrink: 0;
}

.form-card .btn.primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.form-card .btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
}

/* Button Spinner Animation */
.btn-spinner {
  animation: btnSpin 1s linear infinite;
}

@keyframes btnSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Ensure z-index for button ripple effect */
.form-card .btn.primary>* {
  position: relative;
  z-index: 1;
}

.form-card .btn.primary::before {
  z-index: 0;
}

/* Modal button enhancements */
.modal-actions .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-actions .btn.loading {
  pointer-events: none;
}

/* Secondary button enhancements */
.form-card .btn.secondary,
.modal-actions .btn.secondary,
.account-actions .btn.secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.form-card .btn.secondary:hover,
.modal-actions .btn.secondary:hover,
.account-actions .btn.secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(20, 19, 32, 0.12);
}

/* ==============================================
   PAGE HEADER BADGE & VISUAL POLISH
   ============================================== */

.page-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(83, 198, 183, 0.1);
  border: 1px solid rgba(83, 198, 183, 0.2);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 20px;
  animation: badgeFloat 3s ease-in-out infinite;
}

.page-header-badge svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.5;
}

@keyframes badgeFloat {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-4px);
  }
}

[data-theme="dark"] .page-header-badge {
  background: rgba(83, 198, 183, 0.15);
  border-color: rgba(83, 198, 183, 0.3);
}

/* Enhanced input styling */
.form-card input:not([type="file"]) {
  position: relative;
}

.form-card input:not([type="file"]):focus::placeholder {
  opacity: 0.4;
  transform: translateX(4px);
  transition: all 0.3s ease;
}

/* Enhanced label styling */
.form-card label {
  font-weight: 600;
  color: var(--ink-2);
  font-size: 0.875rem;
  letter-spacing: 0.2px;
}

/* Form field spacing */
.form-card>div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Improved hint text */
.form-card .hint {
  text-align: center;
  padding-top: 8px;
}

.form-card .hint a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

.form-card .hint a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.form-card .hint a:hover::after {
  transform: scaleX(1);
}

/* Enhanced forgot password link */
.forgot-password-link {
  position: relative;
  font-weight: 500;
}

.forgot-password-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--muted);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.forgot-password-link:hover::after {
  transform: scaleX(1);
}

/* Account details improvement */
.account-details span {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Improved account panel spacing */
.account-panel .panel-header {
  margin-bottom: 24px;
}

.account-panel .panel-header>div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Form field visual improvements */
.form-field span {
  font-weight: 600;
  color: var(--ink-2);
  font-size: 0.875rem;
  letter-spacing: 0.2px;
}

/* Meta label improvements */
.meta-label {
  opacity: 0.8;
}

/* Improved CTA section spacing */
.section {
  padding: 40px 24px;
}

/* ==============================================
   DARK MODE ENHANCEMENTS
   ============================================== */

[data-theme="dark"] .page-header-badge {
  background: rgba(83, 198, 183, 0.15);
  border-color: rgba(83, 198, 183, 0.3);
  color: var(--primary-light);
}

[data-theme="dark"] .form-card label,
[data-theme="dark"] .form-field span {
  color: var(--ink-2);
}

[data-theme="dark"] .form-card .hint a {
  color: var(--primary-light);
}

[data-theme="dark"] .form-card .hint a::after {
  background: var(--primary-light);
}

[data-theme="dark"] .forgot-password-link {
  color: var(--ink-2);
}

[data-theme="dark"] .forgot-password-link:hover {
  color: var(--primary-light);
}

[data-theme="dark"] .forgot-password-link::after {
  background: var(--primary-light);
}

[data-theme="dark"] .form-error::before {
  filter: brightness(1.2);
}

[data-theme="dark"] .password-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

[data-theme="dark"] .upload-progress-bar {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .strength-bar {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .page::before {
  background:
    radial-gradient(circle at 10% 20%, rgba(83, 198, 183, 0.12), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.12), transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 107, 90, 0.08), transparent 50%);
}

[data-theme="dark"] .account-details span {
  opacity: 0.8;
}

[data-theme="dark"] .avatar-hint {
  color: var(--muted);
}

[data-theme="dark"] .panel-status {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced dark mode form inputs */
[data-theme="dark"] .form-card input:not([type="file"]):focus {
  background: var(--paper);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(83, 198, 183, 0.2);
}

[data-theme="dark"] .form-field input:not([type="file"]):focus {
  background: var(--paper);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(83, 198, 183, 0.2);
}

/* ==============================================
   KEYBOARD SHORTCUT HINT
   ============================================== */

.shortcut-hint {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(20, 19, 32, 0.1);
  font-size: 0.85rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.shortcut-hint:hover {
  opacity: 1;
}

.shortcut-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  background: rgba(20, 19, 32, 0.06);
  border: 1px solid rgba(20, 19, 32, 0.12);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(20, 19, 32, 0.05);
  margin: 0 2px;
}

[data-theme="dark"] .shortcut-hint {
  border-left-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .shortcut-hint kbd {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Responsive - hide shortcut hint on very small screens */
@media (max-width: 480px) {
  .shortcut-hint {
    display: none;
  }
}

/* ==============================================
   EXPORT LOADING OVERLAY
   ============================================== */

.export-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(83, 198, 183, 0.95) 0%, rgba(51, 102, 204, 0.95) 100%);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.export-loading-overlay.show {
  display: flex;
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.export-loading-content {
  text-align: center;
  color: white;
  max-width: 500px;
  padding: 40px;
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.export-loading-icon {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
}

.export-icon-animated {
  animation: pulse 2s ease-in-out infinite, rotate 3s linear infinite;
  filter: drop-shadow(0 4px 20px rgba(255, 255, 255, 0.5));
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.export-loading-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 12px;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.export-loading-message {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 40px;
}

/* Progress Steps */
.export-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
  text-align: left;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.progress-step.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.02);
}

.progress-step.completed {
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.2);
}

.step-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon svg {
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.progress-step.completed .step-icon svg {
  opacity: 1;
  transform: scale(1);
}

.step-spinner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  opacity: 0;
  animation: spinStep 0.8s linear infinite;
}

.progress-step.active .step-spinner {
  opacity: 1;
}

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

.step-label {
  font-size: 15px;
  font-weight: 500;
  color: white;
  flex: 1;
}

/* Progress Bar */
.export-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.export-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), white);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .export-loading-content {
    padding: 30px 20px;
    max-width: 90%;
  }

  .export-loading-title {
    font-size: 22px;
  }

  .export-loading-message {
    font-size: 14px;
    margin-bottom: 30px;
  }

  .export-icon-animated {
    width: 60px;
    height: 60px;
  }

  .progress-step {
    padding: 10px 15px;
  }

  .step-label {
    font-size: 14px;
  }
}

/* ==============================================
   FORM LABEL HINT ICON
   ============================================== */

.label-hint {
  display: inline-block;
  margin-left: 4px;
  font-size: 12px;
  opacity: 0.6;
  cursor: help;
  transition: opacity 0.2s ease;
}

.label-hint:hover {
  opacity: 1;
}

/* ==========================================
   Task Content Tabs Styles
   ========================================== */

.content-tabs {
  display: none;
  gap: 8px;
  padding: 0 20px;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 0;
}

.content-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.content-tab:hover {
  color: var(--task-accent, #53c6b7);
  background: rgba(83, 198, 183, 0.05);
  border-radius: 8px 8px 0 0;
}

.content-tab.active {
  color: var(--task-accent, #53c6b7);
  border-bottom-color: var(--task-accent, #53c6b7);
}

.content-tab svg {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.content-tab.active svg {
  opacity: 1;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
}

.content-tab.active .tab-badge {
  background: var(--task-accent, #53c6b7);
  color: white;
}

/* ==========================================
   Files List Styles
   ========================================== */

.files-list {
  padding: 20px 0;
}

.files-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.files-content {
  display: block;
}

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

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  transition: all 0.2s ease;
  cursor: default;
}

.file-card:hover {
  border-color: var(--task-accent, #53c6b7);
  box-shadow: 0 2px 8px rgba(83, 198, 183, 0.15);
}

.file-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(83, 198, 183, 0.1) 0%, rgba(83, 198, 183, 0.05) 100%);
  border-radius: 10px;
  color: var(--task-accent, #53c6b7);
}

.file-icon svg {
  width: 28px;
  height: 28px;
}

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

.file-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 12px;
  color: #999;
}

.file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.file-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-action-btn:hover {
  background: rgba(83, 198, 183, 0.1);
  border-color: var(--task-accent, #53c6b7);
  color: var(--task-accent, #53c6b7);
}

.file-action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.file-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .content-tabs {
    padding: 0 16px;
  }

  .files-grid {
    grid-template-columns: 1fr;
  }

  .file-card {
    padding: 12px;
  }
}

/* ==========================================
   REVEAL ANIMATIONS
   ========================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal.delay {
  transition-delay: 0.2s;
}

.reveal.delay-2 {
  transition-delay: 0.4s;
}

/* ==========================================
   GLASSMORPHISM & GRADIENTS
   ========================================== */
.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
}

[data-theme="dark"] .glass-panel {
  background: rgba(26, 26, 36, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.text-gradient-purple {
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}