/**
 * MIGESTI OS — Design Tokens
 * Sovereign Operating System Visual Language — Enhanced 3D / Holographic Edition
 *
 * Every color, spacing, shadow, and animation
 * in the MIGESTI OS interface derives from these tokens.
 *
 * Architect: Matthew F. Inglima
 * CONFIDENTIAL — All Rights Reserved
 */

:root {
  /* ═══════════════════════════════════════
     MIGESTI COLOR SYSTEM
     ═══════════════════════════════════════ */
  --mig-black:        #000008;
  --mig-black-soft:   #05050f;
  --mig-navy:         #08091a;
  --mig-navy-light:   #0d0f24;

  --mig-gold:         #D4A843;
  --mig-gold-bright:  #FFD700;
  --mig-gold-dim:     rgba(212,168,67,0.25);
  --mig-gold-glow:    rgba(212,168,67,0.4);

  --mig-cyan:         #00d4ff;
  --mig-cyan-dim:     rgba(0,212,255,0.25);

  --mig-text-primary:   #eeeef5;
  --mig-text-secondary: #9090b8;
  --mig-text-muted:     #555575;
  --mig-text-gold:      #D4A843;

  --mig-success:  #00e87a;
  --mig-warning:  #ffaa00;
  --mig-danger:   #ff4455;
  --mig-info:     #4488ff;

  /* ═══════════════════════════════════════
     SIDEBAR SYSTEM
     ═══════════════════════════════════════ */
  --sidebar-width-full:      220px;
  --sidebar-width-collapsed: 56px;
  --sidebar-bg:       rgba(5, 5, 18, 0.97);
  --sidebar-border:   1px solid rgba(212,168,67,0.12);

  /* ═══════════════════════════════════════
     PANEL SYSTEM
     ═══════════════════════════════════════ */
  --panel-bg:         #0D102D;
  --panel-border:     1px solid rgba(212,168,67,0.18);
  --panel-radius:     12px;
  --panel-blur:       blur(20px);
  --panel-shadow:     0 4px 24px rgba(0,0,0,0.5);
  --panel-padding:    16px;

  --panel-hover-border:  1px solid rgba(212,168,67,0.55);
  --panel-hover-shadow:  0 0 24px rgba(212,168,67,0.2), 0 4px 32px rgba(0,0,0,0.6);
  --panel-hover-transform: translateY(-1px);

  /* ═══════════════════════════════════════
     TOPBAR SYSTEM
     ═══════════════════════════════════════ */
  --topbar-height:    52px;
  --topbar-bg:        rgba(4, 4, 16, 0.98);
  --topbar-border:    1px solid rgba(212,168,67,0.15);

  /* ═══════════════════════════════════════
     TYPOGRAPHY
     ═══════════════════════════════════════ */
  --font-primary: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  --text-xs:   0.72rem;
  --text-sm:   0.82rem;
  --text-base: 0.92rem;
  --text-md:   1rem;
  --text-lg:   1.15rem;
  --text-xl:   1.35rem;
  --text-2xl:  1.65rem;

  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* ═══════════════════════════════════════
     SPACING & RADIUS
     ═══════════════════════════════════════ */
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ═══════════════════════════════════════
     ANIMATION
     ═══════════════════════════════════════ */
  --transition-fast:   all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  --glow-gold:  0 0 16px rgba(212,168,67,0.5), 0 0 40px rgba(212,168,67,0.2);
  --glow-cyan:  0 0 16px rgba(0,212,255,0.5),  0 0 40px rgba(0,212,255,0.2);
  --glow-white: 0 0 16px rgba(255,255,255,0.3), 0 0 32px rgba(255,255,255,0.1);

  /* ═══════════════════════════════════════
     ICON SIZES
     ═══════════════════════════════════════ */
  --icon-xs:   12px;
  --icon-sm:   16px;
  --icon-base: 18px;
  --icon-md:   22px;
  --icon-lg:   28px;
  --icon-xl:   40px;
  --icon-2xl:  56px;

  /* ═══════════════════════════════════════
     LEGACY COMPATIBILITY
     ═══════════════════════════════════════ */
  --bg-primary:       #000008;
  --bg-secondary:     #0a1325;
  --bg-tertiary:      #0f1a33;
  --bg-card:          #0D102D;
  --bg-card-hover:    #121637;
  --bg-frosted:       #0D102D;
  --bg-input:         #14183C;
  --bg-sidebar:       linear-gradient(180deg, #080f24 0%, #040b19 100%);
  --bg-topbar:        linear-gradient(180deg, #0b1830 0%, #071221 100%);
  --bg-overlay:       rgba(3, 8, 22, 0.88);
  --bg-tooltip:       rgba(18, 32, 58, 0.96);

  /* ── Borders ──────────────────────────────────────────── */
  --border-card:      rgba(212, 168, 67, 0.24);
  --border-card-hover:rgba(212, 168, 67, 0.58);
  --border-input:     rgba(0, 180, 216, 0.22);
  --border-input-focus: rgba(0, 212, 255, 0.68);
  --border-subtle:    rgba(255, 255, 255, 0.058);
  --border-divider:   rgba(255, 255, 255, 0.09);

  /* ── Accent Colors ────────────────────────────────────── */
  --accent-gold:      #E0C04A;
  --accent-gold-dim:  rgba(212, 168, 67, 0.65);
  --accent-blue:      #00C3E6;
  --accent-blue-dim:  rgba(0, 195, 230, 0.65);
  --accent-cyan:      #00F0FF;
  --accent-green:     #00F28C;
  --accent-red:       #FF5E5E;
  --accent-orange:    #FFA726;
  --accent-purple:    #C19FFF;

  /* ── Brain Colors ─────────────────────────────────────── */
  --brain-ethical:    #00C3E6;
  --brain-personal:   #F4C036;
  --brain-business:   #FF5E5E;

  /* ── Crystal Tiers ────────────────────────────────────── */
  --crystal-hot:      #FF5E5E;
  --crystal-warm:     #FFA726;
  --crystal-cold:     #00C3E6;
  --crystal-vault:    #E0C04A;
  --crystal-white:    #F8FAFC;

  /* ── Text ─────────────────────────────────────────────── */
  --text-primary:     #F8FAFC;
  --text-secondary:   #C7D2FE;
  --text-muted:       #64748B;
  --text-link:        #00C3E6;
  --text-gold:        #E0C04A;
  --text-success:     #00F28C;
  --text-error:       #FF5E5E;
  --text-warning:     #FFA726;

  /* ── Glows & Shadows — stronger depth & energy ────────── */
  --glow-gold:        0 0 28px rgba(224, 192, 74, 0.45), 0 0 56px rgba(224, 192, 74, 0.22);
  --glow-gold-strong: 0 0 48px rgba(224, 192, 74, 0.70), 0 0 96px rgba(224, 192, 74, 0.38);
  --glow-blue:        0 0 32px rgba(0, 195, 230, 0.50), 0 0 72px rgba(0, 195, 230, 0.25);
  --glow-blue-strong: 0 0 56px rgba(0, 195, 230, 0.75), 0 0 120px rgba(0, 195, 230, 0.40);
  --glow-cyan:        0 0 36px rgba(0, 240, 255, 0.58), 0 0 80px rgba(0, 240, 255, 0.30);
  --glow-green:       0 0 24px rgba(0, 242, 140, 0.45);
  --glow-red:         0 0 24px rgba(255, 94, 94, 0.48);

  --shadow-card:      0 10px 32px rgba(0, 0, 0, 0.62), inset 0 1px 3px rgba(255,255,255,0.05);
  --shadow-elevated:  0 22px 68px rgba(0, 0, 0, 0.75), 0 0 1px rgba(0, 195, 230, 0.18);
  --shadow-dropdown:  0 28px 90px rgba(0, 0, 0, 0.82), 0 0 2px rgba(224, 192, 74, 0.20);

  /* ── Glass Effects ────────────────────────────────────── */
  --glass-blur:       blur(16px);
  --glass-blur-heavy: blur(28px);

  /* ── Border Radius ────────────────────────────────────── */
  --radius-card:      18px;
  --radius-button:    10px;
  --radius-input:     10px;
  --radius-pill:      9999px;
  --radius-circle:    50%;

  /* ── Typography ───────────────────────────────────────── */
  --font-primary:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:        'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-size-xs:     0.72rem;
  --font-size-sm:     0.82rem;
  --font-size-base:   0.92rem;
  --font-size-md:     1rem;
  --font-size-lg:     1.15rem;
  --font-size-xl:     1.35rem;
  --font-size-2xl:    1.65rem;
  --font-size-3xl:    2rem;
  --font-weight-normal:    400;
  --font-weight-medium:    500;
  --font-weight-semibold:  600;
  --font-weight-bold:      700;
  --line-height-tight:     1.25;
  --line-height-normal:    1.55;
  --line-height-relaxed:   1.75;

  /* ── Spacing ──────────────────────────────────────────── */
  --space-xs:     5px;
  --space-sm:     9px;
  --space-md:     13px;
  --space-lg:     18px;
  --space-xl:     26px;
  --space-2xl:    36px;
  --space-3xl:    52px;

  /* ── Layout ───────────────────────────────────────────── */
  --sidebar-width:      268px;
  --sidebar-collapsed:  68px;
  --topbar-height:      66px;
  --right-panel-width:  392px;
  --touch-min:          52px;

  /* ── Transitions ──────────────────────────────────────── */
  --transition-smooth: all 0.34s cubic-bezier(0.32, 1.58, 0.66, 1.02);
  --transition-fast:   all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Z-Index ──────────────────────────────────────────── */
  --z-sidebar:    100;
  --z-topbar:     110;
  --z-dropdown:   200;
  --z-modal:      300;
  --z-toast:      400;
  --z-orb:        500;

  /* ── Surface States (Phase 36) ────────────────────────── */
  --surface-hover:     rgba(255, 255, 255, 0.09);
  --surface-primary:   #050b1a;
  --surface-secondary: #0a1325;
  --surface-active:    rgba(255, 255, 255, 0.12);
  --surface-2:         #0f1a33;

  /* ── Navy System (legacy compat) ──────────────────────── */
  --navy-deep:   #050b1a;
  --navy-mid:    #0a1325;
  --navy-light:  #0f1a33;
  --navy-border: rgba(255, 255, 255, 0.09);

  /* ── Color Shorthands ─────────────────────────────────── */
  --color-gold:  #E0C04A;
  --gold:        #E0C04A;
  --blue:        #00C3E6;
  --cyan:        #00F0FF;
  --green:       #00F28C;
  --red:         #FF5E5E;

  /* ── Dimmed Variants ──────────────────────────────────── */
  --gold-dim:    rgba(224, 192, 74, 0.6);
  --cyan-dim:    rgba(0, 240, 255, 0.6);
  --green-dim:   rgba(0, 242, 140, 0.6);
  --red-dim:     rgba(255, 94, 94, 0.6);
  --text-dim:    rgba(248, 250, 252, 0.4);

  /* ── Glow Variants ────────────────────────────────────── */
  --gold-glow:            0 0 28px rgba(224, 192, 74, 0.45);
  --cyan-glow:            0 0 36px rgba(0, 240, 255, 0.5);
  --shadow-glow:          0 0 24px rgba(0, 195, 230, 0.25);
  --brain-ethical-glow:   0 0 20px rgba(0, 195, 230, 0.4);
  --brain-personal-glow:  0 0 20px rgba(244, 192, 54, 0.4);
  --brain-business-glow:  0 0 20px rgba(255, 94, 94, 0.4);

  /* ── Border & Radius Shorthands ───────────────────────── */
  --border:         rgba(255, 255, 255, 0.09);
  --border-primary: rgba(224, 192, 74, 0.35);
  --radius:         12px;
  --radius-xs:      4px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      18px;
  --radius-xl:      24px;
  --radius-2xl:     32px;
  --radius-full:    9999px;

  /* ── Accent Shorthands ────────────────────────────────── */
  --accent:       #E0C04A;
  --accent-hover: rgba(224, 192, 74, 0.82);

  /* ── Font Compat ──────────────────────────────────────── */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* ── Transition Compat ────────────────────────────────── */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Text Tertiary ────────────────────────────────────── */
  --text-tertiary: #64748B;

  /* ── MIG Design System Upgrade tokens (Phase 93.5) ──── */
  --mig-gold: #E0C04A;
  --mig-gold-bright: #FFD700;
  --mig-gold-dim: rgba(224,192,74,0.6);
  --mig-gold-border: rgba(212,168,67,0.35);
  --mig-gold-border-hover: rgba(212,168,67,0.65);
  --mig-gold-glow-sm: 0 0 12px rgba(224,192,74,0.3);
  --mig-gold-glow-md: 0 0 28px rgba(224,192,74,0.45);
  --mig-gold-glow-lg: 0 0 48px rgba(224,192,74,0.7), 0 0 96px rgba(224,192,74,0.35);
  --mig-space-bg: #000008;
  --mig-space-deep: #020410;
  --mig-circuit-stroke: rgba(212,168,67,0.4);
  --mig-circuit-width: 2px;
  --mig-glass-gold: rgba(10,15,40,0.8);
  --mig-glass-border: rgba(212,168,67,0.3);
  --mig-glass-blur: blur(20px);
  --mig-toggle-gold-bg: rgba(224,192,74,0.15);
  --mig-toggle-gold-border: var(--accent-gold);
  --mig-featured-glow: 0 0 32px rgba(224,192,74,0.5), 0 0 64px rgba(224,192,74,0.2);
  --mig-glow-duration: 0.3s;
  --mig-glow-ease: cubic-bezier(0.4,0,0.2,1);

  /* ── Phase 106 — Adaptive theme transition tokens ── */
  --star-opacity: 1;
  --atmospheric-bottom: rgba(212,168,67,0.12);

  /* ── Phase 106 — Standardized theme surface variables (night defaults) ── */
  --nav-bg:           linear-gradient(180deg, #080A18 0%, #060812 100%);
  --nav-text:         #E8E4D9;
  --dropdown-bg:      #0F1228;
  --dropdown-text:    #E8E4D9;
  --input-bg:         #14183C;
  --border-color:     rgba(212, 168, 67, 0.18);
  --accent-color:     #E0C04A;
  --shadow-color:     rgba(0, 0, 0, 0.5);
  --glow-color:       rgba(212, 168, 67, 0.4);
  --btn-bg:           #E0C04A;
  --btn-text:         #05060F;
  --chat-bg:          #0D102D;

  /* ── Phase 96 — Platform-wide dark/light redesign tokens ── */
  /* Backgrounds */
  --mig-bg-primary: #000008;
  --mig-bg-secondary: #05050f;
  --mig-bg-panel: #0D102D;
  --mig-bg-panel-hover: #121637;
  --mig-bg-sidebar: #080A1C;

  /* Gold sovereign palette */
  --mig-gold-glow: 0 0 20px rgba(212,168,67,0.5), 0 0 60px rgba(212,168,67,0.2);

  /* Text */
  --mig-text-primary: #eeeef5;
  --mig-text-secondary: #b0b0cc;
  --mig-text-muted: #7070a0;
  --mig-text-on-gold: #000010;
  --mig-text-on-panel: #eeeef5;

  /* Panels — solid opaque backgrounds, no bleed-through */
  --mig-panel-bg: #0D102D;
  --mig-panel-border: 1px solid rgba(212, 168, 67, 0.25);
  --mig-panel-blur: blur(18px);
  --mig-panel-shadow: 0 8px 32px rgba(0,0,0,0.6);

  /* Panel hover glow — gold */
  --mig-panel-hover-border: 1px solid rgba(212, 168, 67, 0.65);
  --mig-panel-hover-shadow: 0 0 24px rgba(212,168,67,0.35), 0 0 60px rgba(212,168,67,0.12);
  --mig-panel-hover-transform: translateY(-2px);

  /* Accent colors */
  --mig-cyan: #00d4ff;
  --mig-success: #00e87a;
  --mig-warning: #ffaa00;
  --mig-danger: #ff4455;

  /* Galaxy */
  --mig-galaxy-opacity: 1;
  --mig-star-opacity: 1;

  /* ═══════════════════════════════════════
     MIGESTI TYPOGRAPHY SCALE
     Consistent. Sovereign. Precise.
     ═══════════════════════════════════════ */

  /* Font family */
  --mig-font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --mig-font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Type scale — refined sovereign precision */
  --text-xs:   0.72rem;   /* ~11.5px — labels, badges */
  --text-sm:   0.82rem;   /* ~13px   — secondary text, captions */
  --text-base: 0.92rem;   /* ~14.7px — body text */
  --text-md:   1rem;      /* 16px    — subheadings */
  --text-lg:   1.15rem;   /* ~18.4px — section headings */
  --text-xl:   1.35rem;   /* ~21.6px — page headings */
  --text-2xl:  1.65rem;   /* ~26.4px — hero headings */
  --text-3xl:  2rem;      /* 32px    — display headings */
  --text-4xl:  2.5rem;    /* 40px    — hero display */

  /* Font weights */
  --weight-light:   300;
  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semibold:600;
  --weight-bold:    700;
  --weight-black:   900;

  /* Font weight aliases (Precisional Greatness) */
  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;
  --font-black:    800;

  /* Line heights */
  --leading-tight:  1.25;
  --leading-normal: 1.55;
  --leading-relaxed:1.75;

  /* Letter spacing */
  --tracking-tight:  -0.025em;
  --tracking-normal:  0;
  --tracking-wide:    0.04em;
  --tracking-wider:   0.08em;
  --tracking-widest:  0.14em;

  /* ═══════════════════════════════════════
     SHADOW SCALE (Precisional Greatness)
     ═══════════════════════════════════════ */
  --shadow-xs:  0 1px 3px rgba(0,0,0,0.12);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.18);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.25);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.35);
  --shadow-xl:  0 16px 64px rgba(0,0,0,0.45);
  --shadow-2xl: 0 24px 80px rgba(0,0,0,0.55);

  /* ═══════════════════════════════════════
     BLUR SCALE (Precisional Greatness)
     ═══════════════════════════════════════ */
  --blur-sm:  blur(8px);
  --blur-md:  blur(16px);
  --blur-lg:  blur(32px);
  --blur-xl:  blur(64px);

  /* ═══════════════════════════════════════
     MIGESTI ICON SCALE
     ═══════════════════════════════════════ */

  --icon-xs:   12px;  /* inline tiny icons */
  --icon-sm:   16px;  /* inline text icons */
  --icon-base: 20px;  /* nav icons, button icons */
  --icon-md:   24px;  /* standard UI icons */
  --icon-lg:   32px;  /* section icons */
  --icon-xl:   48px;  /* feature icons */
  --icon-2xl:  64px;  /* hero/display icons */
}

