﻿:root {
  /* Color channels (RGB values without commas) */
  --color-bg-rgb: 244 241 234;
  --color-surface-rgb: 255 255 255;
  --color-surface-strong-rgb: 249 247 242;
  --color-text-rgb: 15 33 61;
  --color-text-soft-rgb: 91 108 134;
  --color-primary-rgb: 16 42 84;
  --color-primary-strong-rgb: 11 31 63;
  --color-accent-rgb: 201 163 90;
  --color-accent-strong-rgb: 158 124 62;
  --color-danger-rgb: 182 57 57;
  --color-success-rgb: 31 122 77;
  --color-danger-soft-rgb: 254 242 242;
  --color-danger-text-rgb: 185 28 28;
  --color-success-soft-rgb: 236 253 245;
  --color-success-text-rgb: 22 101 52;
  --color-warning-rgb: 180 130 40;
  --color-warning-soft-rgb: 254 252 232;
  --color-warning-text-rgb: 146 64 14;
  --color-info-rgb: 59 130 246;
  --color-info-soft-rgb: 239 246 255;
  --color-info-text-rgb: 29 78 216;
  --color-neutral-rgb: 100 116 139;
  --color-neutral-soft-rgb: 241 245 249;
  --color-neutral-text-rgb: 51 65 85;
  --color-chart-1-rgb: 16 42 84;
  --color-chart-2-rgb: 201 163 90;
  --color-chart-3-rgb: 59 130 246;
  --color-chart-4-rgb: 139 92 246;
  --color-chart-5-rgb: 31 122 77;
  --color-chart-6-rgb: 20 184 166;
  --color-chart-7-rgb: 182 57 57;
  --color-gradient-warm-rgb: 201 163 90;
  --color-gradient-cool-rgb: 16 42 84;
  --color-focus-ring-rgb: 59 130 246;
  --color-login-bg-rgb: 10 15 30;
  --color-login-bg-mid-rgb: 26 31 53;
  
  /* Computed colors */
  --color-bg: rgb(var(--color-bg-rgb));
  --color-surface: rgb(var(--color-surface-rgb));
  --color-surface-strong: rgb(var(--color-surface-strong-rgb));
  --color-text: rgb(var(--color-text-rgb));
  --color-text-soft: rgb(var(--color-text-soft-rgb));
  --color-primary: rgb(var(--color-primary-rgb));
  --color-primary-strong: rgb(var(--color-primary-strong-rgb));
  --color-accent: rgb(var(--color-accent-rgb));
  --color-accent-strong: rgb(var(--color-accent-strong-rgb));
  --color-danger: rgb(var(--color-danger-rgb));
  --color-success: rgb(var(--color-success-rgb));
  --color-danger-soft: rgb(var(--color-danger-soft-rgb));
  --color-danger-text: rgb(var(--color-danger-text-rgb));
  --color-success-soft: rgb(var(--color-success-soft-rgb));
  --color-success-text: rgb(var(--color-success-text-rgb));
  --color-warning: rgb(var(--color-warning-rgb));
  --color-warning-soft: rgb(var(--color-warning-soft-rgb));
  --color-warning-text: rgb(var(--color-warning-text-rgb));
  --color-info: rgb(var(--color-info-rgb));
  --color-info-soft: rgb(var(--color-info-soft-rgb));
  --color-info-text: rgb(var(--color-info-text-rgb));
  --color-neutral: rgb(var(--color-neutral-rgb));
  --color-neutral-soft: rgb(var(--color-neutral-soft-rgb));
  --color-neutral-text: rgb(var(--color-neutral-text-rgb));
  --color-chart-1: rgb(var(--color-chart-1-rgb));
  --color-chart-2: rgb(var(--color-chart-2-rgb));
  --color-chart-3: rgb(var(--color-chart-3-rgb));
  --color-chart-4: rgb(var(--color-chart-4-rgb));
  --color-chart-5: rgb(var(--color-chart-5-rgb));
  --color-chart-6: rgb(var(--color-chart-6-rgb));
  --color-chart-7: rgb(var(--color-chart-7-rgb));
  --color-gradient-warm: rgb(var(--color-gradient-warm-rgb));
  --color-gradient-cool: rgb(var(--color-gradient-cool-rgb));
  --color-focus-ring: rgb(var(--color-focus-ring-rgb));
  --color-login-bg: rgb(var(--color-login-bg-rgb));
  --color-login-bg-mid: rgb(var(--color-login-bg-mid-rgb));
  
  --color-border: rgba(15, 33, 61, 0.14);
  --color-border-strong: rgba(15, 33, 61, 0.24);
  --color-input-bg: rgb(255 255 255);
  --color-overlay: rgba(9, 18, 37, 0.55);
  --shadow-card: 0 8px 30px rgba(7, 16, 33, 0.08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition-fast: 150ms;
  --transition-base: 250ms;
  --transition-slow: 400ms;
  --easing-out: cubic-bezier(0.16, 1, 0.3, 1);
  --easing-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --sidebar-width-expanded: 272px;
  --sidebar-width-collapsed: 64px;

  /* Mobile layout and safe-area tokens */
  --bp-mobile: 640px;
  --bp-tablet: 768px;
  --bp-desktop: 1024px;
  --bp-wide: 1280px;

  --touch-target-min: 44px;
  --touch-target-comfortable: 48px;

  --bottom-nav-height: 72px;
  --bottom-nav-safe-area: env(safe-area-inset-bottom, 0px);

  --sheet-handle-height: 24px;
  --sheet-border-radius: 20px;

  --fab-size: 56px;
  --fab-offset-bottom: calc(var(--bottom-nav-height) + 16px + var(--bottom-nav-safe-area));

  --mobile-padding-x: 16px;
  --mobile-padding-y: 12px;
  --mobile-card-gap: 12px;

  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --color-bg-rgb: 9 18 37;
  --color-surface-rgb: 16 31 57;
  --color-surface-strong-rgb: 22 42 74;
  --color-text-rgb: 241 243 247;
  --color-text-soft-rgb: 191 208 239;
  --color-primary-rgb: 214 180 111;
  --color-primary-strong-rgb: 229 203 150;
  --color-accent-rgb: 183 146 79;
  --color-accent-strong-rgb: 215 183 115;
  --color-danger-rgb: 220 104 104;
  --color-success-rgb: 87 185 137;
  --color-danger-soft-rgb: 60 20 25;
  --color-danger-text-rgb: 252 165 165;
  --color-success-soft-rgb: 20 50 35;
  --color-success-text-rgb: 110 231 183;
  --color-warning-rgb: 215 183 115;
  --color-warning-soft-rgb: 45 35 15;
  --color-warning-text-rgb: 253 224 71;
  --color-info-rgb: 96 165 250;
  --color-info-soft-rgb: 15 30 60;
  --color-info-text-rgb: 147 197 253;
  --color-neutral-rgb: 148 163 184;
  --color-neutral-soft-rgb: 25 35 55;
  --color-neutral-text-rgb: 203 213 225;
  --color-chart-1-rgb: 214 180 111;
  --color-chart-2-rgb: 183 146 79;
  --color-chart-3-rgb: 96 165 250;
  --color-chart-4-rgb: 167 139 250;
  --color-chart-5-rgb: 87 185 137;
  --color-chart-6-rgb: 45 212 191;
  --color-chart-7-rgb: 220 104 104;
  --color-gradient-warm-rgb: 183 146 79;
  --color-gradient-cool-rgb: 96 165 250;
  --color-focus-ring-rgb: 96 165 250;
  --color-login-bg-rgb: 5 10 22;
  --color-login-bg-mid-rgb: 12 20 40;
  
  --color-bg: rgb(var(--color-bg-rgb));
  --color-surface: rgb(var(--color-surface-rgb));
  --color-surface-strong: rgb(var(--color-surface-strong-rgb));
  --color-text: rgb(var(--color-text-rgb));
  --color-text-soft: rgb(var(--color-text-soft-rgb));
  --color-primary: rgb(var(--color-primary-rgb));
  --color-primary-strong: rgb(var(--color-primary-strong-rgb));
  --color-accent: rgb(var(--color-accent-rgb));
  --color-accent-strong: rgb(var(--color-accent-strong-rgb));
  --color-danger: rgb(var(--color-danger-rgb));
  --color-success: rgb(var(--color-success-rgb));
  --color-danger-soft: rgb(var(--color-danger-soft-rgb));
  --color-danger-text: rgb(var(--color-danger-text-rgb));
  --color-success-soft: rgb(var(--color-success-soft-rgb));
  --color-success-text: rgb(var(--color-success-text-rgb));
  --color-warning: rgb(var(--color-warning-rgb));
  --color-warning-soft: rgb(var(--color-warning-soft-rgb));
  --color-warning-text: rgb(var(--color-warning-text-rgb));
  --color-info: rgb(var(--color-info-rgb));
  --color-info-soft: rgb(var(--color-info-soft-rgb));
  --color-info-text: rgb(var(--color-info-text-rgb));
  --color-neutral: rgb(var(--color-neutral-rgb));
  --color-neutral-soft: rgb(var(--color-neutral-soft-rgb));
  --color-neutral-text: rgb(var(--color-neutral-text-rgb));
  --color-chart-1: rgb(var(--color-chart-1-rgb));
  --color-chart-2: rgb(var(--color-chart-2-rgb));
  --color-chart-3: rgb(var(--color-chart-3-rgb));
  --color-chart-4: rgb(var(--color-chart-4-rgb));
  --color-chart-5: rgb(var(--color-chart-5-rgb));
  --color-chart-6: rgb(var(--color-chart-6-rgb));
  --color-chart-7: rgb(var(--color-chart-7-rgb));
  --color-gradient-warm: rgb(var(--color-gradient-warm-rgb));
  --color-gradient-cool: rgb(var(--color-gradient-cool-rgb));
  --color-focus-ring: rgb(var(--color-focus-ring-rgb));
  --color-login-bg: rgb(var(--color-login-bg-rgb));
  --color-login-bg-mid: rgb(var(--color-login-bg-mid-rgb));
  
  --color-border: rgba(191, 208, 239, 0.2);
  --color-border-strong: rgba(191, 208, 239, 0.34);
  --color-input-bg: rgb(22 42 74);
  --color-overlay: rgba(2, 8, 16, 0.72);
}

[data-theme="map-dark"] {
  --map-bg: #0d1421;
  --map-bg-card: #131d2e;
  --map-bg-sheet: #111827;
  --map-bg-surface: #1a2540;
  --map-teal: #4dd9c0;
  --map-gold: #e0b84d;
  --map-text: #f0f4ff;
  --map-text-2: #8da0bd;
  --map-border: rgba(255, 255, 255, 0.07);

  --color-bg-rgb: 13 20 33;
  --color-surface-rgb: 17 24 39;
  --color-surface-strong-rgb: 26 37 64;
  --color-text-rgb: 240 244 255;
  --color-text-soft-rgb: 141 160 189;
  --color-primary-rgb: 77 217 192;
  --color-primary-strong-rgb: 61 194 170;
  --color-accent-rgb: 224 184 77;
  --color-accent-strong-rgb: 203 164 58;
  --color-focus-ring-rgb: 77 217 192;

  --color-border: rgba(255, 255, 255, 0.07);
  --color-border-strong: rgba(255, 255, 255, 0.16);
  --color-input-bg: #1a2540;
  --color-overlay: rgba(4, 8, 16, 0.7);
}

/* ── AI processing animations ── */
@keyframes ai-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.8; }
}
.animate-ai-pulse {
  animation: ai-pulse 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .animate-ai-pulse { animation: none; }
}

