:root {
  color-scheme: light;
  /* Surface tokens */
  --surface-base: #ffffff;
  --surface-primary: var(--surface-base);
  --surface-secondary: #f5f5f5;
  --surface-muted: #f8fafc;
  --surface-code: #f1f5f9;
  --surface-hover: #e0e0e0;
  --markdown-table-row-odd: transparent;
  --markdown-table-row-even: #f1f5f9;
  
  /* Border tokens */
  --border-base: #e0e0e0;
  --border-secondary: #e0e0e0;
  --border-muted: #e0e0e0;
  --border-strong: color-mix(in oklab, var(--border-base) 62%, var(--text-primary));
  
  /* Text tokens */
  --text-primary: #111827;
  --text-secondary: #334155;
  --text-muted: #475569;
  --text-inverted: #ffffff;
  --text-on-accent: #ffffff;
  
  /* Accent tokens */
  --accent-primary: #0066ff;
  --accent-hover: #0052cc;
  
  /* Status tokens */
  --status-success: #4caf50;
  --status-error: #f44336;
  --status-warning: #ff9800;
  
  /* Message-specific tokens */
  --message-user-bg: color-mix(in oklab, var(--surface-secondary) 88%, var(--message-user-border));
  --message-user-border: #2196f3;
  --message-assistant-bg: var(--message-tool-bg);
  --message-assistant-border: #f59e0b;

  --message-tool-bg: #eef2f7;
  --message-tool-border: #64748b;

  /* Session list selection tints */
  --session-user-active-bg: color-mix(in oklab, var(--surface-secondary) 85%, var(--message-user-border));
  --session-assistant-active-bg: color-mix(in oklab, var(--surface-secondary) 85%, var(--message-assistant-border));

  /* Semantic component colors */
  --session-status-working-fg: #b45309;
  --session-status-working-bg: rgba(245, 158, 11, 0.16);
  --session-status-compacting-fg: #6d28d9;
  --session-status-compacting-bg: rgba(109, 40, 217, 0.18);
  --session-status-idle-fg: #15803d;
  --session-status-idle-bg: rgba(22, 163, 74, 0.16);
  --session-status-permission-fg: #b91c1c;
  --session-status-permission-bg: rgba(239, 68, 68, 0.16);
  --list-item-highlight-bg: rgba(0, 102, 255, 0.1);
  --list-item-highlight-bg-solid: #e5f0ff;
  --list-item-highlight-border: rgba(0, 102, 255, 0.25);
  --attachment-chip-bg: rgba(0, 102, 255, 0.1);
  --attachment-chip-text: #0066ff;
  --attachment-chip-ring: rgba(0, 102, 255, 0.1);
  --badge-neutral-bg: rgba(0, 102, 255, 0.05);
  --badge-neutral-text: #0066ff;
  --badge-success-bg: rgba(76, 175, 80, 0.12);
  --status-ready-fg: #16a34a;
  --status-ready-bg: rgba(34, 197, 94, 0.1);
  --status-starting-fg: #ca8a04;
  --status-starting-bg: rgba(250, 204, 21, 0.1);
  --status-error-fg: #dc2626;
  --status-error-bg: rgba(239, 68, 68, 0.1);
  --status-stopped-fg: #6b7280;
  --status-stopped-bg: rgba(107, 114, 128, 0.1);
  --env-vars-bg: rgba(0, 102, 255, 0.1);
  --env-vars-border: rgba(0, 102, 255, 0.2);
  --env-vars-text: #0066ff;
  --folder-overlay-bg: rgba(0, 0, 0, 0.35);
  --folder-card-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  --folder-card-radius: 16px;
  --dropdown-highlight-bg: rgba(0, 102, 255, 0.1);
  --dropdown-highlight-text: var(--text-primary);
  --selection-highlight-bg: rgba(0, 102, 255, 0.12);
  --selection-highlight-strong-bg: rgba(0, 102, 255, 0.18);
  --overlay-scrim: rgba(0, 0, 0, 0.5);
  --scroll-elevation-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  --panel-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  --panel-shadow-strong: 0 12px 32px rgba(0, 0, 0, 0.18);
  --popover-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  --code-block-header-bg: color-mix(in oklab, var(--surface-secondary) 78%, var(--text-primary));
  --message-error-bg: rgba(244, 67, 54, 0.1);
  --message-error-bg-strong: rgba(244, 67, 54, 0.15);
  --danger-soft-bg: rgba(239, 68, 68, 0.1);
  --danger-soft-bg-strong: rgba(244, 67, 54, 0.15);
  --log-level-error: var(--status-error);
  --log-level-warn: var(--status-warning);
  --log-level-debug: var(--text-muted);
  --log-level-default: var(--text-primary);
  --focus-ring-color: var(--accent-primary);
  --focus-ring-offset: var(--surface-base);
  --control-ghost-bg: color-mix(in oklab, var(--text-primary) 6%, transparent);
  --status-success-ring: color-mix(in oklab, var(--status-success) 45%, transparent);
  --border-critical: var(--status-error);

  /* Message timeline active segment (light theme should be a light tint). */
  --timeline-segment-active-bg: #b7e6d6;
  --timeline-segment-active-text: #032f23;
  --timeline-segment-active-ring: inset 0 0 0 1px rgba(3, 47, 35, 0.28);

  --button-danger-bg: rgba(239, 68, 68, 0.85);
  --button-danger-hover-bg: rgba(239, 68, 68, 0.9);
  --button-danger-active-bg: rgba(239, 68, 68, 1);
  --button-danger-text: var(--text-inverted);
  --kbd-bg: var(--surface-secondary);
  --kbd-border: var(--border-base);
  --kbd-text: var(--text-primary);
  --button-primary-bg: var(--accent-primary);
  --button-primary-hover-bg: var(--accent-hover);
  --button-primary-text: var(--text-inverted);
  --tab-active-bg: var(--accent-primary);
  --tab-active-hover-bg: var(--accent-hover);
  --tab-active-text: var(--text-inverted);
  --tab-inactive-bg: var(--surface-muted);
  --tab-inactive-hover-bg: var(--surface-hover);
  --tab-inactive-text: var(--text-secondary);
  --new-tab-bg: var(--surface-secondary);
  --new-tab-hover-bg: var(--surface-hover);
  --new-tab-text: var(--text-muted);
  --session-tab-active-bg: var(--surface-base);
  --session-tab-active-text: var(--text-primary);
  --session-tab-inactive-text: var(--text-muted);
  --session-tab-hover-bg: var(--surface-hover);

  /* Layout & spacing tokens */
  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;
  --button-padding-y: 0.75rem;
  --button-padding-x: 1.25rem;
  --button-radius: 0.5rem;
  --chip-radius: 0.375rem;
  --pill-radius: 9999px;
  
  /* Typography tokens */
  --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  
  /* Font weights */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Font sizes */
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  
  /* Line heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    /* Surface tokens */
    --surface-base: #1a1a1a;
    --surface-primary: var(--surface-base);
    --surface-secondary: #2a2a2a;
    --surface-muted: #212529;
    --surface-code: #1a1a1a;
    --surface-hover: #3a3a3a;
    --markdown-table-row-odd: #0f1114;
    --markdown-table-row-even: #181c22;
    
    /* Border tokens */
    --border-base: #3a3a3a;
    --border-secondary: #3a3a3a;
    --border-muted: #3a3a3a;
    --border-strong: var(--border-base);
    
    /* Text tokens */
    --text-primary: #cfd4dc;
    --text-secondary: #999999;
    --text-muted: #999999;
    --text-inverted: #1a1a1a;
    --text-on-accent: #f5f6f8;
    
    /* Accent tokens */
    --accent-primary: #0080ff;
    --accent-hover: #0066cc;
    
    /* Status tokens */
    --status-success: #4caf50;
    --status-error: #f44336;
    --status-warning: #ff9800;
    
    /* Message-specific tokens */
    --message-user-bg: #202734;
    --message-user-border: #42a5f5;
    --message-assistant-bg: var(--message-tool-bg);
    --message-assistant-border: #d97706;

    --message-tool-bg: #212529;
    --message-tool-border: #adb5bd;

    /* Semantic component colors */
    --session-status-working-fg: #facc15;
    --session-status-working-bg: rgba(250, 204, 21, 0.25);
    --session-status-compacting-fg: #c084fc;
    --session-status-compacting-bg: rgba(192, 132, 252, 0.28);
    --session-status-idle-fg: #4ade80;
    --session-status-idle-bg: rgba(74, 222, 128, 0.22);
    --session-status-permission-fg: #f87171;
    --session-status-permission-bg: rgba(248, 113, 113, 0.22);
  --list-item-highlight-bg: rgba(0, 128, 255, 0.2);
  --list-item-highlight-bg-solid: #15324e;
  --list-item-highlight-border: rgba(0, 128, 255, 0.4);

    --attachment-chip-bg: rgba(0, 128, 255, 0.1);
    --attachment-chip-text: #0080ff;
    --attachment-chip-ring: rgba(0, 128, 255, 0.2);
  --badge-neutral-bg: rgba(0, 128, 255, 0.15);
  --badge-neutral-text: #0080ff;
  --badge-success-bg: rgba(76, 175, 80, 0.22);
  --status-ready-fg: #22c55e;
  --status-ready-bg: rgba(34, 197, 94, 0.2);
  --status-starting-fg: #facc15;
  --status-starting-bg: rgba(250, 204, 21, 0.2);
  --status-error-fg: #ef4444;
  --status-error-bg: rgba(239, 68, 68, 0.2);
  --status-stopped-fg: #9ca3af;
  --status-stopped-bg: rgba(107, 114, 128, 0.2);
  --env-vars-bg: rgba(0, 128, 255, 0.2);
  --env-vars-border: rgba(0, 128, 255, 0.3);
  --env-vars-text: #0080ff;
  --folder-overlay-bg: rgba(0, 0, 0, 0.45);
  --folder-card-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --folder-card-radius: 16px;
  --dropdown-highlight-bg: rgba(0, 128, 255, 0.2);
  --dropdown-highlight-text: var(--text-primary);
  --kbd-bg: var(--surface-secondary);
  --kbd-border: var(--border-base);
  --kbd-text: var(--text-primary);
  --panel-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --panel-shadow-strong: 0 12px 32px rgba(0, 0, 0, 0.45);
  --popover-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  --code-block-header-bg: var(--surface-secondary);
  --border-critical: var(--status-error);
  --timeline-segment-active-bg: #0f5b44;
  --timeline-segment-active-text: #ffffff;
  --timeline-segment-active-ring: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  --button-danger-text: var(--text-inverted);
  --button-primary-bg: #3f3f46;
  --button-primary-hover-bg: #52525b;
  --button-primary-text: #f5f6f8;
  --tab-active-bg: #3f3f46;
  --tab-active-hover-bg: #52525b;
  --tab-active-text: #f5f6f8;
  --tab-inactive-bg: #2a2a31;
  --tab-inactive-hover-bg: #3f3f46;
  --tab-inactive-text: #d4d4d8;
  --new-tab-bg: #3f3f46;
  --new-tab-hover-bg: #52525b;
  --new-tab-text: #f5f6f8;
  --session-tab-active-bg: var(--surface-muted);
  --session-tab-active-text: var(--text-primary);
  --session-tab-inactive-text: var(--text-muted);
  --session-tab-hover-bg: #3f3f46;

    --button-primary-bg: #3f3f46;
    --button-primary-hover-bg: #52525b;
    --button-primary-text: #f5f6f8;
    --tab-active-bg: #3f3f46;
    --tab-active-hover-bg: #52525b;
    --tab-active-text: #f5f6f8;
    --tab-inactive-bg: #2f2f36;
    --tab-inactive-hover-bg: #3d3d45;
    --tab-inactive-text: #d4d4d8;
    --new-tab-bg: #3f3f46;
    --new-tab-hover-bg: #52525b;
    --new-tab-text: #f5f6f8;
    --session-tab-active-bg: var(--surface-muted);
    --session-tab-active-text: var(--text-primary);
    --session-tab-inactive-text: var(--text-muted);
    --session-tab-hover-bg: #3f3f46;

    /* Layout & spacing tokens */
    --space-2xs: 2px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --radius-xs: 3px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;
    --button-padding-y: 0.75rem;
    --button-padding-x: 1.25rem;
    --button-radius: 0.5rem;
    --chip-radius: 0.375rem;
    --pill-radius: 9999px;
    
    /* Typography tokens (same as light theme) */
    --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    /* Font weights */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Font sizes */
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 20px;
    
    /* Line heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.6;

  }
}

[data-theme="dark"] {
  color-scheme: dark;
  /* Surface tokens */
  --surface-base: #1a1a1a;
  --surface-primary: var(--surface-base);
  --surface-secondary: #2a2a2a;
  --surface-muted: #212529;
  --surface-code: #1a1a1a;
  --surface-hover: #3a3a3a;
  --markdown-table-row-odd: #0f1114;
  --markdown-table-row-even: #181c22;
  
  /* Border tokens */
  --border-base: #3a3a3a;
  --border-secondary: #3a3a3a;
  --border-muted: #3a3a3a;
  --border-strong: var(--border-base);
  
  /* Text tokens */
  --text-primary: #cfd4dc;
  --text-secondary: #999999;
  --text-muted: #999999;
  --text-inverted: #1a1a1a;
  --text-on-accent: #f5f6f8;
  
  /* Accent tokens */
  --accent-primary: #0080ff;
  --accent-hover: #0066cc;
  
  /* Status tokens */
  --status-success: #4caf50;
  --status-error: #f44336;
  --status-warning: #ff9800;
  
  /* Message-specific tokens */
  --message-user-bg: #202734;
  --message-user-border: #2196f3;
  --message-assistant-bg: var(--message-tool-bg);
  --message-assistant-border: #d97706;

  --message-tool-bg: #212529;
  --message-tool-border: #adb5bd;

  /* Semantic component colors */
  --session-status-working-fg: #facc15;
  --session-status-working-bg: rgba(250, 204, 21, 0.25);
  --session-status-compacting-fg: #c084fc;
  --session-status-compacting-bg: rgba(192, 132, 252, 0.28);
  --session-status-idle-fg: #4ade80;
  --session-status-idle-bg: rgba(74, 222, 128, 0.22);
  --session-status-permission-fg: #f87171;
  --session-status-permission-bg: rgba(248, 113, 113, 0.22);
  --list-item-highlight-bg: rgba(0, 128, 255, 0.2);
  --list-item-highlight-bg-solid: #15324e;
  --list-item-highlight-border: rgba(0, 128, 255, 0.4);
  --attachment-chip-bg: rgba(0, 128, 255, 0.1);
  --attachment-chip-text: #0080ff;
  --attachment-chip-ring: rgba(0, 128, 255, 0.2);
  --badge-neutral-bg: rgba(0, 128, 255, 0.15);
  --badge-neutral-text: #0080ff;
  --badge-success-bg: rgba(76, 175, 80, 0.22);
  --status-ready-fg: #22c55e;
  --status-ready-bg: rgba(34, 197, 94, 0.2);
  --status-starting-fg: #facc15;
  --status-starting-bg: rgba(250, 204, 21, 0.2);
  --status-error-fg: #ef4444;
  --status-error-bg: rgba(239, 68, 68, 0.2);
  --status-stopped-fg: #9ca3af;
  --status-stopped-bg: rgba(107, 114, 128, 0.2);
  --env-vars-bg: rgba(0, 128, 255, 0.2);
  --env-vars-border: rgba(0, 128, 255, 0.3);
  --env-vars-text: #0080ff;
  --folder-overlay-bg: rgba(0, 0, 0, 0.45);
  --folder-card-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --folder-card-radius: 16px;
  --dropdown-highlight-bg: rgba(0, 128, 255, 0.2);
  --dropdown-highlight-text: var(--text-primary);
  --selection-highlight-bg: rgba(0, 128, 255, 0.18);
  --selection-highlight-strong-bg: rgba(0, 128, 255, 0.28);
  --overlay-scrim: rgba(0, 0, 0, 0.6);
  --scroll-elevation-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  --panel-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --panel-shadow-strong: 0 12px 32px rgba(0, 0, 0, 0.45);
  --popover-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  --code-block-header-bg: var(--surface-secondary);
  --border-critical: var(--status-error);
  --timeline-segment-active-bg: #0f5b44;
  --timeline-segment-active-text: #ffffff;
  --timeline-segment-active-ring: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  --button-danger-text: var(--text-inverted);
  --message-error-bg: rgba(244, 67, 54, 0.12);
  --message-error-bg-strong: rgba(244, 67, 54, 0.2);
  --danger-soft-bg: rgba(244, 67, 54, 0.16);
  --danger-soft-bg-strong: rgba(244, 67, 54, 0.28);
  --log-level-error: var(--status-error);
  --log-level-warn: var(--status-warning);
  --log-level-debug: var(--text-secondary);
  --log-level-default: var(--text-primary);
  --focus-ring-color: var(--accent-primary);
  --focus-ring-offset: var(--surface-base);
  --kbd-bg: var(--surface-secondary);
  --kbd-border: var(--border-base);
  --kbd-text: var(--text-primary);
  --button-primary-bg: #3f3f46;
  --button-primary-hover-bg: #52525b;
  --button-primary-text: #f5f6f8;
  --tab-active-bg: #3f3f46;
  --tab-active-hover-bg: #52525b;
  --tab-active-text: #f5f6f8;
  --tab-inactive-bg: #2a2a31;
  --tab-inactive-hover-bg: #3f3f46;
  --tab-inactive-text: #d4d4d8;
  --new-tab-bg: #3f3f46;
  --new-tab-hover-bg: #52525b;
  --new-tab-text: #f5f6f8;

  /* Layout & spacing tokens */
  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;
  --button-padding-y: 0.75rem;
  --button-padding-x: 1.25rem;
  --button-radius: 0.5rem;
  --chip-radius: 0.375rem;
  --pill-radius: 9999px;
  
  /* Typography tokens (same as light theme) */
  --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Font weights */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Font sizes */
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  
  /* Line heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;

}
