:root {
  /* Primitive Color Tokens */
  --color-white: rgba(255, 255, 255, 1);
  --color-black: rgba(0, 0, 0, 1);
  --color-cream-50: rgba(252, 252, 249, 1);
  --color-cream-100: rgba(255, 255, 253, 1);
  --color-gray-200: rgba(245, 245, 245, 1);
  --color-gray-300: rgba(167, 169, 169, 1);
  --color-gray-400: rgba(119, 124, 124, 1);
  --color-slate-500: rgba(98, 108, 113, 1);
  --color-brown-600: rgba(94, 82, 64, 1);
  --color-charcoal-700: rgba(31, 33, 33, 1);
  --color-charcoal-800: rgba(38, 40, 40, 1);
  --color-slate-900: rgba(19, 52, 59, 1);
  --color-teal-300: rgba(50, 184, 198, 1);
  --color-teal-400: rgba(45, 166, 178, 1);
  --color-teal-500: rgba(33, 128, 141, 1);
  --color-teal-600: rgba(29, 116, 128, 1);
  --color-teal-700: rgba(26, 104, 115, 1);
  --color-teal-800: rgba(41, 150, 161, 1);
  --color-red-400: rgba(255, 84, 89, 1);
  --color-red-500: rgba(192, 21, 47, 1);
  --color-orange-400: rgba(230, 129, 97, 1);
  --color-orange-500: rgba(168, 75, 47, 1);

  /* RGB versions for opacity control */
  --color-brown-600-rgb: 94, 82, 64;
  --color-teal-500-rgb: 33, 128, 141;
  --color-slate-900-rgb: 19, 52, 59;
  --color-slate-500-rgb: 98, 108, 113;
  --color-red-500-rgb: 192, 21, 47;
  --color-red-400-rgb: 255, 84, 89;
  --color-orange-500-rgb: 168, 75, 47;
  --color-orange-400-rgb: 230, 129, 97;

  /* Background color tokens (Light Mode) */
  --color-bg-1: rgba(59, 130, 246, 0.08);
  /* Light blue */
  --color-bg-2: rgba(245, 158, 11, 0.08);
  /* Light yellow */
  --color-bg-3: rgba(34, 197, 94, 0.08);
  /* Light green */
  --color-bg-4: rgba(239, 68, 68, 0.08);
  /* Light red */
  --color-bg-5: rgba(147, 51, 234, 0.08);
  /* Light purple */
  --color-bg-6: rgba(249, 115, 22, 0.08);
  /* Light orange */
  --color-bg-7: rgba(236, 72, 153, 0.08);
  /* Light pink */
  --color-bg-8: rgba(6, 182, 212, 0.08);
  /* Light cyan */

  /* Semantic Color Tokens (Light Mode) */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-slate-900);
  --color-text-secondary: var(--color-slate-500);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-primary-active: var(--color-teal-700);
  --color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
  --color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
  --color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
  --color-border: rgba(var(--color-brown-600-rgb), 0.2);
  --color-btn-primary-text: var(--color-cream-50);
  --color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
  --color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
  --color-error: var(--color-red-500);
  --color-success: var(--color-teal-500);
  --color-warning: var(--color-orange-500);
  --color-info: var(--color-slate-500);
  --color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);
  --color-select-caret: rgba(var(--color-slate-900-rgb), 0.8);

  /* Common style patterns */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: 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='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: 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='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* RGB versions for opacity control */
  --color-success-rgb: 33, 128, 141;
  --color-error-rgb: 192, 21, 47;
  --color-warning-rgb: 168, 75, 47;
  --color-info-rgb: 98, 108, 113;

  /* Typography */
  --font-family-base: "Plus Jakarta Sans", "Inter", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo,
    Monaco, Consolas, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 30px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 550;
  --font-weight-bold: 600;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --letter-spacing-tight: -0.01em;

  /* Spacing */
  --space-0: 0;
  --space-1: 1px;
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-base: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04),
    0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04),
    0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.03);

  /* Animation */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
}