/* ── Premium route-update animations ── */
@keyframes shimmer-sweep {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes pulse-ring-expand {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 122, 77, 0.35);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(31, 122, 77, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 122, 77, 0);
  }
}

@keyframes glow-breathe {
  0%, 100% {
    box-shadow: 0 0 8px 0 rgba(77, 217, 192, 0.15);
  }
  50% {
    box-shadow: 0 0 20px 4px rgba(77, 217, 192, 0.35);
  }
}

.animate-shimmer-sweep {
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(31, 122, 77, 0.12) 40%,
    rgba(31, 122, 77, 0.25) 50%,
    rgba(31, 122, 77, 0.12) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 1.8s ease-in-out;
}

.animate-pulse-ring {
  animation: pulse-ring-expand 1.2s cubic-bezier(0.16, 1, 0.3, 1) 2;
}

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

/* Persistent blink for changed stops — runs indefinitely until unmount */
@keyframes blink-changed {
  0%, 100% {
    border-color: var(--color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
  50% {
    border-color: var(--color-accent);
    box-shadow: 0 0 16px 2px rgba(201, 163, 90, 0.25);
  }
}

.animate-blink-changed {
  animation: blink-changed 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .animate-blink-changed {
    animation: none;
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 12px 1px rgba(201, 163, 90, 0.2) !important;
  }
}

/* Quick-Action LIVE dot – expanding ring pulse (box-shadow based) */
@keyframes qa-live-ring {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ── Routes workspace V2 — Premium command-deck tokens ── */
:root {
  --rw-deck-bg-rgb: 248 246 241;
  --rw-deck-surface-rgb: 255 255 255;
  --rw-deck-surface-alt-rgb: 244 241 234;
  --rw-deck-header-bg-rgb: 16 42 84;
  --rw-deck-header-text-rgb: 241 243 247;
  --rw-deck-header-accent-rgb: 201 163 90;
  --rw-deck-rail-bg-rgb: 249 247 242;
  --rw-deck-rail-border-rgb: 16 42 84;
  --rw-deck-stale-rgb: 180 130 40;
  --rw-deck-dirty-rgb: 182 57 57;
  --rw-deck-ready-rgb: 31 122 77;
  --rw-deck-focus-ring-rgb: 201 163 90;
  --rw-deck-glow-rgb: 201 163 90;

  --rw-deck-bg: rgb(var(--rw-deck-bg-rgb));
  --rw-deck-surface: rgb(var(--rw-deck-surface-rgb));
  --rw-deck-surface-alt: rgb(var(--rw-deck-surface-alt-rgb));
  --rw-deck-header-bg: rgb(var(--rw-deck-header-bg-rgb));
  --rw-deck-header-text: rgb(var(--rw-deck-header-text-rgb));
  --rw-deck-header-accent: rgb(var(--rw-deck-header-accent-rgb));
  --rw-deck-rail-bg: rgb(var(--rw-deck-rail-bg-rgb));
  --rw-deck-rail-border: rgb(var(--rw-deck-rail-border-rgb) / 0.12);
  --rw-deck-stale: rgb(var(--rw-deck-stale-rgb));
  --rw-deck-dirty: rgb(var(--rw-deck-dirty-rgb));
  --rw-deck-ready: rgb(var(--rw-deck-ready-rgb));
  --rw-deck-focus-ring: rgb(var(--rw-deck-focus-ring-rgb));
  --rw-deck-glow: rgb(var(--rw-deck-glow-rgb) / 0.12);
  --rw-deck-glow-strong: rgb(var(--rw-deck-glow-rgb) / 0.24);
}

[data-theme="dark"] {
  --rw-deck-bg-rgb: 9 18 37;
  --rw-deck-surface-rgb: 16 31 57;
  --rw-deck-surface-alt-rgb: 22 42 74;
  --rw-deck-header-bg-rgb: 12 24 48;
  --rw-deck-header-text-rgb: 241 243 247;
  --rw-deck-header-accent-rgb: 183 146 79;
  --rw-deck-rail-bg-rgb: 22 42 74;
  --rw-deck-rail-border-rgb: 183 146 79;
  --rw-deck-stale-rgb: 215 183 115;
  --rw-deck-dirty-rgb: 220 104 104;
  --rw-deck-ready-rgb: 87 185 137;
  --rw-deck-focus-ring-rgb: 183 146 79;
  --rw-deck-glow-rgb: 183 146 79;

  --rw-deck-bg: rgb(var(--rw-deck-bg-rgb));
  --rw-deck-surface: rgb(var(--rw-deck-surface-rgb));
  --rw-deck-surface-alt: rgb(var(--rw-deck-surface-alt-rgb));
  --rw-deck-header-bg: rgb(var(--rw-deck-header-bg-rgb));
  --rw-deck-header-text: rgb(var(--rw-deck-header-text-rgb));
  --rw-deck-header-accent: rgb(var(--rw-deck-header-accent-rgb));
  --rw-deck-rail-bg: rgb(var(--rw-deck-rail-bg-rgb));
  --rw-deck-rail-border: rgb(var(--rw-deck-rail-border-rgb) / 0.15);
  --rw-deck-stale: rgb(var(--rw-deck-stale-rgb));
  --rw-deck-dirty: rgb(var(--rw-deck-dirty-rgb));
  --rw-deck-ready: rgb(var(--rw-deck-ready-rgb));
  --rw-deck-focus-ring: rgb(var(--rw-deck-focus-ring-rgb));
  --rw-deck-glow: rgb(var(--rw-deck-glow-rgb) / 0.1);
  --rw-deck-glow-strong: rgb(var(--rw-deck-glow-rgb) / 0.2);
}

/* ── Command deck animations ── */
@keyframes deck-scan-line {
  0% { transform: translateY(-100%); opacity: 0; }
  10% { opacity: 0.4; }
  90% { opacity: 0.4; }
  100% { transform: translateY(100%); opacity: 0; }
}

@keyframes deck-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--rw-deck-glow); }
  50% { box-shadow: 0 0 20px 4px var(--rw-deck-glow-strong); }
}

.animate-deck-scan {
  animation: deck-scan-line 3s ease-in-out infinite;
}

.animate-deck-glow {
  animation: deck-glow-pulse 2.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .animate-deck-scan { animation: none; }
  .animate-deck-glow { animation: none; box-shadow: 0 0 12px 1px var(--rw-deck-glow); }
}