/* ═══════════════════════════════════════════════════════════════
   NIGHT MODE — Deep Space Command Bridge
   Panels like illuminated ship windows. Stars visible.
   ═══════════════════════════════════════════════════════════════ */
[data-theme="night"] {
  --star-opacity: 1;
  --atmospheric-bottom: rgba(80,100,255,0.06);
  --bg-primary:       #05060F;
  --bg-secondary:     #0D1035;
  --bg-tertiary:      #141840;
  --bg-space:         radial-gradient(ellipse at 50% 0%, #0D1035 0%, #05060F 70%);
  --bg-card:          #0D102D;
  --bg-card-hover:    #121637;
  --bg-frosted:       #0D102D;
  --bg-input:         #14183C;
  --bg-sidebar:       #080A1C;
  --bg-topbar:        #080A1C;
  --bg-overlay:       #05060F;
  --nav-bg:           #080A1C;
  --nav-text:         #E8E4FF;
  --panel-bg:         #0D102D;
  --dropdown-bg:      #0E1130;
  --dropdown-text:    #E8E4FF;
  --input-bg:         #14183C;
  --glow:             rgba(80, 100, 255, 0.08);

  --border-card:      rgba(100, 120, 255, 0.15);
  --border-card-hover:rgba(100, 120, 255, 0.35);
  --border-input:     rgba(100, 120, 255, 0.18);
  --border-input-focus: rgba(0, 212, 255, 0.55);
  --border-subtle:    rgba(100, 120, 255, 0.08);
  --border-divider:   rgba(100, 120, 255, 0.10);
  --border-primary:   rgba(100, 120, 255, 0.15);
  --border:           rgba(100, 120, 255, 0.08);
  --border-color:     rgba(100, 120, 255, 0.15);
  --panel-border:     1px solid rgba(100, 120, 255, 0.15);

  --text-primary:     #E8E4FF;
  --text-secondary:   #9896C0;
  --text-muted:       #6B6996;
  --text-link:        #00d4ff;
  --text-gold:        #E0C04A;
  --text-success:     #00F28C;
  --text-error:       #FF5E5E;
  --text-warning:     #FFA726;

  --accent-gold:      #E0C04A;
  --accent-cyan:      #00F0FF;
  --accent-blue:      #6B8AFF;
  --accent-green:     #00F28C;
  --accent-red:       #FF5E5E;
  --accent-color:     #E0C04A;

  --shadow-card:      0 10px 40px rgba(0, 0, 0, 0.65), 0 0 1px rgba(100,120,255,0.15);
  --shadow-elevated:  0 22px 68px rgba(0, 0, 0, 0.8);
  --glow-gold:        0 0 28px rgba(224, 192, 74, 0.4), 0 0 56px rgba(224, 192, 74, 0.18);
  --surface-hover:    rgba(100, 120, 255, 0.08);

  --mig-galaxy-opacity: 1;
  --mig-star-opacity: 1;
  --mig-bg-primary:   #05060F;
  --mig-bg-secondary: #0D1035;
  --mig-bg-panel:     #0D102D;
  --mig-bg-sidebar:   #080A1C;
  --mig-text-primary: #E8E4FF;
  --mig-text-secondary: #9896C0;
  --mig-text-muted:   #6B6996;
  --mig-text-on-gold: #05060F;
  --mig-text-on-panel: #E8E4FF;
  --mig-panel-bg:     #0D102D;
  --mig-panel-border: 1px solid rgba(100, 120, 255, 0.15);
  --mig-panel-shadow: 0 10px 40px rgba(0,0,0,0.65);
  --mig-gold:         #E0C04A;
  --mig-gold-bright:  #FFD700;
  --mig-gold-dim:     rgba(224,192,74,0.25);
  --mig-gold-glow:    0 0 20px rgba(224,192,74,0.4);
  --sidebar-bg:       #080A1C;
  --sidebar-border:   1px solid rgba(100,120,255,0.10);
  --topbar-bg:        #080A1C;
  --topbar-border:    1px solid rgba(100,120,255,0.10);
  --gold:             #E0C04A;
  --color-gold:       #E0C04A;
  --accent:           #E0C04A;
  --shadow-color:     rgba(0, 0, 0, 0.6);
  --glow-color:       rgba(224, 192, 74, 0.4);
  --btn-bg:           #E0C04A;
  --btn-text:         #05060F;
  --chat-bg:          #0D102D;
  --surface-secondary: #0D102D;
  --surface-active:   rgba(100, 120, 255, 0.12);
}

/* ═══════════════════════════════════════════════════════════════
   SUNRISE MODE — Golden Hour Morning Light
   Warm amber light flooding every surface. Hopeful. Golden hour.
   ═══════════════════════════════════════════════════════════════ */
[data-theme="sunrise"] {
  --star-opacity: 0;
  --atmospheric-bottom: rgba(255,160,50,0.10);
  --bg-primary:       #FFF8F0;
  --bg-secondary:     #FFF3E6;
  --bg-tertiary:      #FFEDD9;
  --bg-space:         linear-gradient(180deg, #FF8C42 0%, #FFB347 15%, #FFD97D 35%, #FFF0C0 60%, #FFF8F0 100%);
  --bg-card:          #FFF8EB;
  --bg-card-hover:    #FFF2DC;
  --bg-frosted:       #FFF8EB;
  --bg-input:         #FFFCF5;
  --bg-sidebar:       #FFEBC8;
  --bg-topbar:        #FFEBC8;
  --bg-overlay:       #FFF8F0;
  --nav-bg:           #FFEBC8;
  --nav-text:         #1A0F00;
  --panel-bg:         #FFF8EB;
  --dropdown-bg:      #FFFCF5;
  --dropdown-text:    #1A0F00;
  --input-bg:         #FFFCF5;
  --glow:             rgba(255, 160, 50, 0.1);

  --border-card:      rgba(212, 140, 60, 0.2);
  --border-card-hover:rgba(212, 140, 60, 0.45);
  --border-input:     rgba(212, 140, 60, 0.18);
  --border-input-focus: rgba(212, 140, 60, 0.55);
  --border-subtle:    rgba(212, 140, 60, 0.10);
  --border-divider:   rgba(212, 140, 60, 0.15);
  --border-primary:   rgba(212, 140, 60, 0.20);
  --border:           rgba(212, 140, 60, 0.10);
  --border-color:     rgba(212, 140, 60, 0.20);
  --panel-border:     1px solid rgba(212, 140, 60, 0.15);

  --text-primary:     #1A0F00;
  --text-secondary:   #6B4E30;
  --text-muted:       #9B7A58;
  --text-link:        #C87520;
  --text-gold:        #C87520;
  --text-success:     #2E7D32;
  --text-error:       #C62828;
  --text-warning:     #C87520;

  --accent-gold:      #C87520;
  --accent-blue:      #B86510;
  --accent-cyan:      #B86510;
  --accent-green:     #2E7D32;
  --accent-red:       #C62828;
  --accent-color:     #C87520;

  --shadow-card:      0 4px 20px rgba(150, 100, 40, 0.12), inset 0 1px 3px rgba(255,255,255,0.5);
  --shadow-elevated:  0 12px 40px rgba(150, 100, 40, 0.15);
  --glow-gold:        0 0 16px rgba(200, 117, 32, 0.25);
  --surface-hover:    rgba(212, 140, 60, 0.08);

  --mig-bg-primary:   #FFF8F0;
  --mig-bg-secondary: #FFF3E6;
  --mig-bg-panel:     #FFF8EB;
  --mig-bg-sidebar:   #FFEBC8;
  --mig-text-primary: #1A0F00;
  --mig-text-secondary: #6B4E30;
  --mig-text-muted:   #9B7A58;
  --mig-text-on-gold: #FFF8F0;
  --mig-text-on-panel: #1A0F00;
  --mig-panel-bg:     #FFF8EB;
  --mig-panel-border: 1px solid rgba(212, 140, 60, 0.20);
  --mig-panel-shadow: 0 2px 12px rgba(150, 100, 40, 0.10);
  --mig-gold:         #8B6200;
  --mig-gold-bright:  #6B4800;
  --mig-gold-dim:     rgba(139, 98, 0, 0.20);
  --mig-gold-glow:    0 0 12px rgba(139,98,0,0.20);
  --mig-galaxy-opacity: 0;
  --mig-star-opacity: 0;
  --sidebar-bg:       #FFEBC8;
  --topbar-bg:        #FFEBC8;
  --sidebar-border:   1px solid rgba(212, 140, 60, 0.12);
  --topbar-border:    1px solid rgba(212, 140, 60, 0.12);
  --gold:             #C87520;
  --color-gold:       #C87520;
  --accent:           #C87520;
  --shadow-color:     rgba(120, 80, 20, 0.12);
  --glow-color:       rgba(200, 117, 32, 0.3);
  --btn-bg:           #C87520;
  --btn-text:         #FFFFFF;
  --chat-bg:          #FFF8EB;
  --surface-secondary: #FFF3E6;
  --surface-active:   rgba(212, 140, 60, 0.12);
}

/* ═══════════════════════════════════════════════════════════════
   DAY MODE — Clear Blue Sky. Crisp. Clean.
   Like working next to a floor-to-ceiling window on a perfect day.
   ═══════════════════════════════════════════════════════════════ */
[data-theme="day"] {
  --star-opacity: 0;
  --atmospheric-bottom: transparent;
  --bg-primary:       #F0F4FF;
  --bg-secondary:     #E4EBFA;
  --bg-tertiary:      #D6DFF2;
  --bg-space:         linear-gradient(180deg, #1A6FD4 0%, #3B8FE8 20%, #7BB8F5 45%, #C8E0FF 70%, #EEF4FF 100%);
  --bg-card:          #F5F9FF;
  --bg-card-hover:    #EDF3FF;
  --bg-frosted:       #F5F9FF;
  --bg-input:         #FFFFFF;
  --bg-sidebar:       #E1EEFF;
  --bg-topbar:        #E1EEFF;
  --bg-overlay:       #F0F4FF;
  --nav-bg:           #E1EEFF;
  --nav-text:         #0A1628;
  --panel-bg:         #F5F9FF;
  --dropdown-bg:      #FFFFFF;
  --dropdown-text:    #0A1628;
  --input-bg:         #FFFFFF;
  --glow:             rgba(30, 120, 255, 0.06);

  --border-card:      rgba(30, 100, 200, 0.12);
  --border-card-hover:rgba(30, 100, 200, 0.25);
  --border-input:     rgba(30, 100, 200, 0.15);
  --border-input-focus: rgba(37, 99, 235, 0.50);
  --border-subtle:    rgba(30, 100, 200, 0.06);
  --border-divider:   rgba(30, 100, 200, 0.08);
  --border-primary:   rgba(30, 100, 200, 0.12);
  --border:           rgba(30, 100, 200, 0.08);
  --border-color:     rgba(30, 100, 200, 0.12);
  --panel-border:     1px solid rgba(30, 100, 200, 0.08);

  --text-primary:     #0A1628;
  --text-secondary:   #3D5068;
  --text-muted:       #6B8099;
  --text-link:        #2563EB;
  --text-gold:        #92690A;
  --text-success:     #16A34A;
  --text-error:       #DC2626;
  --text-warning:     #D97706;

  --accent-gold:      #92690A;
  --accent-blue:      #2563EB;
  --accent-cyan:      #0891B2;
  --accent-green:     #16A34A;
  --accent-red:       #DC2626;
  --accent-color:     #2563EB;

  --shadow-card:      0 2px 12px rgba(0, 0, 0, 0.06), inset 0 1px 2px rgba(255,255,255,0.7);
  --shadow-elevated:  0 8px 30px rgba(0, 0, 0, 0.10);
  --glow-gold:        0 0 12px rgba(146, 105, 10, 0.18);
  --surface-hover:    rgba(30, 100, 200, 0.05);

  --mig-bg-primary:   #F0F4FF;
  --mig-bg-secondary: #E4EBFA;
  --mig-bg-panel:     #F5F9FF;
  --mig-bg-sidebar:   #E1EEFF;
  --mig-text-primary: #0A1628;
  --mig-text-secondary: #3D5068;
  --mig-text-muted:   #6B8099;
  --mig-text-on-gold: #FFFFFF;
  --mig-text-on-panel: #0A1628;
  --mig-panel-bg:     #F5F9FF;
  --mig-panel-border: 1px solid rgba(30, 100, 200, 0.12);
  --mig-panel-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  --mig-gold:         #92690A;
  --mig-gold-bright:  #7A5808;
  --mig-gold-dim:     rgba(146, 105, 10, 0.12);
  --mig-gold-glow:    0 0 10px rgba(146, 105, 10, 0.12);
  --mig-galaxy-opacity: 0;
  --mig-star-opacity: 0;
  --sidebar-bg:       #E1EEFF;
  --topbar-bg:        #E1EEFF;
  --sidebar-border:   1px solid rgba(30, 100, 200, 0.08);
  --topbar-border:    1px solid rgba(30, 100, 200, 0.08);
  --gold:             #92690A;
  --color-gold:       #92690A;
  --accent:           #2563EB;
  --shadow-color:     rgba(0, 0, 0, 0.08);
  --glow-color:       rgba(37, 99, 235, 0.2);
  --btn-bg:           #2563EB;
  --btn-text:         #FFFFFF;
  --chat-bg:          #F5F9FF;
  --surface-secondary: #E4EBFA;
  --surface-active:   rgba(30, 100, 200, 0.10);
}

/* ═══════════════════════════════════════════════════════════════
   SUNSET MODE — Cinematic Burning Horizon
   Dramatic. Deep warmth. Like watching the sun go down
   from a high rise.
   ═══════════════════════════════════════════════════════════════ */
[data-theme="sunset"] {
  --star-opacity: 0.3;
  --atmospheric-bottom: rgba(255,80,0,0.08);
  --bg-primary:       #0D0500;
  --bg-secondary:     #1E0A02;
  --bg-tertiary:      #2D1005;
  --bg-space:         linear-gradient(180deg, #0D0500 0%, #3D1200 15%, #8B2500 30%, #D44000 45%, #FF6B1A 55%, #FF9B4A 65%, #FFD08A 75%, #1A0800 100%);
  --bg-card:          #1E0A02;
  --bg-card-hover:    #2A0F04;
  --bg-frosted:       #1E0A02;
  --bg-input:         #280F03;
  --bg-sidebar:       #140600;
  --bg-topbar:        #140600;
  --bg-overlay:       #0D0500;
  --nav-bg:           #140600;
  --nav-text:         #FFE8CC;
  --panel-bg:         #1E0A02;
  --dropdown-bg:      #280F03;
  --dropdown-text:    #FFE8CC;
  --input-bg:         #280F03;
  --glow:             rgba(255, 80, 0, 0.08);

  --border-card:      rgba(255, 100, 20, 0.2);
  --border-card-hover:rgba(255, 100, 20, 0.4);
  --border-input:     rgba(255, 100, 20, 0.18);
  --border-input-focus: rgba(255, 120, 40, 0.50);
  --border-subtle:    rgba(255, 100, 20, 0.08);
  --border-divider:   rgba(255, 100, 20, 0.12);
  --border-primary:   rgba(255, 100, 20, 0.20);
  --border:           rgba(255, 100, 20, 0.08);
  --border-color:     rgba(255, 100, 20, 0.20);
  --panel-border:     1px solid rgba(255,100,20,0.15);

  --text-primary:     #FFE8CC;
  --text-secondary:   #CC9F72;
  --text-muted:       #997558;
  --text-link:        #FF9A3C;
  --text-gold:        #FF9A3C;
  --text-success:     #66BB6A;
  --text-error:       #FF5252;
  --text-warning:     #FF9A3C;

  --accent-gold:      #FF9A3C;
  --accent-blue:      #FF6B9D;
  --accent-cyan:      #FF6B9D;
  --accent-green:     #66BB6A;
  --accent-red:       #FF5252;
  --accent-color:     #FF9A3C;

  --shadow-card:      0 6px 24px rgba(0, 0, 0, 0.55), 0 0 1px rgba(255,100,20,0.15);
  --shadow-elevated:  0 14px 48px rgba(0, 0, 0, 0.70);
  --glow-gold:        0 0 20px rgba(255, 100, 20, 0.35);
  --surface-hover:    rgba(255, 100, 20, 0.08);

  --mig-bg-primary:   #0D0500;
  --mig-bg-secondary: #1E0A02;
  --mig-bg-panel:     #1E0A02;
  --mig-bg-sidebar:   #140600;
  --mig-text-primary: #FFE8CC;
  --mig-text-secondary: #CC9F72;
  --mig-text-muted:   #997558;
  --mig-text-on-gold: #0D0500;
  --mig-text-on-panel: #FFE8CC;
  --mig-panel-bg:     #1E0A02;
  --mig-panel-border: 1px solid rgba(255, 100, 20, 0.20);
  --mig-panel-shadow: 0 6px 24px rgba(0,0,0,0.55);
  --mig-gold:         #FF9A3C;
  --mig-gold-bright:  #FFB366;
  --mig-gold-dim:     rgba(255, 100, 20, 0.25);
  --mig-gold-glow:    0 0 16px rgba(255,100,20,0.35);
  --mig-galaxy-opacity: 0;
  --mig-star-opacity: 0;
  --sidebar-bg:       #140600;
  --topbar-bg:        #140600;
  --sidebar-border:   1px solid rgba(255,100,20,0.12);
  --topbar-border:    1px solid rgba(255,100,20,0.12);
  --gold:             #FF9A3C;
  --color-gold:       #FF9A3C;
  --accent:           #FF9A3C;
  --shadow-color:     rgba(0, 0, 0, 0.55);
  --glow-color:       rgba(255, 100, 20, 0.35);
  --btn-bg:           #FF9A3C;
  --btn-text:         #0D0500;
  --chat-bg:          #1E0A02;
  --surface-secondary: #1E0A02;
  --surface-active:   rgba(255, 100, 20, 0.12);
}


/* ═══════════════════════════════════════════════════════════════
   IMMERSIVE SKY — Body background IS the sky gradient.
   No pseudo-element needed; body bg sits behind everything.
   ═══════════════════════════════════════════════════════════════ */
body {
  background: var(--bg-space, var(--bg-primary)) !important;
  transition: background 1.2s ease;
}


/* ═══════════════════════════════════════════════════════════════
   UNIVERSAL SURFACE FIX — COMPREHENSIVE
   Every panel, card, surface, container, dropdown, input gets a
   SOLID opaque theme-responsive background. !important on both
   background AND color. Zero bleed-through. Zero invisible text.
   ═══════════════════════════════════════════════════════════════ */

/* ── Global text inheritance ── */
body {
  color: var(--text-primary) !important;
}

/* ── All panel/card/surface classes — SOLID backgrounds ── */
.mig-card,
.mig-panel,
.crystal-panel,
.dashboard-panel,
.dashboard-widget,
.dashboard-card,
.news-panel,
.web-viewer-panel,
.eomi-panel,
.eomi-card,
.eomi-hub-card,
.vault-panel,
.vault-card,
.crystal-vault,
.deep-dive-panel,
.eomi-chat-panel,
.chat-panel,
.chat-container,
.chat-box,
.bom-panel,
.estimating-panel,
.field-sync-panel,
.report-panel,
.project-card,
.project-panel,
.settings-panel,
.settings-card,
.mig-workspace-card,
.workspace-content,
.tab-content,
.tab-panel {
  background: var(--panel-bg) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-card) !important;
}

/* ── Navigation surfaces ── */
.mig-sidebar,
.sidebar-nav {
  background: var(--nav-bg) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}

.mig-topbar,
.toolbar,
.mig-toolbar,
.header {
  background: var(--nav-bg) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}

/* ── Main content area ── */
.mig-main {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ── Dropdowns ── */
.mig-dropdown,
.dropdown-menu,
.dropdown-content {
  background: var(--dropdown-bg) !important;
  color: var(--dropdown-text) !important;
  border-color: var(--border-card) !important;
}
select option {
  background: var(--panel-bg) !important;
  color: var(--text-primary) !important;
}

/* ── Inputs ── */
input, textarea, select {
  background: var(--input-bg, var(--bg-input)) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-input) !important;
}
::placeholder {
  color: var(--text-muted) !important;
  opacity: 1;
}

/* ── Modals & drawers ── */
.crystal-modal,
.mig-modal,
.modal-content,
.drawer {
  background: var(--panel-bg) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-card) !important;
}

/* ── Text visibility — every text element readable in every theme ── */
p, h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary) !important;
}
span, label, td, th, li, dt, dd, figcaption, legend, summary {
  color: inherit !important;
}
a {
  color: var(--accent-color, var(--accent-gold)) !important;
}
a:hover {
  opacity: 0.85;
}