/* Dark mode colors */
[data-theme="dark"] {
  --glass-bg: rgba(0, 0, 0, 0.3);
  --glass-border: rgba(255, 255, 255, 0.1);

  /* RGB versions for opacity control (Dark Mode) */
  --color-gray-400-rgb: 119, 124, 124;
  --color-teal-300-rgb: 50, 184, 198;
  --color-gray-300-rgb: 167, 169, 169;
  --color-gray-200-rgb: 245, 245, 245;

  /* Background color tokens (Dark Mode) */
  --color-bg-1: rgba(59, 130, 246, 0.10);
  /* Dark blue */
  --color-bg-2: rgba(245, 158, 11, 0.10);
  /* Dark yellow */
  --color-bg-3: rgba(34, 197, 94, 0.10);
  /* Dark green */
  --color-bg-4: rgba(239, 68, 68, 0.10);
  /* Dark red */
  --color-bg-5: rgba(147, 51, 234, 0.10);
  /* Dark purple */
  --color-bg-6: rgba(249, 115, 22, 0.10);
  /* Dark orange */
  --color-bg-7: rgba(236, 72, 153, 0.10);
  /* Dark pink */
  --color-bg-8: rgba(6, 182, 212, 0.10);
  /* Dark cyan */

  /* Semantic Color Tokens (Dark Mode) */
  --color-background: #17171a;
  --color-surface: #1e2630;
  --color-text: #ffffff;
  --color-text-secondary: #e0e0e0;
  --color-primary: #12c0a8;
  --color-primary-hover: var(--color-teal-400);
  --color-primary-active: var(--color-teal-800);
  --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
  --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
  --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
  --color-border: rgba(var(--color-gray-400-rgb), 0.3);
  --color-error: var(--color-red-400);
  --color-success: var(--color-teal-300);
  --color-warning: var(--color-orange-400);
  --color-info: var(--color-gray-300);
  --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
  --color-btn-primary-text: var(--color-slate-900);
  --color-card-border: rgba(var(--color-gray-400-rgb), 0.2);
  --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  --button-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
  --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
  --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

  /* Common style patterns - updated for dark mode */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* RGB versions for opacity control (Dark Mode) */
    --color-gray-400-rgb: 119, 124, 124;
    --color-teal-300-rgb: 50, 184, 198;
    --color-gray-300-rgb: 167, 169, 169;
    --color-gray-200-rgb: 245, 245, 245;

    /* Background color tokens (Dark Mode) */
    --color-bg-1: rgba(59, 130, 246, 0.10);
    /* Dark blue */
    --color-bg-2: rgba(245, 158, 11, 0.10);
    /* Dark yellow */
    --color-bg-3: rgba(34, 197, 94, 0.10);
    /* Dark green */
    --color-bg-4: rgba(239, 68, 68, 0.10);
    /* Dark red */
    --color-bg-5: rgba(147, 51, 234, 0.10);
    /* Dark purple */
    --color-bg-6: rgba(249, 115, 22, 0.10);
    /* Dark orange */
    --color-bg-7: rgba(236, 72, 153, 0.10);
    /* Dark pink */
    --color-bg-8: rgba(6, 182, 212, 0.10);
    /* Dark cyan */

    /* Semantic Color Tokens (Dark Mode) */
    --color-background: #17171a;
    --color-surface: #1e2630;
    --color-text: #ffffff;
    --color-text-secondary: #e0e0e0;
    --color-primary: #12c0a8;
    --color-primary-hover: var(--color-teal-400);
    --color-primary-active: var(--color-teal-800);
    --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
    --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
    --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
    --color-border: rgba(var(--color-gray-400-rgb), 0.3);
    --color-error: var(--color-red-400);
    --color-success: var(--color-teal-300);
    --color-warning: var(--color-orange-400);
    --color-info: var(--color-gray-300);
    --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
    --color-btn-primary-text: var(--color-slate-900);
    --color-card-border: rgba(var(--color-gray-400-rgb), 0.2);
    --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
    --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 -1px 0 rgba(0, 0, 0, 0.15);
    --button-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
    --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
    --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

    /* Common style patterns - updated for dark mode */
    --focus-ring: 0 0 0 3px var(--color-focus-ring);
    --focus-outline: 2px solid var(--color-primary);
    --status-bg-opacity: 0.15;
    --status-border-opacity: 0.25;
    --select-caret-light: 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='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --select-caret-dark: 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='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

    /* RGB versions for dark mode */
    --color-success-rgb: var(--color-teal-300-rgb);
    --color-error-rgb: var(--color-red-400-rgb);
    --color-warning-rgb: var(--color-orange-400-rgb);
    --color-info-rgb: var(--color-gray-300-rgb);
  }
}

/* Data attribute for manual theme switching */
[data-theme="dark"],
[data-color-scheme="dark"] {
  --glass-bg: rgba(0, 0, 0, 0.3);
  --glass-border: rgba(255, 255, 255, 0.1);

  /* RGB versions for opacity control (dark mode) */
  --color-gray-400-rgb: 119, 124, 124;
  --color-teal-300-rgb: 50, 184, 198;
  --color-gray-300-rgb: 167, 169, 169;
  --color-gray-200-rgb: 245, 245, 245;

  /* Colorful background palette - Dark Mode */
  --color-bg-1: rgba(59, 130, 246, 0.10);
  /* Dark blue */
  --color-bg-2: rgba(245, 158, 11, 0.10);
  /* Dark yellow */
  --color-bg-3: rgba(34, 197, 94, 0.10);
  /* Dark green */
  --color-bg-4: rgba(239, 68, 68, 0.10);
  /* Dark red */
  --color-bg-5: rgba(147, 51, 234, 0.10);
  /* Dark purple */
  --color-bg-6: rgba(249, 115, 22, 0.10);
  /* Dark orange */
  --color-bg-7: rgba(236, 72, 153, 0.10);
  /* Dark pink */
  --color-bg-8: rgba(6, 182, 212, 0.10);
  /* Dark cyan */

  /* Semantic Color Tokens (Dark Mode) */
  --color-background: #17171a;
  --color-surface: #1e2630;
  --color-text: #ffffff;
  --color-text-secondary: #e0e0e0;
  --color-primary: #12c0a8;
  --color-primary-hover: var(--color-teal-400);
  --color-primary-active: var(--color-teal-800);
  --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
  --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
  --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
  --color-border: rgba(var(--color-gray-400-rgb), 0.3);
  --color-error: var(--color-red-400);
  --color-success: var(--color-teal-300);
  --color-warning: var(--color-orange-400);
  --color-info: var(--color-gray-300);
  --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
  --color-btn-primary-text: var(--color-slate-900);
  --color-card-border: rgba(var(--color-gray-400-rgb), 0.15);
  --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
  --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

  /* Common style patterns - updated for dark mode */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: 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='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: 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='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* RGB versions for dark mode */
  --color-success-rgb: var(--color-teal-300-rgb);
  --color-error-rgb: var(--color-red-400-rgb);
  --color-warning-rgb: var(--color-orange-400-rgb);
  --color-info-rgb: var(--color-gray-300-rgb);
}

[data-color-scheme="light"] {
  /* RGB versions for opacity control (light mode) */
  --color-brown-600-rgb: 94, 82, 64;
  --color-teal-500-rgb: 33, 128, 141;
  --color-slate-900-rgb: 19, 52, 59;

  /* Semantic Color Tokens (Light Mode) */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-slate-900);
  --color-text-secondary: var(--color-slate-500);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-primary-active: var(--color-teal-700);
  --color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
  --color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
  --color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
  --color-border: rgba(var(--color-brown-600-rgb), 0.2);
  --color-btn-primary-text: var(--color-cream-50);
  --color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
  --color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
  --color-error: var(--color-red-500);
  --color-success: var(--color-teal-500);
  --color-warning: var(--color-orange-500);
  --color-info: var(--color-slate-500);
  --color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);

  /* RGB versions for light mode */
  --color-success-rgb: var(--color-teal-500-rgb);
  --color-error-rgb: var(--color-red-500-rgb);
  --color-warning-rgb: var(--color-orange-500-rgb);
  --color-info-rgb: var(--color-slate-500-rgb);
}