/* ── Sidebar nav items ── */
.mig-nav-item,
.mig-sidebar a,
.mig-sidebar span,
.mig-sidebar label {
  color: var(--nav-text) !important;
}

/* ── Back bar (fixed nav at top of sub-pages) ── */
#mig-back-bar {
  background: var(--nav-bg) !important;
  border-bottom-color: var(--border-subtle) !important;
}
#mig-back-bar a,
#mig-back-bar span {
  color: var(--nav-text) !important;
}


/* ═══════════════════════════════════════════════════════════════
   WEATHER LAYER MODIFICATIONS
   Applied via body classes from weather_layer.js.
   Uses CSS variable overrides on the star canvas since
   body::before was removed (sky is now body background).
   ═══════════════════════════════════════════════════════════════ */

body.weather-clear {}

body.weather-partly-cloudy #mig-galaxy-canvas,
body.weather-partly-cloudy .mig-star-canvas {
  filter: saturate(0.85) brightness(0.95);
}

body.weather-overcast #mig-galaxy-canvas,
body.weather-overcast .mig-star-canvas {
  filter: saturate(0.5) brightness(0.85);
}
body.weather-overcast {
  --glow: transparent;
}

body.weather-rain #mig-galaxy-canvas,
body.weather-rain .mig-star-canvas {
  filter: saturate(0.4) brightness(0.7);
}

body.weather-snow #mig-galaxy-canvas,
body.weather-snow .mig-star-canvas {
  filter: saturate(0.3) brightness(1.1);
}

body.weather-storm #mig-galaxy-canvas,
body.weather-storm .mig-star-canvas {
  filter: saturate(0.2) brightness(0.55) contrast(1.2);
}
body.weather-storm {
  --glow: rgba(120, 100, 180, 0.06);
}


/* ═══════════════════════════════════════════════════════════════
   GLOBAL THEME TRANSITION (Phase 106)
   Smooth transition between all themes
   ═══════════════════════════════════════════════════════════════ */
html, body,
.mig-sidebar, .mig-topbar, .mig-card, .mig-workspace-card,
.mig-nav-item, .mig-btn--primary, .mig-btn--gold,
.eomi-chat-panel, .crystal-panel, .mig-panel,
.eomi-card, .crystal-modal, .mig-modal,
.dashboard-panel, .mig-main, #mig-back-bar,
input, textarea, select {
  transition: background 2s ease, color 2s ease, border-color 2s ease,
              box-shadow 2s ease, background-color 2s ease, filter 3s ease;
}