/* Base styles */
html {
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-tight);
}

h1 {
  font-size: var(--font-size-4xl);
}

h2 {
  font-size: var(--font-size-3xl);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-md);
}

p {
  margin: 0 0 var(--space-16) 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

a:hover {
  color: var(--color-primary-hover);
}

code,
pre {
  font-family: var(--font-family-mono);
  font-size: calc(var(--font-size-base) * 0.95);
  background-color: var(--color-secondary);
  border-radius: var(--radius-sm);
}

code {
  padding: var(--space-1) var(--space-4);
}

pre {
  padding: var(--space-16);
  margin: var(--space-16) 0;
  overflow: auto;
  border: 1px solid var(--color-border);
}

pre code {
  background: none;
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-base);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  border: none;
  text-decoration: none;
  position: relative;
}

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

.btn--primary {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--primary:active {
  background: var(--color-primary-active);
}

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

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

.btn--secondary:active {
  background: var(--color-secondary-active);
}

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

.btn--outline:hover {
  background: var(--color-secondary);
}

.btn--sm {
  padding: var(--space-4) var(--space-12);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--space-10) var(--space-20);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-md);
}

.btn--full-width {
  width: 100%;
}

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

/* Form elements */
.form-control {
  display: block;
  width: 100%;
  padding: var(--space-8) var(--space-12);
  font-size: var(--font-size-md);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  transition: border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

textarea.form-control {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
}

select.form-control {
  padding: var(--space-8) var(--space-12);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: var(--select-caret-light);
  background-repeat: no-repeat;
  background-position: right var(--space-12) center;
  background-size: 16px;
  padding-right: var(--space-32);
}

/* Add a dark mode specific caret */
@media (prefers-color-scheme: dark) {
  select.form-control {
    background-image: var(--select-caret-dark);
  }
}

/* Also handle data-color-scheme */
[data-color-scheme="dark"] select.form-control {
  background-image: var(--select-caret-dark);
}

[data-color-scheme="light"] select.form-control {
  background-image: var(--select-caret-light);
}

.form-control:focus {
  border-color: var(--color-primary);
  outline: var(--focus-outline);
}

/* Dark mode form control enhancements */
@media (prefers-color-scheme: dark) {

  .form-control,
  input.form-control,
  textarea.form-control,
  select.form-control {
    color: var(--color-gray-200);
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
  }

  .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
  }

  .form-control:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--color-teal-300);
  }
}

[data-color-scheme="dark"] .form-control,
[data-color-scheme="dark"] input.form-control,
[data-color-scheme="dark"] textarea.form-control,
[data-color-scheme="dark"] select.form-control {
  color: var(--color-gray-200);
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-color-scheme="dark"] .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

[data-color-scheme="dark"] .form-control:focus {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--color-teal-300);
}

.form-label {
  display: block;
  margin-bottom: var(--space-8);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.form-group {
  margin-bottom: var(--space-16);
}

/* Card component */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-standard);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__body {
  padding: var(--space-16);
}

.card__header,
.card__footer {
  padding: var(--space-16);
  border-bottom: 1px solid var(--color-card-border-inner);
}

/* Status indicators - simplified with CSS variables */
.status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-6) var(--space-12);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.status--success {
  background-color: rgba(var(--color-success-rgb, 33, 128, 141),
      var(--status-bg-opacity));
  color: var(--color-success);
  border: 1px solid rgba(var(--color-success-rgb, 33, 128, 141), var(--status-border-opacity));
}

.status--error {
  background-color: rgba(var(--color-error-rgb, 192, 21, 47),
      var(--status-bg-opacity));
  color: var(--color-error);
  border: 1px solid rgba(var(--color-error-rgb, 192, 21, 47), var(--status-border-opacity));
}

.status--warning {
  background-color: rgba(var(--color-warning-rgb, 168, 75, 47),
      var(--status-bg-opacity));
  color: var(--color-warning);
  border: 1px solid rgba(var(--color-warning-rgb, 168, 75, 47), var(--status-border-opacity));
}

.status--info {
  background-color: rgba(var(--color-info-rgb, 98, 108, 113),
      var(--status-bg-opacity));
  color: var(--color-info);
  border: 1px solid rgba(var(--color-info-rgb, 98, 108, 113), var(--status-border-opacity));
}

/* Container layout */
.container {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--space-16);
  padding-left: var(--space-16);
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
  }
}

@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

/* Utility classes */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

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

.justify-between {
  justify-content: space-between;
}

.gap-4 {
  gap: var(--space-4);
}

.gap-8 {
  gap: var(--space-8);
}

.gap-16 {
  gap: var(--space-16);
}

.m-0 {
  margin: 0;
}

.mt-8 {
  margin-top: var(--space-8);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.mx-8 {
  margin-left: var(--space-8);
  margin-right: var(--space-8);
}

.my-8 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-8);
}

.p-0 {
  padding: 0;
}

.py-8 {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

.px-8 {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

.py-16 {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

.px-16 {
  padding-left: var(--space-16);
  padding-right: var(--space-16);
}

.block {
  display: block;
}

.hidden {
  display: none;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Dark mode specifics */
[data-color-scheme="dark"] .btn--outline {
  border: 1px solid var(--color-border-secondary);
}

@font-face {
  font-family: 'FKGroteskNeue';
  src: url('https://r2cdn.perplexity.ai/fonts/FKGroteskNeue.woff2') format('woff2');
}

/* END PERPLEXITY DESIGN SYSTEM */
/* Voice-Enabled Email System Styles */

/* Custom properties for the application */
:root {
  --glass-bg: #ffffff;
  --glass-border: #e2e8f0;
  --glass-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --voice-active: #10b981;
  --voice-listening: #f59e0b;
  --voice-processing: #3b82f6;
  --priority-high: #ef4444;
  --priority-medium: #f97316;
  --priority-low: #64748b;
}

[data-theme="dark"],
[data-color-scheme="dark"] {
  --glass-bg: #1e293b;
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 20px rgba(20, 184, 166, 0.08);
}

/* Body and base styles */
body {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  background-attachment: fixed;
  min-height: 100vh;
  font-family: var(--font-family-base);
  color: #0f172a;
}

[data-theme="dark"] body,
[data-color-scheme="dark"] body {
  background: linear-gradient(135deg, #090d16 0%, #0f172a 50%, #171d2c 100%) !important;
  background-attachment: fixed;
  color: #ffffff !important;
}

/* ============================================
   HIGH CONTRAST MODE - Clean Implementation
   ============================================ */

/* High contrast mode - update CSS variables only */
[data-high-contrast="true"] {
  --glass-bg: var(--color-background);
  --glass-border: var(--color-border);
  --glass-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Dark theme + High contrast: Override variables for better contrast */
[data-theme="dark"][data-high-contrast="true"],
[data-color-scheme="dark"][data-high-contrast="true"] {
  --color-background: #000000;
  --color-surface: #000000;
  --color-text: #ffffff;
  --color-text-secondary: #ffffff;
  --color-border: #ffff00;
  --color-primary: #ffff00;
  --color-primary-hover: #e6e600;
  --color-card-border: #ffff00;
  --color-gray-200: #ffffff;
  --color-gray-300: #ffffff;
  --color-gray-400: #ffffff;
  --glass-bg: #000000;
  --glass-border: #ffff00;
}

/* Ensure body background in high contrast dark */
[data-theme="dark"][data-high-contrast="true"] body,
[data-color-scheme="dark"][data-high-contrast="true"] body {
  background: #000000;
}

/* Text improvements - only target specific elements that need fixing */
[data-theme="dark"][data-high-contrast="true"] .email-from,
[data-theme="dark"][data-high-contrast="true"] .email-subject,
[data-color-scheme="dark"][data-high-contrast="true"] .email-from,
[data-color-scheme="dark"][data-high-contrast="true"] .email-subject {
  color: #ffffff;
  font-weight: 600;
}

[data-theme="dark"][data-high-contrast="true"] .email-preview,
[data-theme="dark"][data-high-contrast="true"] .email-time,
[data-color-scheme="dark"][data-high-contrast="true"] .email-preview,
[data-color-scheme="dark"][data-high-contrast="true"] .email-time {
  color: #ffffff;
}

/* Form inputs */
[data-theme="dark"][data-high-contrast="true"] .form-control,
[data-color-scheme="dark"][data-high-contrast="true"] .form-control {
  color: #ffffff;
  background-color: #1a1a1a;
  border-color: #666666;
}

[data-theme="dark"][data-high-contrast="true"] .form-control:focus,
[data-color-scheme="dark"][data-high-contrast="true"] .form-control:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3);
}

/* Email items */
[data-theme="dark"][data-high-contrast="true"] .email-item,
[data-color-scheme="dark"][data-high-contrast="true"] .email-item {
  background: #111111;
  border-color: #444444;
}

[data-theme="dark"][data-high-contrast="true"] .email-item:hover,
[data-theme="dark"][data-high-contrast="true"] .email-item:focus,
[data-color-scheme="dark"][data-high-contrast="true"] .email-item:hover,
[data-color-scheme="dark"][data-high-contrast="true"] .email-item:focus {
  background: #1a1a1a;
  border-color: #00d4ff;
}

/* Cards and glass elements */
[data-theme="dark"][data-high-contrast="true"] .glass-card,
[data-theme="dark"][data-high-contrast="true"] .glass-container,
[data-color-scheme="dark"][data-high-contrast="true"] .glass-card,
[data-color-scheme="dark"][data-high-contrast="true"] .glass-container {
  background: #111111;
  border-color: #444444;
}

/* Sidebar/folder links */
[data-theme="dark"][data-high-contrast="true"] .folder-link,
[data-color-scheme="dark"][data-high-contrast="true"] .folder-link {
  color: #ffffff;
}

[data-theme="dark"][data-high-contrast="true"] .folder-link.active,
[data-color-scheme="dark"][data-high-contrast="true"] .folder-link.active {
  background: #00d4ff;
  color: #000000;
}

/* Buttons - keep design but improve contrast */
[data-theme="dark"][data-high-contrast="true"] .btn-primary,
[data-color-scheme="dark"][data-high-contrast="true"] .btn-primary {
  background-color: #00d4ff;
  border-color: #00d4ff;
  color: #000000;
}

[data-theme="dark"][data-high-contrast="true"] .btn-secondary,
[data-theme="dark"][data-high-contrast="true"] .btn-outline-secondary,
[data-color-scheme="dark"][data-high-contrast="true"] .btn-secondary,
[data-color-scheme="dark"][data-high-contrast="true"] .btn-outline-secondary {
  background-color: #333333;
  border-color: #666666;
  color: #ffffff;
}

/* Voice status */
[data-theme="dark"][data-high-contrast="true"] .voice-status,
[data-color-scheme="dark"][data-high-contrast="true"] .voice-status {
  background: #111111;
  border-color: #00d4ff;
}

/* Modal */
[data-theme="dark"][data-high-contrast="true"] .modal-content,
[data-color-scheme="dark"][data-high-contrast="true"] .modal-content {
  background: #111111;
  border-color: #444444;
}

[data-theme="dark"][data-high-contrast="true"] .modal-header,
[data-theme="dark"][data-high-contrast="true"] .modal-footer,
[data-color-scheme="dark"][data-high-contrast="true"] .modal-header,
[data-color-scheme="dark"][data-high-contrast="true"] .modal-footer {
  border-color: #333333;
}

/* All secondary/muted text elements in high contrast */
[data-theme="dark"][data-high-contrast="true"] .text-muted,
[data-theme="dark"][data-high-contrast="true"] .text-secondary,
[data-theme="dark"][data-high-contrast="true"] small,
[data-theme="dark"][data-high-contrast="true"] .small,
[data-theme="dark"][data-high-contrast="true"] p,
[data-theme="dark"][data-high-contrast="true"] span,
[data-theme="dark"][data-high-contrast="true"] label,
[data-theme="dark"][data-high-contrast="true"] .form-label,
[data-theme="dark"][data-high-contrast="true"] .form-text,
[data-theme="dark"][data-high-contrast="true"] .help-text,
[data-theme="dark"][data-high-contrast="true"] .description,
[data-color-scheme="dark"][data-high-contrast="true"] .text-muted,
[data-color-scheme="dark"][data-high-contrast="true"] .text-secondary,
[data-color-scheme="dark"][data-high-contrast="true"] small,
[data-color-scheme="dark"][data-high-contrast="true"] .small,
[data-color-scheme="dark"][data-high-contrast="true"] p,
[data-color-scheme="dark"][data-high-contrast="true"] span,
[data-color-scheme="dark"][data-high-contrast="true"] label,
[data-color-scheme="dark"][data-high-contrast="true"] .form-label,
[data-color-scheme="dark"][data-high-contrast="true"] .form-text,
[data-color-scheme="dark"][data-high-contrast="true"] .help-text,
[data-color-scheme="dark"][data-high-contrast="true"] .description {
  color: #ffffff;
}

/* Headers and titles in high contrast */
[data-theme="dark"][data-high-contrast="true"] h1,
[data-theme="dark"][data-high-contrast="true"] h2,
[data-theme="dark"][data-high-contrast="true"] h3,
[data-theme="dark"][data-high-contrast="true"] h4,
[data-theme="dark"][data-high-contrast="true"] h5,
[data-theme="dark"][data-high-contrast="true"] h6,
[data-theme="dark"][data-high-contrast="true"] .modal-title,
[data-theme="dark"][data-high-contrast="true"] .card-title,
[data-theme="dark"][data-high-contrast="true"] .card__header,
[data-theme="dark"][data-high-contrast="true"] .email-header,
[data-theme="dark"][data-high-contrast="true"] .section-title,
[data-theme="dark"][data-high-contrast="true"] .page-title,
[data-color-scheme="dark"][data-high-contrast="true"] h1,
[data-color-scheme="dark"][data-high-contrast="true"] h2,
[data-color-scheme="dark"][data-high-contrast="true"] h3,
[data-color-scheme="dark"][data-high-contrast="true"] h4,
[data-color-scheme="dark"][data-high-contrast="true"] h5,
[data-color-scheme="dark"][data-high-contrast="true"] h6,
[data-color-scheme="dark"][data-high-contrast="true"] .modal-title,
[data-color-scheme="dark"][data-high-contrast="true"] .card-title,
[data-color-scheme="dark"][data-high-contrast="true"] .card__header,
[data-color-scheme="dark"][data-high-contrast="true"] .email-header,
[data-color-scheme="dark"][data-high-contrast="true"] .section-title,
[data-color-scheme="dark"][data-high-contrast="true"] .page-title {
  color: #ffffff;
}

/* Skip navigation link */
.skip-nav {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  padding: var(--space-8) var(--space-16);
  text-decoration: none;
  border-radius: var(--radius-base);
  z-index: 1000;
  font-weight: var(--font-weight-bold);
}

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

/* Voice Status Indicator */
.voice-status {
  position: fixed;
  bottom: var(--space-20);
  left: var(--space-20);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: var(--space-12) var(--space-20);
  display: flex;
  align-items: center;
  gap: var(--space-8);
  box-shadow: var(--glass-shadow);
  z-index: 1000;
  transition: all var(--duration-normal) var(--ease-standard);
}

.voice-status.listening {
  border-color: var(--voice-listening);
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.5);
}

.voice-status.processing {
  border-color: var(--voice-processing);
  box-shadow: 0 0 20px rgba(0, 123, 255, 0.5);
}

.voice-status.active {
  border-color: var(--voice-active);
  box-shadow: 0 0 20px rgba(40, 167, 69, 0.5);
}

.status-icon {
  animation: pulse 2s infinite;
}

.voice-status.listening .status-icon {
  animation: listening-pulse 1s infinite;
}

/* Glass morphism & Solid components */
.glass-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

.glass-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08) !important;
  border-radius: var(--radius-lg) !important;
  transition: all var(--duration-normal) var(--ease-standard);
}

[data-theme="dark"] .glass-card {
  background: #1e293b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6) !important;
}

.glass-card:hover {
  transform: translateY(-2px);
}

.glass-navbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="dark"] .glass-navbar {
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.glass-modal .modal-content {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

[data-theme="dark"] .glass-modal .modal-content {
  background: #1e293b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

/* Login container */
.login-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 520px;
  padding: 0;
}

.login-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12) !important;
  border-radius: 20px !important;
}

[data-theme="dark"] .login-card {
  background: #1e293b !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6) !important;
}

#login-title {
  color: #0f172a !important;
}

[data-theme="dark"] #login-title {
  color: #ffffff !important;
}

#welcome-message {
  color: #475569 !important;
}

[data-theme="dark"] #welcome-message {
  color: #cbd5e1 !important;
}

/* Screen management */
.screen {
  display: none;
  min-height: 100vh;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-standard);
}

.screen.active {
  display: block;
  opacity: 1;
}

/* Email list styles */
.email-list {
  max-height: 70vh;
  overflow-y: auto;
}

.email-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
  text-decoration: none;
  background: #ffffff;
  color: #0f172a;
}

.email-item:hover,
.email-item:focus {
  background: #f1f5f9;
  outline: none;
}

.email-item.unread {
  background: #f0f7ff;
  border-left: 3px solid #0284c7;
}

.email-item.spam {
  border-left: 4px solid var(--color-error);
  background: rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .email-item {
  background: #1e293b !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .email-item:hover,
[data-theme="dark"] .email-item:focus {
  background: #27354a !important;
}

[data-theme="dark"] .email-item.unread {
  background: #243144 !important;
  border-left: 3px solid #14b8a6 !important;
}

.email-priority {
  width: var(--space-4);
  height: 100%;
  margin-right: var(--space-16);
  border-radius: var(--radius-sm);
}

.email-priority.high {
  background: var(--priority-high);
}

.email-priority.medium {
  background: var(--priority-medium);
}

.email-priority.low {
  background: var(--priority-low);
}

.email-content {
  flex: 1;
  min-width: 0;
}

.email-from {
  font-weight: 700;
  margin-bottom: 4px;
  color: #0f172a;
  font-size: 14px;
}

[data-theme="dark"] .email-from {
  color: #ffffff !important;
}

.email-subject {
  margin-bottom: 4px;
  color: #1e293b;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .email-subject {
  color: #f8fafc !important;
}

.email-preview {
  font-size: 13px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .email-preview {
  color: #cbd5e1 !important;
}

.email-meta {
  text-align: right;
  min-width: 120px;
  padding-left: var(--space-16);
}

.email-time {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

[data-theme="dark"] .email-time {
  color: #94a3b8 !important;
}

.email-indicators {
  display: flex;
  gap: var(--space-4);
  justify-content: flex-end;
}

.email-indicators .badge {
  font-size: var(--font-size-xs);
}

/* Folder navigation */
.folder-nav .nav-link {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  padding: var(--space-10) var(--space-16);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-base);
  transition: all var(--duration-fast) var(--ease-standard);
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.folder-nav .nav-link:hover,
.folder-nav .nav-link:focus {
  background: var(--color-secondary);
  color: var(--color-text);
  transform: translateX(4px);
}

.folder-nav .nav-link.active {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  font-weight: var(--font-weight-semibold);
}

.folder-nav .badge {
  background: var(--color-bg-4);
  color: var(--color-text);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-8);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  margin-left: auto;
}

.folder-nav .badge-warning {
  background: var(--color-warning);
  color: var(--color-btn-primary-text);
}

/* Voice recording interface */
.voice-recording {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--color-bg-8);
  border: 2px solid var(--voice-listening);
  border-radius: var(--radius-lg);
  padding: var(--space-20);
  text-align: center;
  animation: recording-glow 2s infinite;
  z-index: 1050;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  max-width: 500px;
  min-width: 250px;
}

@media (max-width: 768px) {
  .voice-recording {
    left: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
    min-width: auto;
  }
}

.recording-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  margin-bottom: var(--space-16);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.recording-pulse {
  width: 12px;
  height: 12px;
  background: var(--voice-listening);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

.voice-waveform {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  align-items: flex-end;
  height: 40px;
}

.waveform-bar {
  width: 4px;
  background: var(--voice-active);
  border-radius: var(--radius-sm);
  animation: waveform 1.5s infinite ease-in-out;
}

.waveform-bar:nth-child(1) {
  animation-delay: 0s;
}

.waveform-bar:nth-child(2) {
  animation-delay: 0.1s;
}

.waveform-bar:nth-child(3) {
  animation-delay: 0.2s;
}

.waveform-bar:nth-child(4) {
  animation-delay: 0.3s;
}

.waveform-bar:nth-child(5) {
  animation-delay: 0.4s;
}

/* Email reader styles */
.email-header {
  padding: var(--space-20);
  background: var(--color-bg-5);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--color-primary);
}

.email-subject {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  line-height: var(--line-height-tight);
}

.email-meta p {
  margin-bottom: var(--space-8);
  color: var(--color-text-secondary);
}

.email-body {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  white-space: pre-wrap;
  padding: 0;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  max-height: none;
  overflow: visible;
  min-height: 200px;
}

.email-body iframe {
  width: 100%;
  border: none;
  display: block;
  overflow: hidden;
}

/* HTML email content styling */
.email-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: var(--space-12) 0;
}

.email-body a {
  color: var(--color-primary);
  text-decoration: underline;
}

.email-body a:hover {
  color: var(--color-primary-hover);
}

.email-body table {
  max-width: 100%;
  border-collapse: collapse;
  margin: var(--space-12) 0;
}

.email-body table td,
.email-body table th {
  padding: var(--space-8);
  border: 1px solid var(--color-border);
}

/* Attachments styling */
#email-attachments {
  margin-top: var(--space-16);
  padding: var(--space-16);
  background: rgba(var(--color-teal-500-rgb), 0.05);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.attachment-item {
  margin: 0;
}

.attachment-item .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  white-space: nowrap;
}

.attachment-item .badge {
  font-size: var(--font-size-xs);
  padding: 2px 6px;
}

/* Reading controls */
.reading-controls {
  display: flex;
  gap: var(--space-12);
  flex-wrap: wrap;
  align-items: center;
}

/* Settings form enhancements */
.form-range {
  cursor: pointer;
}

.form-range:focus {
  box-shadow: var(--focus-ring);
}

#font-size-value,
#speech-rate-value,
#speech-volume-value {
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

/* Command list in help modal */
.command-list {
  list-style: none;
  padding: 0;
}

.command-list li {
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--color-border);
}

.command-list li:last-child {
  border-bottom: none;
}

.command-list strong {
  color: var(--color-primary);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  background: var(--color-secondary);
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-sm);
}

/* Toast notifications */
.toast-container .toast {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  color: var(--color-text);
}

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

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

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

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-content p {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
}

/* Focus management and accessibility */
*:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* High contrast mode overrides */
[data-high-contrast="true"] .glass-card,
[data-high-contrast="true"] .glass-container,
[data-high-contrast="true"] .glass-navbar {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  backdrop-filter: none;
}

[data-high-contrast="true"] .email-item:hover,
[data-high-contrast="true"] .email-item:focus {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  border-color: var(--color-primary);
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

[data-high-contrast="true"] .voice-recording {
  background: var(--color-surface);
  border: 3px solid var(--color-primary);
}

/* Dark mode high contrast email items */
[data-theme="dark"][data-high-contrast="true"] .email-item:hover,
[data-theme="dark"][data-high-contrast="true"] .email-item:focus,
[data-color-scheme="dark"][data-high-contrast="true"] .email-item:hover,
[data-color-scheme="dark"][data-high-contrast="true"] .email-item:focus {
  background: #00ffff;
  color: #000000;
  border-color: #ffffff;
}

/* Responsive design */
@media (max-width: 768px) {
  .voice-status {
    position: static;
    margin: var(--space-16);
    border-radius: var(--radius-base);
  }

  .login-container {
    padding: var(--space-16);
    width: 95%;
  }

  .email-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-8);
  }

  .email-meta {
    text-align: left;
    padding-left: 0;
    width: 100%;
  }

  .email-indicators {
    justify-content: flex-start;
  }

  .reading-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .reading-controls .btn {
    width: 100%;
  }

  .navbar-nav {
    flex-direction: column !important;
    gap: var(--space-8) !important;
  }
}

@media (max-width: 576px) {
  .container-fluid {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }

  .card-body {
    padding: var(--space-12);
  }

  .btn {
    padding: var(--space-10) var(--space-16);
    font-size: var(--font-size-sm);
  }

  .email-subject {
    font-size: var(--font-size-xl);
  }

  .email-body {
    font-size: var(--font-size-base);
    padding: var(--space-16);
  }
}

/* Mobile-specific color fixes */
@media screen and (max-width: 768px) {
  /* Ensure colors are applied on mobile */
  :root,
  [data-theme="light"],
  [data-color-scheme="light"] {
    color-scheme: light;
  }
  
  [data-theme="dark"],
  [data-color-scheme="dark"] {
    color-scheme: dark;
  }
  
  /* Force background color on mobile */
  body {
    background-color: var(--color-background) !important;
    color: var(--color-text) !important;
  }
  
  /* Fix for iOS Safari */
  .glass-container,
  .glass-card,
  .card {
    background-color: var(--color-surface) !important;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
  body {
    /* Fix for iOS viewport height */
    min-height: -webkit-fill-available;
  }
  
  /* Ensure proper color rendering on iOS */
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Animations */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes listening-pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

@keyframes recording-glow {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
  }

  50% {
    box-shadow: 0 0 30px rgba(255, 193, 7, 0.6);
  }
}

@keyframes waveform {

  0%,
  100% {
    height: 10px;
  }

  50% {
    height: 30px;
  }
}

/* Print styles */
@media print {

  .voice-status,
  .navbar,
  .reading-controls,
  .btn {
    display: none !important;
  }

  .email-body {
    background: white !important;
    border: none !important;
    box-shadow: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {

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

  .voice-status,
  .recording-pulse,
  .waveform-bar {
    animation: none !important;
  }
}

/* Custom scrollbars */
.email-list::-webkit-scrollbar,
.email-body::-webkit-scrollbar {
  width: 8px;
}

.email-list::-webkit-scrollbar-track,
.email-body::-webkit-scrollbar-track {
  background: var(--color-secondary);
  border-radius: var(--radius-sm);
}

.email-list::-webkit-scrollbar-thumb,
.email-body::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: var(--radius-sm);
}

.email-list::-webkit-scrollbar-thumb:hover,
.email-body::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-hover);
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 10px;
  right: 20px;
  z-index: 1050;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--duration-normal) var(--ease-standard);
  box-shadow: var(--shadow-md);
}

/* Hide floating theme toggle when dashboard is active (navbar has theme toggle) */
.app-container:not(.app-container--login) .theme-toggle.theme-toggle:not(.btn) {
  display: none;
}

.theme-toggle:hover {
  background: var(--color-secondary-hover);
  transform: scale(1.05);
}

.theme-toggle:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
  box-shadow: var(--focus-ring), var(--shadow-md);
}

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

/* Improved Focus Indicators */
*:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: var(--focus-ring);
}

/* Skip Navigation Link */
.skip-nav {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  padding: 8px 16px;
  text-decoration: none;
  border-radius: var(--radius-base);
  z-index: 9999;
  font-weight: var(--font-weight-medium);
}

.skip-nav:focus {
  top: 10px;
  left: 10px;
}

/* Screen Reader Only */
.visually-hidden:not(:focus):not(:active) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border-width: 0 !important;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --color-border: var(--color-text);
    --color-focus-ring: var(--color-text);
  }

  button,
  input,
  select,
  textarea {
    border-width: 2px !important;
  }

  .btn {
    border-width: 2px !important;
  }
}
/* High Contrast & Comprehensive Dark/Light Theme Consistency Overrides */
.text-muted,
.form-text,
.text-secondary {
  color: var(--color-text-secondary) !important;
}

[data-theme="dark"] {
  --color-background: #12161f;
  --color-surface: #1e2634;
  --color-text: #ffffff;
  --color-text-secondary: #cbd5e1;
  --color-border: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] body {
  background-color: #12161f !important;
  color: #ffffff !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .glass-card,
[data-theme="dark"] .modal-content {
  background: rgba(30, 38, 52, 0.95) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] p,
[data-theme="dark"] label,
[data-theme="dark"] span:not(.badge):not(.wave-bar),
[data-theme="dark"] strong,
[data-theme="dark"] li,
[data-theme="dark"] a:not(.btn) {
  color: #ffffff !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-text,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] small,
[data-theme="dark"] .small {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .text-dark {
  color: #ffffff !important;
}

/* Form Controls Dark Mode Visibility */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] textarea {
  background-color: #171f2b !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] textarea:focus {
  background-color: #1a2433 !important;
  color: #ffffff !important;
  border-color: #12c0a8 !important;
  box-shadow: 0 0 0 3px rgba(18, 192, 168, 0.3) !important;
}

[data-theme="dark"] ::placeholder {
  color: #94a3b8 !important;
  opacity: 1 !important;
}

/* Email Item Theme Consistency */
[data-theme="dark"] .email-item {
  background-color: #1e2634 !important;
  color: #ffffff !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .email-item:hover {
  background-color: #273346 !important;
}

[data-theme="dark"] .email-item .email-sender,
[data-theme="dark"] .email-item .email-subject {
  color: #ffffff !important;
}

[data-theme="dark"] .email-item .email-snippet {
  color: #cbd5e1 !important;
}

/* Audio Aura Waves */
.audio-aura-waves {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 16px;
  vertical-align: middle;
}
.wave-bar {
  width: 3px;
  height: 100%;
  background: #00d2ff;
  border-radius: 2px;
  animation: wavePulse 1s ease-in-out infinite;
}
.wave-bar:nth-child(1) { animation-delay: 0.0s; }
.wave-bar:nth-child(2) { animation-delay: 0.2s; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; }
.wave-bar:nth-child(4) { animation-delay: 0.6s; }

@keyframes wavePulse {
  0%, 100% { height: 4px; opacity: 0.4; }
  50% { height: 16px; opacity: 1; }
}

/* User Profile Badge */
.user-profile-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--color-border);
  transition: all 0.2s ease-in-out;
}
[data-theme="dark"] .user-profile-badge {
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff !important;
}

/* Premium Gradient Buttons & Micro-interactions */
.btn--primary {
  background: linear-gradient(135deg, #0d9488 0%, #0284c7 100%) !important;
  border: none !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn--primary:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.35) !important;
}

[data-theme="dark"] .btn--primary {
  background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.35) !important;
}

[data-theme="dark"] .btn--primary:hover {
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.5) !important;
}

/* Folder Links Active State */
.folder-link {
  transition: all 0.2s ease-in-out !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 14px !important;
}

.folder-link.active {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.12) 0%, rgba(2, 132, 199, 0.12) 100%) !important;
  border-left: 3px solid #0d9488 !important;
  font-weight: 600 !important;
  color: #0d9488 !important;
}

[data-theme="dark"] .folder-link.active {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.2) 0%, rgba(6, 182, 212, 0.2) 100%) !important;
  border-left: 3px solid #14b8a6 !important;
  color: #2dd4bf !important;
}

/* Glass Navbar */
.glass-navbar {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
}

[data-theme="dark"] .glass-navbar {
  background: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Accessibility & High-Contrast Compose Screen Overrides */
.form-label {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  margin-bottom: 6px !important;
}

[data-theme="dark"] .form-label {
  color: #ffffff !important;
}

.form-text,
.dictation-hint,
.text-muted {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  opacity: 1 !important;
  margin-top: 6px !important;
  margin-bottom: 16px !important;
}

[data-theme="dark"] .form-text,
[data-theme="dark"] .dictation-hint,
[data-theme="dark"] .text-muted {
  color: #e2e8f0 !important;
}

.form-control,
.form-select,
textarea {
  font-size: 16px !important;
  font-weight: 500 !important;
  border: 2px solid #cbd5e1 !important;
  border-radius: 10px !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  padding: 12px 16px !important;
}

.form-control:focus,
textarea:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.25) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea {
  background-color: #171f2b !important;
  color: #ffffff !important;
  border: 2px solid rgba(255, 255, 255, 0.25) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] textarea:focus {
  border-color: #14b8a6 !important;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.3) !important;
}

/* Voice Recording Box Accessibility Polish */
.voice-recording {
  position: fixed !important;
  right: 24px !important;
  bottom: 24px !important;
  background: #ffffff !important;
  border: 2px solid #10b981 !important;
  border-radius: 16px !important;
  padding: 20px 28px !important;
  text-align: center !important;
  z-index: 1050 !important;
  box-shadow: 0 16px 40px rgba(16, 185, 129, 0.25) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  font-size: 15px !important;
}

[data-theme="dark"] .voice-recording {
  background: #1e293b !important;
  border: 2px solid #14b8a6 !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7) !important;
  color: #ffffff !important;
}

.voice-status {
  position: fixed !important;
  bottom: 24px !important;
  left: 24px !important;
  z-index: 1050 !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 22px !important;
  background: #ffffff !important;
  border: 2px solid #0284c7 !important;
  border-radius: 9999px !important;
  box-shadow: 0 12px 30px rgba(2, 132, 199, 0.2) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  font-size: 14px !important;
}

[data-theme="dark"] .voice-status {
  background: #1e293b !important;
  border: 2px solid #14b8a6 !important;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.6) !important;
  color: #ffffff !important;
}

/* Green Start Dictating Button */
#start-dictate-btn,
.btn-dictate {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3) !important;
}

#start-dictate-btn:hover,
.btn-dictate:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45) !important;
}

/* --- Wispr Flow Dictation Controls --- */
.wispr-flow-controls {
  user-select: none;
}

.wispr-mode-pills {
  gap: 2px;
  background: #f1f5f9;
}

.wispr-mode-pills .pill-mode {
  border: none;
  background: transparent;
  color: #64748b;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.wispr-mode-pills .pill-mode:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.wispr-mode-pills .pill-mode.active {
  background: #ffffff !important;
  color: #2563eb !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .wispr-mode-pills {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .wispr-mode-pills .pill-mode {
  color: #94a3b8 !important;
}

[data-theme="dark"] .wispr-mode-pills .pill-mode.active {
  background: #0f172a !important;
  color: #38bdf8 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

#wispr-stats-badge {
  transition: all 0.3s ease;
  animation: pulseBadge 2s infinite ease-in-out;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.7; }
}

