/*
 * Gis Design System
 * Canonical visual layer with Apple Design Foundations:
 * Translucent materials, specular edge lighting, fluid spring physics,
 * optical sizing/tracking typography, and layered elevation.
 */

:root,
html[data-theme="light"] {
  /* Primitive palette */
  --color-navy-950: #080d1c;
  --color-navy-900: #0d1328;
  --color-navy-850: #111a36;
  --color-navy-800: #152247;
  --color-navy-750: #1b2b57;
  --color-blue-700: #1b38ad;
  --color-blue-600: #2449d8;
  --color-blue-500: #2f5bff;
  --color-blue-400: #5275ff;
  --color-blue-300: #7b8cff;
  --color-blue-100: #eaf1ff;
  --color-slate-50: #f8faff;
  --color-slate-100: #e8ebf3;
  --color-slate-300: #b7bfce;
  --color-slate-400: #a1a9bc;
  --color-slate-500: #7c869b;
  --color-success-500: #0d7138;
  --color-warning-500: #915007;
  --color-danger-500: #b42318;
  --color-info-500: #0879a5;

  /* Canonical Semantic tokens (Gis Light) */
  --navy: #04101F;
  --navy-soft: #0F2A52;
  --blue: #1A6BFF;
  --blue-dark: #144FC2;
  --blue-tint: #EAF1FF;
  --bright: #2EC6FF;
  --light: #CADEFF;
  --border-soft: #ECECEE;
  --ai-blue: #0C5BEF;
  --ai-purple: #8823EA;
  --ai-magenta: #EA066F;
  --ai-orange: #FF5416;
  --ai-gradient: linear-gradient(135deg, var(--ai-blue) 0%, var(--ai-purple) 38%, var(--ai-magenta) 72%, var(--ai-orange) 100%);

  --color-bg: #f3f3f4;
  --color-bg-subtle: #eaeaec;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-muted: #f4f4f6;
  --color-surface-hover: #ececee;
  --component-sidebar-bg: #fafafa;
  --color-text: #18181b;
  --color-text-secondary: #3f3f46;
  --color-text-muted: #8a8a94;
  --color-text-disabled: #8a8a94;
  --color-border: #e3e3e6;
  --color-border-strong: #d1d1d6;
  --color-border-soft: #ececee;
  --color-primary: #2f5bff;
  --color-primary-hover: #2449d8;
  --color-primary-active: #1b38ad;
  --color-on-primary: #ffffff;
  --color-focus: #2f5bff;
  --color-success: #0d8a3f;
  --color-warning: #b4600b;
  --color-danger: #b42318;
  --color-info: #0879a5;
  --color-overlay: rgba(4, 16, 31, 0.45);

  /* Clean elevation & borders */
  --border-specular-top: 1px solid rgba(255, 255, 255, 0.95);
  --border-specular-subtle: 1px solid rgba(0, 0, 0, 0.04);
  --border-glass: 1px solid var(--color-border);
  --glow-apple-subtle: 0 0 16px rgba(47, 91, 255, 0.08);
  --glow-apple-active: 0 0 28px rgba(47, 91, 255, 0.18);

  --shadow-apple-sm: 0 1px 2px rgba(16, 17, 20, 0.04);
  --shadow-apple-md: 0 4px 12px rgba(16, 17, 20, 0.06);
  --shadow-apple-lg: 0 12px 28px rgba(16, 17, 20, 0.08);
  --shadow-apple-sheet: 0 20px 40px rgba(16, 17, 20, 0.12);

  /* Component surface tokens */
  --component-control-bg: #ffffff;
  --component-control-bg-hover: #f8f9fa;
  --component-control-bg-focus: #ffffff;
  --component-header-bg: transparent;
  --component-nav-bg: #fafafa;
  --component-table-bg: #ffffff;
  --component-table-header-bg: #fafafa;
  --component-table-row-hover: #f8f9fa;
  --component-modal-bg: #ffffff;
  --component-chart-bg: #ffffff;
  --component-filter-bg: #ffffff;
  --component-code-bg: #f4f4f6;
  --component-skeleton-bg: #e3e3e6;
  --component-skeleton-shine: rgba(255, 255, 255, 0.85);
  --component-selected-bg: #eaf1ff;
  --component-selected-border: rgba(47, 91, 255, 0.35);
  --component-primary-soft: #eaf1ff;
  --component-success-soft: #effaf3;
  --component-warning-soft: #fff6ea;
  --component-danger-soft: #fdf1f1;

  /* Canvas/chart tokens */
  --chart-success: #0d7138;
  --chart-warning: #915007;
  --chart-danger: #b42318;
  --chart-muted: #62626d;
  --chart-primary: #2f5bff;
  --chart-primary-light: #7b8cff;
  --chart-baseline: #8a8a94;
  --chart-text: #18181b;
  --chart-axis: #e3e3e6;
  --chart-grid: #f3f3f4;
  --chart-tooltip-bg: #18181b;
  --chart-tooltip-text: #ffffff;
  --chart-background: #ffffff;
  --chart-heatmap-low: #f3f3f4;

  /* Typography — Apple SF Pro Design System */
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", "Inter", -system-ui, sans-serif;
  --font-heading: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Inter", -system-ui, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 600;
  --weight-extrabold: 700;
  --weight-black: 800;
  --type-page-size: clamp(1.5rem, 2.5vw, 2rem);
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;

  /* Tracking — Apple HIG (relaxed, natural breathing room, not squished) */
  --tracking-display: -0.01em;
  --tracking-heading: 0;
  --tracking-subhead: 0;
  --tracking-body: 0;
  --tracking-caption: 0.015em;
  --tracking-micro: 0.02em;

  /* Spacing */
  --space-0: 0;
  --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;

  /* Control heights */
  --control-height: 40px;
  --control-height-sm: 32px;
  --control-height-lg: 48px;

  /* Canonical Shape & Radius — Apple HIG continuous squircle */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-btn: 10px;
  --radius: 10px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-pill: 9999px;
  --radius-full: 9999px;

  --shadow-1: var(--shadow-apple-sm);
  --shadow-2: var(--shadow-apple-md);
  --shadow-3: var(--shadow-apple-lg);
  --duration-instant: 100ms;
  --duration-fast: 160ms;
  --duration-normal: 220ms;
  --duration-sheet: 300ms;

  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-apple-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-apple-smooth: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-apple-snap: cubic-bezier(0.25, 1, 0.5, 1);

  --z-base: 0;
  --z-sticky: 100;
  --z-dropdown: 300;
  --z-fab: 700;
  --z-modal: 1000;
  --z-toast: 1200;
  --container-max: none;
  --app-gutter: 24px;
  --workspace-content-width: 1040px;
  --workspace-panel-padding: clamp(16px, 2.5vw, 24px);
  --content-measure: 72ch;

  /* Backwards-compatible aliases */
  --bg: var(--color-bg);
  --bg2: var(--color-bg-subtle);
  --panel: var(--color-surface);
  --panel-solid: #ffffff;
  --panel2: var(--color-surface-muted);
  --text: var(--color-text);
  --text-muted: var(--color-text-muted);
  --muted: var(--color-text-muted);
  --muted-bright: var(--color-text-secondary);
  --blue: var(--color-primary);
  --blue-hover: var(--color-primary-hover);
  --blue2: #2449d8;
  --blue-glow: rgba(47, 91, 255, 0.15);
  --accent-light: #7b8cff;
  --line: var(--color-border);
  --line-glow: rgba(47, 91, 255, 0.2);
  --green: var(--color-success);
  --amber: var(--color-warning);
  --red: var(--color-danger);
  --cyan: var(--color-info);
  --shadow: var(--shadow-2);
  --shadow-glow: var(--shadow-2);
  color-scheme: light;
}

html[data-theme="dark"] {
  /* Semantic colour layer: dark — Gis Dark */
  --navy: #F5F7FA;
  --navy-soft: #E0E4EB;
  --sidebar-bg: #10141C;
  --component-sidebar-bg: #10141C;
  --border-soft: #1E222C;
  --blue-tint: #122242;
  --color-blue-tint: #122242;
  --color-bg: #0b0e14;
  --color-bg-subtle: #080b10;
  --color-surface: #151922;
  --color-surface-raised: #1c2230;
  --color-surface-muted: rgba(255, 255, 255, 0.05);
  --color-surface-hover: rgba(255, 255, 255, 0.08);
  --color-text: #f0f1f3;
  --color-text-secondary: #c7cad1;
  --color-text-muted: #7c8290;
  --color-text-disabled: #626875;
  --color-border: #262b36;
  --color-border-strong: #363d4d;
  --color-border-soft: #1e222c;
  --color-primary: #1a6bff;
  --color-primary-hover: #144fc2;
  --color-primary-active: #0c5bef;
  --color-on-primary: #ffffff;
  --color-focus: #1a6bff;
  --color-success: #32d583;
  --color-warning: #fdb022;
  --color-danger: #f97066;
  --color-info: #38bdf8;
  --color-overlay: rgba(4, 8, 20, 0.82);

  --border-specular-top: 1px solid rgba(255, 255, 255, 0.16);
  --border-specular-subtle: 1px solid rgba(255, 255, 255, 0.08);
  --border-glass: 1px solid rgba(232, 235, 243, 0.12);
  --glow-apple-subtle: 0 0 24px rgba(47, 91, 255, 0.18);
  --glow-apple-active: 0 0 40px rgba(47, 91, 255, 0.35);

  --shadow-apple-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-apple-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-apple-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-apple-sheet: 0 24px 60px rgba(0, 0, 0, 0.65);

  --component-control-bg: #151922;
  --component-control-bg-hover: #1c2230;
  --component-control-bg-focus: #151922;
  --component-header-bg: transparent;
  --component-nav-bg: #10141c;
  --component-table-bg: #151922;
  --component-table-header-bg: #10141c;
  --component-table-row-hover: #1c2230;
  --component-modal-bg: #151922;
  --component-chart-bg: #151922;
  --component-filter-bg: #151922;
  --component-code-bg: #0b0e14;
  --component-skeleton-bg: rgba(255, 255, 255, 0.08);
  --component-skeleton-shine: rgba(255, 255, 255, 0.08);
  --component-selected-bg: #122242;
  --component-selected-border: rgba(47, 91, 255, 0.45);
  --component-primary-soft: rgba(47, 91, 255, 0.15);
  --component-success-soft: rgba(55, 215, 164, 0.12);
  --component-warning-soft: rgba(255, 180, 84, 0.12);
  --component-danger-soft: rgba(255, 111, 125, 0.12);

  --chart-success: #37d7a4;
  --chart-warning: #ffb454;
  --chart-danger: #ff6f7d;
  --chart-muted: #a2a8b3;
  --chart-primary: #2f5bff;
  --chart-primary-light: #7b8cff;
  --chart-baseline: #5f6472;
  --chart-text: #f0f1f3;
  --chart-axis: rgba(232, 235, 243, 0.15);
  --chart-grid: rgba(232, 235, 243, 0.08);
  --chart-tooltip-bg: #151922;
  --chart-tooltip-text: #ffffff;
  --chart-background: #0b0e14;
  --chart-heatmap-low: #16244d;

  --panel-solid: #151922;
  --panel: #151922;
  --panel2: #10141c;
  --bg: var(--color-bg);
  --bg2: var(--color-bg-subtle);
  --text: var(--color-text);
  --text-muted: var(--color-text-muted);
  --muted: var(--color-text-muted);
  --muted-bright: var(--color-text-secondary);
  --blue: var(--color-primary);
  --blue-hover: var(--color-primary-hover);
  --blue2: #7b8cff;
  --blue-glow: rgba(47, 91, 255, 0.28);
  --accent-light: #7b8cff;
  --line: var(--color-border);
  --line-glow: rgba(47, 91, 255, 0.35);
  --shadow-1: var(--shadow-apple-sm);
  --shadow-2: var(--shadow-apple-md);
  --shadow-3: var(--shadow-apple-lg);
  color-scheme: dark;
}

html {
  background: var(--color-bg);
  color-scheme: dark;
  overflow-x: hidden;
}

body {
  min-width: 20rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  background-color: var(--color-bg);
  background: var(--color-bg);
  color: var(--color-text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.auth-mode .gis-chat-fab,
body.auth-mode .gis-chat-widget,
body:has(#authViewContainer[style*="display: flex"]) .gis-chat-fab,
body:has(#authViewContainer[style*="display: flex"]) .gis-chat-widget {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  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: 0 !important;
}

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: calc(var(--z-toast) + 1);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.skip-link:focus {
  transform: translateY(0);
}

:where(button, a, input, textarea, select, summary, [role="button"], [role="radio"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

:where(h1, h2, h3, h4, h5, h6, [tabindex="-1"], #mainContent, .gis-modal-card, .modal-card):focus,
:where(h1, h2, h3, h4, h5, h6, [tabindex="-1"], #mainContent, .gis-modal-card, .modal-card):focus-visible {
  outline: none !important;
}

:where(button, [role="button"], [role="radio"], summary) {
  touch-action: manipulation;
}

:where(button, input, textarea, select):disabled,
[aria-disabled="true"] {
  cursor: not-allowed !important;
  opacity: 0.48 !important;
  pointer-events: none;
}

h1, h2, h3, h4, h5, h6,
.view-title,
.section-h {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  text-wrap: balance;
  color: var(--navy);
}

h1, .greeting h1 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
}
h2, .view-title, .section-h {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-heading);
}
h3 {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  letter-spacing: 0;
}
h4, h5, h6, .panel h4, .activity-card h4 {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
}
small { font-size: var(--text-xs); }
code, pre, kbd, samp { font-family: var(--font-mono); }

p, .view-desc {
  text-wrap: pretty;
}

.app-container {
  position: relative;
  z-index: 10;
  width: calc(100% - 256px);
  max-width: calc(100% - 256px);
  min-width: 0;
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  margin: 56px 0 0 256px;
  padding: 24px;
  box-sizing: border-box;
  transition: margin-left 0.22s cubic-bezier(0.16, 1, 0.3, 1), width 0.22s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-collapsed .app-container {
  margin-left: 80px;
  width: calc(100% - 80px);
  max-width: calc(100% - 80px);
}

body.auth-mode .app-container,
body.unauthenticated .app-container {
  margin-left: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  min-height: 100vh;
}

.app-view.active {
  flex: 1 0 auto;
}

/* Application Global Footer */
.app-footer {
  margin-top: auto;
  padding: var(--space-8) 0 var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-top: 1px solid rgba(232, 235, 243, 0.05);
}

body.auth-mode .app-footer,
body:has(#authViewContainer[style*="display: flex"]) .app-footer {
  display: none !important;
}

.app-footer-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  flex-wrap: wrap;
}

.app-footer-link {
  background: transparent;
  border: none;
  padding: 2px 4px;
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.03em;
  color: var(--color-text-disabled);
  opacity: 0.55;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

.app-footer-link:hover {
  opacity: 0.95;
  color: var(--color-primary-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-footer-separator {
  color: var(--color-text-disabled);
  opacity: 0.3;
  font-size: var(--text-xs);
  user-select: none;
}

.app-footer-version {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  color: var(--color-text-disabled);
  opacity: 0.45;
  user-select: none;
  white-space: nowrap;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.app-footer-version:hover {
  opacity: 0.85;
  color: var(--color-text-muted);
}

html[data-theme="light"] .app-footer {
  border-top-color: rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .app-footer-link {
  color: var(--color-slate-500);
}

html[data-theme="light"] .app-footer-link:hover {
  color: var(--color-primary);
}

html[data-theme="light"] .app-footer-separator {
  color: var(--color-slate-300);
}

html[data-theme="light"] .app-footer-version {
  color: var(--color-slate-400);
}

html[data-theme="light"] .app-footer-version:hover {
  color: var(--color-slate-600);
}

@media (max-width: 640px) {
  .app-footer {
    padding: var(--space-4) 0 var(--space-2);
  }

  .app-footer-content {
    gap: 8px;
  }

  .app-footer-link,
  .app-footer-version {
    font-size: var(--text-xs);
    letter-spacing: 0.02em;
  }
}

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}

.view-header > div,
.view-header > :only-child {
  min-width: 0;
}

.view-header-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  max-width: 56rem;
}

.view-header-copy .view-title {
  max-width: 24ch;
  text-wrap: balance;
}

.view-header-copy .view-desc {
  max-width: var(--content-measure);
  text-wrap: pretty;
}

.section-heading-row,
.modal-header,
.range-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.section-heading-row {
  margin-bottom: var(--space-5);
}

.section-heading-row h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.attention-section,
.manual-nav,
.view-header {
  scroll-margin-top: 6.5rem;
}

/* Optical Typography Hierarchy */
.view-title {
  max-width: 24ch;
  margin-bottom: var(--space-3);
  font-size: var(--type-page-size);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
}

.view-desc {
  max-width: var(--content-measure);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  letter-spacing: var(--tracking-body);
}

.eyebrow {
  margin-bottom: var(--space-2);
  color: var(--color-blue-400);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
}

/* Buttons with Gis / Apple HIG Styling */
.primary-btn,
.secondary-btn,
.action-btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-ghost,
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 1.125rem;
  border-radius: var(--radius-btn, 10px);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease-apple-spring),
    border-color var(--duration-fast) var(--ease-apple-spring),
    color var(--duration-fast) var(--ease-apple-spring),
    box-shadow var(--duration-fast) var(--ease-apple-spring),
    transform var(--duration-instant) var(--ease-apple-spring);
}

.primary-btn-sm,
.secondary-btn-sm,
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: var(--control-height-sm);
  min-height: var(--control-height-sm);
  padding: 0 0.875rem;
  border-radius: var(--radius-btn, 10px);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease-apple-spring),
    border-color var(--duration-fast) var(--ease-apple-spring),
    color var(--duration-fast) var(--ease-apple-spring),
    box-shadow var(--duration-fast) var(--ease-apple-spring),
    transform var(--duration-instant) var(--ease-apple-spring);
}

.primary-btn,
.primary-btn-sm,
.btn-primary {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: var(--color-on-primary, #ffffff) !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.primary-btn:hover,
.primary-btn-sm:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.primary-btn:active,
.primary-btn-sm:active,
.btn-primary:active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.24);
  transform: scale(0.98);
}

.secondary-btn,
.secondary-btn-sm,
.action-btn,
.btn-secondary {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-apple-sm);
}

.secondary-btn:hover,
.secondary-btn-sm:hover,
.action-btn:hover,
.btn-secondary:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-hover);
  color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-apple-md);
}

.secondary-btn:active,
.secondary-btn-sm:active,
.action-btn:active,
.btn-secondary:active {
  background: var(--component-control-bg-focus);
  transform: scale(0.98);
}

.btn-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

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

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--component-primary-soft);
}

.btn-danger,
.action-danger {
  border-color: rgba(244, 63, 94, 0.28) !important;
  background: rgba(244, 63, 94, 0.08) !important;
  color: var(--color-danger) !important;
  box-shadow: 0 1px 4px rgba(244, 63, 94, 0.12) !important;
}

.btn-danger:hover,
.action-danger:hover {
  background: rgba(244, 63, 94, 0.16) !important;
  border-color: rgba(244, 63, 94, 0.45) !important;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2) !important;
  transform: translateY(-1px);
}

.btn-danger:active,
.action-danger:active {
  transform: scale(0.98) !important;
}

.icon-btn,
.modal-close-btn,
.chat-hdr-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  box-sizing: border-box;
  transition: all var(--duration-fast) var(--ease-apple-spring);
}

.icon-btn:hover,
.modal-close-btn:hover,
.chat-hdr-icon-btn:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-hover);
  color: var(--color-text);
  transform: translateY(-1px);
}

.icon-btn:active,
.modal-close-btn:active,
.chat-hdr-icon-btn:active {
  transform: scale(0.94);
}

.ui-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.inline-icon {
  width: 0.875rem;
  height: 0.875rem;
  margin-right: var(--space-2);
  vertical-align: -0.125rem;
}

.empty-state-icon {
  width: 2rem;
  height: 2rem;
  color: var(--color-blue-400);
}

.projects-grid > .empty-state {
  grid-column: 1 / -1;
}

.gis-modal-header h2,
.modal-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.company-item-icon--primary {
  border-color: rgba(47, 91, 255, 0.28) !important;
  background: rgba(47, 91, 255, 0.12) !important;
  color: var(--color-blue-400);
}

.company-item-icon--success {
  border-color: rgba(55, 215, 164, 0.28) !important;
  background: rgba(55, 215, 164, 0.12) !important;
  color: var(--color-success);
}

.company-item-icon--danger {
  border-color: rgba(255, 111, 125, 0.28) !important;
  background: rgba(255, 111, 125, 0.12) !important;
  color: var(--color-danger);
}

.logout-item strong {
  color: var(--color-danger);
  font-size: var(--text-sm);
}

/* Form controls with Apple Inset Glass & Glowing Focus Rings */
.form-group,
.field-group {
  display: grid;
  gap: var(--space-2);
}

.form-group > label,
.field-label {
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caption);
}

.input-field,
.an-input,
.an-select,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(.chat-input-field),
textarea,
select {
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--component-control-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  padding: 0 0.875rem;
  box-sizing: border-box;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  transition:
    border-color var(--duration-fast) var(--ease-apple-spring),
    box-shadow var(--duration-fast) var(--ease-apple-spring),
    background-color var(--duration-fast) var(--ease-apple-spring);
}

textarea {
  height: auto;
  min-height: 5rem;
  padding: 0.625rem 0.875rem;
}

.input-sm,
.select-sm,
.input-field-sm {
  height: var(--control-height-sm);
  min-height: var(--control-height-sm);
  padding: 0 0.625rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.input-field:hover,
.an-input:hover,
.an-select:hover,
textarea:hover,
select:hover {
  border-color: var(--color-border-strong);
  background-color: var(--component-control-bg-hover);
}

.input-field:focus,
.an-input:focus,
.an-select:focus,
input:not(.chat-input-field):focus,
textarea:focus,
select:focus {
  border-color: var(--color-focus);
  background-color: var(--component-control-bg-focus);
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.18);
  outline: none;
}

::placeholder {
  color: var(--color-text-disabled);
  opacity: 1;
}

.field-helper,
.form-subtext {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

.field-error-msg,
.field-error {
  color: var(--color-danger);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.optional-label {
  color: var(--color-text-muted);
  font-weight: var(--weight-medium);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.modal-card > form,
.modal-card > .range-panel {
  margin-top: var(--space-5);
}

.range-panel {
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.range-header {
  margin-bottom: var(--space-3);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.range-header output {
  color: var(--color-blue-400);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.range-panel input[type="range"] {
  width: 100%;
  cursor: pointer;
}

.range-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.chip--compact {
  min-height: 2.25rem;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}

.input-field.input-error,
[aria-invalid="true"] {
  border-color: var(--color-danger) !important;
  background: rgba(255, 111, 125, 0.08) !important;
  box-shadow: 0 0 0 3.5px rgba(255, 111, 125, 0.18) !important;
}

/* Surfaces and Cards with Apple Translucent Materials & Specular Edges */
.gis-card-dialog,
.create-project-shell,
.today-greeting-box,
.project-card,
.project-detail-header,
.task-card,
.attention-card,
.an-chart-card,
.gantt-chart-card,
.auth-card-wrapper {
  border: var(--border-glass);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  backdrop-filter: var(--apple-blur-regular);
  -webkit-backdrop-filter: var(--apple-blur-regular);
  box-shadow: var(--shadow-apple-md);
  transition:
    border-color var(--duration-fast) var(--ease-apple-spring),
    background-color var(--duration-fast) var(--ease-apple-spring),
    box-shadow var(--duration-fast) var(--ease-apple-spring),
    transform var(--duration-fast) var(--ease-apple-spring);
}

.project-card,
.task-card,
.attention-card,
.an-chart-card,
.summary-item,
.kpi-stat-card,
.gantt-stat-card {
  box-shadow: var(--shadow-apple-sm);
}

.project-card:hover,
.task-card:hover,
.attention-card:hover,
.summary-item:hover,
.kpi-stat-card:hover {
  border-color: var(--component-selected-border);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-apple-md), var(--glow-apple-subtle);
  transform: translateY(-2px);
}

.project-card:active,
.task-card:active,
.kpi-stat-card:active {
  transform: scale(0.98);
}

.kpi-stat-card {
  width: 100%;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.detail-sub-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-height: 36px;
  padding: 0 16px;
  gap: 7px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
  transition: all var(--duration-fast) var(--ease-apple-spring);
}

.detail-sub-tab .ui-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity var(--duration-fast) ease;
}

.project-meta-rows > div {
  display: flex;
  align-items: center;
}

.project-meta-rows b {
  margin-right: var(--space-1);
}

.option-card,
.chip,
.quick-suggestions button {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
}

.option-card:hover,
.chip:hover,
.quick-suggestions button:hover {
  border-color: rgba(123, 140, 255, 0.42);
  background: var(--color-surface-hover);
  box-shadow: none;
  transform: none;
}

.option-card.selected,
.option-card[aria-checked="true"],
.chip.selected {
  border-color: var(--color-primary);
  background: var(--component-selected-bg);
  box-shadow: inset 0 0 0 1px rgba(47, 91, 255, 0.18);
  animation: none;
}

/* Badges and feedback — Apple HIG style */
.status-pill,
.badge,
.onboarding-step-badge,
.impact-badge,
.card-badge,
.chip,
.m-chip {
  display: inline-flex;
  min-height: 1.5rem;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.015em;
  line-height: 1.2;
}

.m-chip.up {
  background: var(--component-success-soft, #effaf3);
  color: var(--color-success, #0d8a3f);
}

.m-chip.down {
  background: var(--component-danger-soft, #fdf1f1);
  color: var(--color-danger, #b42318);
}

.nav-badge,
.mi-pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  background: var(--blue-tint, #eaf1ff);
  color: var(--blue-dark, #144fc2);
}

/* Metric / KPI values — Apple HIG standard */
.m-value,
.an-kpi-value,
.kpi-value,
.kpi-number,
.today-kpi-value {
  font-size: 32px;
  font-weight: var(--weight-semibold);
  line-height: 1.1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

.m-label,
.an-kpi-label,
.kpi-label {
  font-size: 13px;
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  color: var(--color-text-muted);
}

.m-sub,
.an-kpi-hint,
.kpi-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.35;
}

/* Segmented Controls — Apple HIG standard */
.segmented,
.segmented-tabs {
  position: relative;
  display: inline-flex;
  background: rgba(118, 118, 128, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-btn, 10px);
  padding: 3px;
  gap: 2px;
  isolation: isolate;
  box-sizing: border-box;
}

html[data-theme="dark"] .segmented,
html[data-theme="dark"] .segmented-tabs {
  background: rgba(118, 118, 128, 0.24);
  border-color: rgba(255, 255, 255, 0.06);
}

.segmented button,
.segmented-tabs button {
  position: relative;
  z-index: 1;
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  color: var(--color-text-muted);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}

.segmented button:hover,
.segmented-tabs button:hover {
  color: var(--color-text);
}

.segmented button.active,
.segmented-tabs button.active {
  color: var(--navy);
  font-weight: var(--weight-medium);
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

html[data-theme="dark"] .segmented button.active,
html[data-theme="dark"] .segmented-tabs button.active {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Inset cards & lists — Gis standard */
.att-inset,
.qa-inset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl, 16px);
  padding: 4px 16px;
  background: var(--color-surface);
}

.att-item,
.qa-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-soft);
}

.att-item:last-child,
.qa-row:last-child {
  border-bottom: none;
}

.att-link {
  font-size: 12px;
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
  text-decoration: none;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn, 8px);
  padding: 8px 12px;
  background: var(--color-surface);
  box-shadow: var(--shadow-1);
  transition: all var(--duration-fast) var(--ease-standard);
}

.att-link:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
  background: var(--blue-tint);
  box-shadow: none;
}

.ui-alert,
.gis-reaction-banner,
.notice-box {
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
}

.ui-alert.info,
.gis-reaction-banner { border-left-color: var(--color-info); }
.ui-alert.success { border-left-color: var(--color-success); }
.ui-alert.warning { border-left-color: var(--color-warning); }
.ui-alert.danger { border-left-color: var(--color-danger); }

.empty-state,
.empty-state-box,
.an-empty-state {
  display: grid;
  min-height: 10rem;
  padding: var(--space-8) var(--space-6);
  place-items: center;
  align-content: center;
  gap: var(--space-3);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  text-align: center;
}

.empty-state > :where(h2, h3, h4, strong),
.empty-state-box > :where(h2, h3, h4, strong),
.an-empty-state > :where(h2, h3, h4, strong) {
  color: var(--color-text);
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--component-skeleton-bg);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--component-skeleton-shine), transparent);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  to { transform: translateX(100%); }
}

/* Tables */
.table-scroll,
.users-table-wrap,
.markdown-body .md-table-wrapper,
.gantt-scroll-container {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--component-table-bg);
}

:where(.users-table, .md-table, .gantt-main-table) {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

:where(.users-table, .md-table) th {
  background: var(--component-table-header-bg);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

:where(.users-table, .md-table) td,
:where(.users-table, .md-table) th {
  padding: var(--space-3) var(--space-4);
  border-bottom-color: var(--color-border);
}

:where(.users-table, .md-table) tbody tr:hover {
  background: var(--component-table-row-hover);
}

/* Top Header - Fixed persistent 56px, Gis layout, seamless transparent background */
.app-header {
  position: fixed;
  top: 0;
  left: 256px;
  right: 0;
  height: 56px;
  padding: 0 24px;
  box-sizing: border-box;
  border: none;
  border-bottom: 1px solid transparent !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: var(--z-sticky, 100);
  transition: left 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-collapsed .app-header {
  left: 80px;
}

.brand {
  transition: opacity var(--duration-fast) ease;
}

.brand:hover {
  opacity: 0.92;
}

.brand:active {
  transform: scale(0.97);
}

.brand svg {
  filter: none;
  transition: transform var(--duration-fast) var(--ease-apple-spring);
}

.brand span {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  letter-spacing: var(--tracking-subhead);
}

.nav-tabs {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.nav-tab {
  border-radius: 0;
  color: var(--color-text-muted);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caption);
  transition:
    color var(--duration-fast) var(--ease-apple-spring),
    border-color var(--duration-fast) var(--ease-apple-spring);
}

.nav-tab:hover {
  background: transparent;
  color: var(--color-text);
}

.nav-tab:active {
  transform: none;
}

.nav-tab.active {
  border: none;
  border-bottom: 2px solid var(--color-primary, #2F5BFF);
  background: transparent;
  color: #ffffff;
  box-shadow: none;
  font-weight: var(--weight-semibold);
  border-radius: 0;
}

.nav-tab .ui-icon {
  width: 1rem;
  height: 1rem;
}

/* Modals and Overlays with Apple Glass & Physical Springs */
.gis-modal,
.modal-overlay,
.gis-chat-widget.open:not(.chat-workspace) {
  z-index: var(--z-modal);
  background: var(--color-overlay);
  backdrop-filter: var(--apple-blur-thin);
  -webkit-backdrop-filter: var(--apple-blur-thin);
}

.gis-modal-card,
.modal-card {
  border: var(--border-specular-top);
  border-radius: var(--radius-2xl);
  background: var(--component-modal-bg);
  backdrop-filter: var(--apple-blur-thick);
  -webkit-backdrop-filter: var(--apple-blur-thick);
  box-shadow: var(--shadow-apple-sheet);
  transition: transform var(--duration-sheet) var(--ease-apple-spring), opacity var(--duration-sheet) ease;
}

.modal-narrow {
  max-width: 34.375rem !important;
}

.modal-medium {
  max-width: 40rem !important;
}

.validation-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-danger);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.gis-modal-header,
.modal-header {
  min-height: 4rem;
  border-bottom: 1px solid var(--color-border);
}

.gis-modal-header h2,
.modal-header h2,
.modal-title {
  margin: 0;
  color: var(--color-text);
  font-size: var(--text-lg);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-subhead);
}

.toast-msg {
  z-index: var(--z-toast);
  max-width: min(28rem, calc(100vw - 2rem));
  border: var(--border-specular-top);
  border-radius: var(--radius-pill);
  background: var(--component-modal-bg);
  backdrop-filter: var(--apple-blur-regular);
  -webkit-backdrop-filter: var(--apple-blur-regular);
  box-shadow: var(--shadow-apple-lg);
  color: var(--color-text);
}

.gis-chat-fab {
  z-index: var(--z-fab);
  box-shadow: var(--shadow-apple-md), 0 8px 24px rgba(47, 91, 255, 0.35);
  transition: all var(--duration-fast) var(--ease-apple-spring);
}

.gis-chat-fab:active {
  transform: scale(0.95);
}
}

/* Chat Input Capsule & Actions (Harmonious Minimalist Design) */
.chat-input-box {
  display: flex;
  align-items: center;
  min-height: 3.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--component-control-bg);
  padding: 0.25rem 0.375rem 0.25rem 1.25rem;
  box-shadow: var(--shadow-2);
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

.chat-input-box:hover {
  border-color: var(--color-border-strong);
  background: var(--component-control-bg-hover);
}

.chat-input-box:focus-within {
  border-color: var(--color-focus);
  background: var(--component-control-bg-focus);
  box-shadow: 0 0 0 3px rgba(123, 140, 255, 0.22), 0 10px 28px rgba(0, 0, 0, 0.3);
}

.chat-input-field {
  flex: 1 1 auto;
  min-width: 0;
  min-height: unset !important;
  height: auto;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: var(--color-text) !important;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  letter-spacing: -0.01em;
  padding: var(--space-2) var(--space-3) var(--space-2) 0;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

.chat-input-field:focus {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.chat-input-field::placeholder {
  color: var(--color-text-muted) !important;
  opacity: 0.75;
  font-weight: var(--weight-regular);
  letter-spacing: -0.01em;
  transition: opacity var(--duration-fast) var(--ease-standard);
}

.chat-input-box:focus-within .chat-input-field::placeholder {
  opacity: 0.45;
}

.chat-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  min-height: 2.375rem !important;
  max-height: 2.375rem;
  border-radius: var(--radius-pill) !important;
  border: none !important;
  background: linear-gradient(135deg, var(--color-blue-500) 0%, var(--color-blue-600) 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(47, 91, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard);
}

.chat-submit-btn .ui-icon {
  width: 1.125rem;
  height: 1.125rem;
  stroke: #ffffff !important;
  transform: translate(1px, 0);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.chat-submit-btn:hover {
  transform: scale(1.06);
  background: linear-gradient(135deg, var(--color-blue-400) 0%, var(--color-blue-500) 100%) !important;
  box-shadow: 0 4px 14px rgba(47, 91, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.chat-submit-btn:hover .ui-icon {
  transform: translate(2px, -1px);
}

.chat-submit-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(47, 91, 255, 0.35);
}

/* Dashboard and data clarity */
.an-kpi-card strong,
.gantt-stat-info strong,
.kpi-badge-num,
.drawer-stat strong {
  font-variant-numeric: tabular-nums;
}

.an-chart-card,
#view-executive .an-chart-card {
  background: var(--component-chart-bg);
}

.analysis-filter-bar,
#view-executive .analysis-filter-bar {
  border-color: var(--color-border);
  background: var(--component-filter-bg);
  box-shadow: var(--shadow-2);
}

/* The off-canvas sidebar no longer reserves workspace width. */
@media (max-width: 980px) {
  .app-container,
  body.sidebar-collapsed .app-container {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }
}

/* Responsive breakpoints: compact < 48rem, medium 48–64rem, wide > 64rem */
@media (max-width: 64rem) {
  .app-container {
    padding-inline: clamp(var(--space-4), 3vw, var(--space-8));
  }
}

@media (max-width: 48rem) {
  body:not(.auth-mode) {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-container {
    padding: 16px;
    margin: 56px 0 0 0 !important;
    width: 100% !important;
  }

  .view-header {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  .view-header > .primary-btn {
    width: 100%;
  }

  .view-header-copy {
    max-width: 100%;
  }

  .view-title {
    font-size: var(--type-page-size);
  }

  .app-header {
    position: sticky;
    top: 0;
    left: 0;
    margin: 0 !important;
    width: 100% !important;
    height: 56px;
    padding: max(0px, env(safe-area-inset-top)) var(--space-4) 0;
    box-sizing: border-box;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid transparent !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .gis-card-dialog,
  .create-project-shell,
  .today-greeting-box,
  .project-card,
  .project-detail-header,
  .task-card,
  .attention-card {
    border-radius: var(--radius-lg);
  }

  .form-actions-row,
  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 30rem) {
  .app-container {
    padding-inline: var(--space-3);
  }

  .gis-card-dialog,
  .create-project-shell,
  .today-greeting-box,
  .project-card,
  .project-detail-header,
  .task-card,
  .attention-card {
    padding: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none;
  }
}

/* ====================================================
   Theme selector
   ==================================================== */
.theme-selector {
  display: inline-flex;
  min-height: 2.625rem;
  align-items: center;
  gap: 0.125rem;
  padding: 0.125rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--component-nav-bg);
  box-shadow: inset 0 1px 2px rgba(17, 24, 43, 0.08);
}

.theme-option {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.theme-option:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.theme-option.active {
  border-color: var(--component-selected-border);
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-1);
}

.theme-option .ui-icon {
  width: 1rem;
  height: 1rem;
}

@media (max-width: 30rem) {
  .theme-selector {
    min-height: 2.875rem;
  }

  .theme-option {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* ====================================================
   Legacy component compatibility: light appearance
   All new work should consume the semantic/component tokens above.
   ==================================================== */
html[data-theme="light"] body {
  background-color: var(--color-bg);
}

html[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(to right, rgba(36, 73, 216, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(36, 73, 216, 0.045) 1px, transparent 1px);
}

html[data-theme="light"] .noise {
  opacity: 0.018;
  mix-blend-mode: multiply;
}

html[data-theme="light"] .cursor-glow {
  background: radial-gradient(circle, rgba(36, 73, 216, 0.08), transparent 70%);
}

/* Navigation, account menu and top-level controls */
html[data-theme="light"] .brand,
html[data-theme="light"] .brand span,
html[data-theme="light"] .user-access-badge,
html[data-theme="light"] .company-item-text strong {
  color: var(--color-text);
}

html[data-theme="light"] .collaborator-company-card {
  background: rgba(36, 73, 216, 0.06);
  border-color: rgba(36, 73, 216, 0.2);
}

html[data-theme="light"] .collaborator-company-card .company-item-text small {
  color: var(--color-primary);
}

html[data-theme="light"] .user-access-badge,
html[data-theme="light"] .reset-btn {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
}

html[data-theme="light"] .user-info strong,
html[data-theme="light"] .kpi-stat-info strong,
html[data-theme="light"] .project-card h3 {
  color: var(--color-text);
}

html[data-theme="light"] .user-info small,
html[data-theme="light"] .kpi-stat-info small {
  color: var(--color-text-muted);
}

html[data-theme="light"] .user-access-badge:hover,
html[data-theme="light"] .reset-btn:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-hover);
  color: var(--color-text);
}

html[data-theme="light"] .dropdown-chevron {
  color: var(--color-text-muted);
}

html[data-theme="light"] .user-dropdown-menu {
  border-color: #E5E7EB;
  background: #FFFFFF;
  box-shadow: 0 16px 40px -4px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.03);
  border-radius: 24px;
}

html[data-theme="light"] .project-select-dropdown {
  border-color: var(--color-border-strong);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-3);
}

html[data-theme="light"] .dropdown-item,
html[data-theme="light"] .project-select-option {
  color: var(--color-text-secondary);
}

html[data-theme="light"] .dropdown-item:hover,
html[data-theme="light"] .project-select-option:hover {
  border-color: var(--color-border);
  background: var(--color-surface-hover);
  color: var(--color-text);
}

html[data-theme="light"] .dropdown-divider,
html[data-theme="light"] .dropdown-header-bar {
  border-color: var(--color-border);
  background-color: transparent;
}

/* Project, task, planning and portfolio surfaces */
html[data-theme="light"] :where(
  .summary-item,
  .stage-proposal-card,
  .phase-accordion,
  .phase-accordion-header,
  .phase-tasks-body,
  .tasks-project-header,
  .tasks-collaborator-card,
  .recommendation-card,
  .multi-project-item-card,
  .project-portfolio-metadata,
  .pending-user-card,
  .superadmin-panel-wrap,
  .gantt-stat-card,
  .gantt-modal-field,
  .d-stat,
  .d-task-item
) {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

html[data-theme="light"] :where(
  .stage-proposal-heading strong,
  .phase-title,
  .tasks-project-title,
  .tasks-collaborator-title,
  .phase-header-left strong,
  .summary-item strong,
  .project-portfolio-metadata-header h3,
  .project-portfolio-metadata-grid strong,
  .pending-card-header h4,
  .gantt-stat-info strong,
  .gantt-modal-field .val,
  .d-stat strong,
  .d-task-item .t-main strong
) {
  color: var(--color-text);
}

html[data-theme="light"] .phase-accordion-header:hover,
html[data-theme="light"] .stage-proposal-card:hover {
  background: var(--color-surface-hover);
}

html[data-theme="light"] .recommendation-card {
  background: var(--color-surface, #ffffff);
  border-color: var(--color-border, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .recommendation-card:hover {
  background: var(--color-surface-hover, #f8fafc);
  border-color: var(--color-primary, #2F5BFF);
}

html[data-theme="light"] .recommendation-card.applied {
  border-color: var(--color-success, #059669);
  background: var(--color-surface-muted, #f1f5f9);
}

html[data-theme="light"] .recommendation-info h4 {
  color: var(--color-text, #0f172a);
}

html[data-theme="light"] .recommendation-info p {
  color: var(--color-text-secondary, #475569);
}

html[data-theme="light"] .recommendation-info small {
  color: var(--color-success, #059669);
}

html[data-theme="light"] .project-portfolio-metadata-grid {
  border-color: var(--color-border);
  background: var(--color-border);
}

html[data-theme="light"] .project-portfolio-metadata-grid > div,
html[data-theme="light"] .pending-card-meta {
  background: var(--color-surface-raised);
}

html[data-theme="light"] .role-change-select,
html[data-theme="light"] .input-select-sm {
  border-color: var(--color-border);
  background: var(--component-control-bg);
  color: var(--color-text);
}

/* Analysis dashboard and drawers */
html[data-theme="light"] #view-executive .analysis-filter-bar,
html[data-theme="light"] .analysis-filter-bar {
  border-color: var(--color-border);
  background: var(--component-filter-bg);
  box-shadow: var(--shadow-2);
}

html[data-theme="light"] :where(
  .an-filter-panel,
  .an-filter-fields,
  .an-subtabs-bar,
  .an-kpi-card,
  .an-chart-card,
  .howto-content,
  .an-tab-banner,
  .an-insight-item,
  .an-milestone-item
) {
  border-color: var(--color-border);
  background: var(--color-surface);
}

html[data-theme="light"] #view-executive .an-kpi-card {
  border-color: var(--color-border);
  background: linear-gradient(180deg, #ffffff, #f6f8fc);
}

html[data-theme="light"] #view-executive .an-kpi-card.clickable:hover {
  border-color: var(--component-selected-border);
  background: linear-gradient(180deg, #ffffff, #edf2fb);
  box-shadow: var(--shadow-2);
}

html[data-theme="light"] #view-executive .an-chart-card,
html[data-theme="light"] .an-chart-card {
  border-color: var(--color-border);
  background: var(--component-chart-bg);
}

html[data-theme="light"] :where(
  .an-kpi-card strong,
  .chart-header h3,
  .an-chart-empty strong,
  .an-milestone-item .m-info strong,
  .an-milestone-item .m-date span,
  .drawer-top-bar h2,
  .drawer-section h3
) {
  color: var(--color-text);
}

html[data-theme="light"] :where(
  #view-executive .filter-group-icon,
  #view-executive .count-badge,
  #view-executive .an-kpi-card small,
  #view-executive .an-kpi-card .hint,
  #view-executive .an-data-coverage,
  .an-filter-fields > label > span
) {
  color: var(--color-text-muted);
}

html[data-theme="light"] #view-executive .count-badge b,
html[data-theme="light"] #view-executive .an-data-coverage b,
html[data-theme="light"] .an-filter-panel > summary {
  color: var(--color-text-secondary);
}

html[data-theme="light"] #view-executive .an-tab-btn.active,
html[data-theme="light"] .an-tab-btn.active {
  background: var(--component-selected-bg);
  color: var(--color-primary);
}

html[data-theme="light"] .an-tab-btn:hover,
html[data-theme="light"] .chart-howto summary:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

html[data-theme="light"] .an-drawer-overlay,
html[data-theme="light"] .an-assistant-overlay,
html[data-theme="light"] .gis-modal-backdrop {
  background: var(--color-overlay);
}

html[data-theme="light"] .an-drawer-body,
html[data-theme="light"] .an-assistant-dialog,
html[data-theme="light"] .gis-modal-card {
  border-color: var(--color-border-strong);
  background: var(--component-modal-bg);
  box-shadow: var(--shadow-3);
}

html[data-theme="light"] .an-assistant-header,
html[data-theme="light"] .an-assistant-fields,
html[data-theme="light"] .gis-modal-header {
  border-color: var(--color-border);
  background: var(--color-surface-raised);
}

html[data-theme="light"] .recommendation-review-header h2 {
  color: var(--color-text);
}

html[data-theme="light"] .recommendation-review-footer {
  border-color: var(--color-border);
  background: var(--color-surface-raised);
}

html[data-theme="light"] .an-assistant-project-row label,
html[data-theme="light"] .an-assistant-field label,
html[data-theme="light"] .an-assistant-steps .active {
  color: var(--color-text-secondary);
}

html[data-theme="light"] .drawer-close-btn {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

/* Expanded presentation of the existing chat, inside the application shell. */
.chat-workspace-welcome,
.chat-workspace-notice,
.chat-workspace-suggestions {
  display: none;
}

textarea.chat-input-field {
  resize: vertical;
  font: inherit;
}

/* Floating chat button completely eliminated from UI */
.gis-chat-fab,
#gisChatFab {
  display: none !important;
}

body.ai-workspace #mainContent {
  display: none;
}

/* ==========================================================================
   GIS AI CONVERSATIONAL WORKSPACE (PREMIUM AMBIENT GRADIENT & SEAMLESS CANVAS)
   ========================================================================== */

body.ai-workspace {
  background-color: #FFFFFF !important;
  background-image: 
    radial-gradient(ellipse 750px 480px at 0% 0%, rgba(56, 189, 248, 0.22) 0%, rgba(59, 130, 246, 0.07) 38%, transparent 70%),
    radial-gradient(ellipse 750px 480px at 100% 0%, rgba(244, 114, 182, 0.22) 0%, rgba(236, 72, 153, 0.07) 38%, transparent 70%) !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
}

html:not([data-theme="light"]) body.ai-workspace {
  background-color: #0B0F19 !important;
  background-image: 
    radial-gradient(ellipse 800px 520px at 0% 0%, rgba(14, 165, 233, 0.18) 0%, rgba(37, 99, 235, 0.07) 40%, transparent 70%),
    radial-gradient(ellipse 800px 520px at 100% 0%, rgba(217, 70, 239, 0.14) 0%, rgba(147, 51, 234, 0.05) 40%, transparent 70%) !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
}

/* Make top header blend seamlessly into AI workspace gradient */
body.ai-workspace .app-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html:not([data-theme="light"]) body.ai-workspace .app-header {
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
}

/* In Gis AI workspace mode, hide navigation tabs and admin items from sidebar */
body.ai-workspace .app-sidebar .sidebar-nav,
body.ai-workspace .app-sidebar #sidebarAdminSection {
  display: none !important;
}

:root .gis-chat-widget.chat-workspace {
  position: fixed;
  top: 56px;
  left: 256px;
  right: 0;
  bottom: 0;
  width: auto;
  height: calc(100dvh - 56px);
  padding: 0 28px;
  margin: 0;
  z-index: 90;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

:root .gis-chat-widget.chat-workspace.open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  transition: opacity 160ms ease, visibility 160ms ease;
}

body.sidebar-collapsed .gis-chat-widget.chat-workspace {
  left: 80px;
}

@media (max-width: 980px) {
  :root .gis-chat-widget.chat-workspace {
    left: 0;
    padding: 0 16px;
  }
}

:root .chat-workspace .chat-fullscreen-inner {
  max-width: 860px;
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow-y: auto;
}

:root .chat-workspace .chat-widget-header {
  display: none;
}

.chat-workspace .chat-quick-chips {
  display: none;
}

.chat-workspace .chat-header-meta {
  min-width: 0;
}

.chat-workspace .chat-header-controls {
  flex-shrink: 0;
}

/* Executive Project Selector Pill */
.custom-project-selector {
  position: relative;
  display: inline-flex;
}

.project-select-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: var(--radius-btn, 10px);
  background: var(--color-surface, #FFFFFF);
  border: 1px solid var(--color-border, #E3E3E6);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  color: var(--color-text, #18181B);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  transition: all 0.15s ease;
}

.project-select-trigger:hover {
  background: var(--color-surface-hover, #F4F4F5);
  border-color: var(--color-border-strong, #D1D1D6);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.custom-project-selector.active .project-select-trigger {
  border-color: var(--color-primary, #2F5BFF);
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.15);
}

.selector-icon {
  display: inline-flex;
  align-items: center;
  color: var(--color-primary, #2F5BFF);
}

.selector-icon .ui-icon {
  width: 14px;
  height: 14px;
}

.selector-label-main {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  color: var(--color-text, #18181B);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selector-caret {
  font-size: var(--text-xs);
  color: var(--color-text-muted, #71717A);
  transition: transform 0.2s ease;
}

.custom-project-selector.active .selector-caret {
  transform: rotate(180deg);
  color: var(--color-primary, #2F5BFF);
}

.project-select-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 300px;
  max-width: 380px;
  z-index: 100;
  background: rgba(21, 25, 34, 0.94);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 16px 40px -4px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 8px;
}

.dropdown-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text-muted, #94a3b8);
  border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  margin-bottom: 6px;
}

.proj-count-badge {
  background: var(--color-surface-hover, rgba(255, 255, 255, 0.08));
  color: var(--color-text-secondary, #94a3b8);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.dropdown-options-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.project-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text, #f8fafc);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  transition: all 0.15s ease;
}

.project-select-option:hover {
  background: var(--color-surface-hover, rgba(255, 255, 255, 0.06));
  color: #ffffff;
}

.project-select-option.selected {
  background: var(--component-selected-bg, rgba(47, 91, 255, 0.16));
  border-color: rgba(47, 91, 255, 0.35);
}

.project-select-option.selected .option-name {
  color: var(--color-primary, #60a5fa);
  font-weight: var(--weight-medium);
}

.project-select-option .option-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted, #94a3b8);
}

/* Light Theme Overrides */
html[data-theme="light"] .project-select-dropdown {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 40px -4px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .dropdown-header-bar {
  color: #71717A;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .proj-count-badge {
  background: #F4F4F5;
  color: #52525B;
}

html[data-theme="light"] .project-select-option {
  color: #18181B;
}

html[data-theme="light"] .project-select-option:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #18181B;
}

html[data-theme="light"] .project-select-option.selected {
  background: rgba(47, 91, 255, 0.08);
  border-color: rgba(47, 91, 255, 0.2);
}

html[data-theme="light"] .project-select-option.selected .option-name {
  color: #2F5BFF;
}

html[data-theme="light"] .project-select-option .option-sub {
  color: #71717A;
}

/* Header Icon Buttons */
.chat-hdr-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-surface, #FFFFFF);
  border: 1px solid var(--color-border, #E3E3E6);
  color: var(--color-text-secondary, #52525B);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-hdr-icon-btn:hover {
  background: var(--color-surface-hover, #F4F4F5);
  color: var(--color-text, #18181B);
  border-color: var(--color-border-strong, #D1D1D6);
}

.chat-hdr-icon-btn.close-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Chat Welcome Hero */
.chat-workspace .chat-workspace-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: auto 0 28px;
  padding-top: 16px;
}

.chat-workspace-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(47, 91, 255, 0.08);
  color: var(--color-primary, #2F5BFF);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.chat-workspace-welcome h1 {
  font-size: var(--type-page-size);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: #0F172A;
  margin: 0;
}

.greeting-gradient {
  background: linear-gradient(135deg, #2563EB 0%, #D946EF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html:not([data-theme="light"]) .chat-workspace-welcome h1 {
  color: #FFFFFF;
}

html:not([data-theme="light"]) .greeting-gradient {
  background: linear-gradient(135deg, #60A5FA 0%, #E879F9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chat-workspace:not(.has-conversation) .chat-history-body {
  display: none;
}

.chat-workspace.has-conversation .chat-workspace-welcome {
  display: none;
}

.chat-workspace .chat-history-body {
  min-height: 0;
  padding: 16px 0 24px;
}

:root .chat-workspace .chat-input-footer {
  padding: 0 0 max(24px, env(safe-area-inset-bottom));
  background: transparent;
  flex-shrink: 0;
}

.chat-workspace:not(.has-conversation) .chat-input-footer {
  margin-bottom: auto;
}

/* Modern Composer Box */
:root .chat-workspace .chat-input-box {
  display: flex;
  flex-direction: column;
  min-height: 84px;
  padding: 12px 14px 10px 18px;
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 20px;
  background: var(--color-surface, #FFFFFF);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-workspace .chat-input-box:focus-within {
  border-color: var(--color-primary, #2F5BFF);
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.16), 0 8px 24px -4px rgba(47, 91, 255, 0.12);
}

:root .chat-workspace .chat-input-field {
  min-width: 0;
  flex: 1 1 auto;
  min-height: 38px;
  max-height: 140px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text, #18181B);
  font-size: var(--text-sm);
  line-height: 1.55;
  box-shadow: none;
  outline: none;
}

:root .chat-workspace .chat-input-field::placeholder {
  color: var(--color-text-muted, #94A3B8);
  font-size: var(--text-sm);
}

.chat-workspace .chat-submit-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-workspace .chat-submit-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

.chat-workspace .chat-submit-btn:active {
  transform: scale(0.97);
}

.chat-workspace .chat-workspace-notice {
  display: block;
  margin: 12px 0 0;
  text-align: center;
  color: var(--color-text-muted, #94A3B8);
  font-size: var(--text-xs);
}

/* Elevated Suggestion Cards */
.chat-workspace .chat-workspace-suggestions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.chat-workspace-suggestions button {
  padding: 16px 18px;
  min-height: 92px;
  text-align: left;
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 16px;
  background: var(--color-surface, #FFFFFF);
  color: var(--color-text, #0F172A);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: flex-start;
}

.chat-workspace-suggestions button:hover {
  background: var(--color-surface, #FFFFFF);
  border-color: var(--color-primary, #2F5BFF);
  color: var(--color-primary, #2F5BFF);
  box-shadow: 0 6px 20px -2px rgba(47, 91, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.chat-workspace-suggestions button:active {
  transform: translateY(0);
}

html:not([data-theme="light"]) .chat-workspace-suggestions button {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(255, 255, 255, 0.08);
  color: #F8FAFC;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

html:not([data-theme="light"]) .chat-workspace-suggestions button:hover {
  background: rgba(22, 33, 62, 0.85);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93C5FD;
}

.chat-workspace.has-conversation .chat-workspace-suggestions {
  display: none;
}

@media (max-width: 980px) {
  :root body .gis-chat-widget.chat-workspace {
    left: 0;
    padding: 0 16px;
  }
}

@media (max-width: 640px) {
  .chat-workspace .chat-workspace-suggestions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chat-workspace .chat-workspace-welcome {
    padding-top: 8px;
    margin-bottom: 20px;
  }
  :root .chat-workspace .chat-widget-header {
    gap: 8px;
  }
  .chat-workspace .chat-header-actions {
    gap: 0;
  }
}

/* Chat and rich text (Modal Overlay only) */
html[data-theme="light"] .gis-chat-widget:not(.chat-workspace) {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

html[data-theme="light"] .gis-chat-widget:not(.chat-workspace) .chat-fullscreen-inner {
  border-color: var(--color-border);
  background: #ffffff;
  box-shadow: 0 24px 64px -12px rgba(13, 19, 40, 0.18), 0 4px 16px rgba(13, 19, 40, 0.06);
}

html[data-theme="light"] .chat-widget-header {
  border: none;
  background: transparent;
}

html[data-theme="light"] .chat-input-footer {
  border: none;
  background: transparent;
}

html[data-theme="light"] :where(
  .chat-brand-title,
  .selector-label-main,
  .project-select-option,
  .option-name,
  .markdown-body .md-strong,
  .markdown-body strong,
  .markdown-body b,
  .markdown-body .md-h1,
  .markdown-body .md-h2,
  .markdown-body .md-h3
) {
  color: var(--color-text);
}

html[data-theme="light"] .chat-brand-status,
html[data-theme="light"] .selector-caret,
html[data-theme="light"] .thinking-text,
html[data-theme="light"] .chat-quick-chips button {
  color: var(--color-text-muted);
}

html[data-theme="light"] .project-select-trigger {
  border-color: var(--color-border);
  background: #ffffff;
  color: var(--color-text);
}

html[data-theme="light"] .project-select-trigger:hover {
  border-color: var(--component-selected-border);
  background: var(--color-surface);
  color: var(--color-text) !important;
}

html[data-theme="light"] .project-select-dropdown {
  background: #ffffff;
  border-color: var(--color-border);
  box-shadow: 0 16px 40px rgba(13, 19, 40, 0.15);
}

html[data-theme="light"] .project-select-option {
  color: var(--color-text);
}

html[data-theme="light"] .project-select-option:hover {
  background: rgba(47, 91, 255, 0.08);
  border-color: rgba(47, 91, 255, 0.2);
  color: var(--color-blue-700);
}

html[data-theme="light"] .project-select-option.selected {
  background: rgba(47, 91, 255, 0.12);
  border-color: var(--color-blue-500);
}

html[data-theme="light"] .chat-hdr-icon-btn {
  background: rgba(21, 34, 71, 0.04);
  border-color: rgba(21, 34, 71, 0.08);
  color: var(--color-text-muted);
}

html[data-theme="light"] .chat-hdr-icon-btn:hover {
  background: rgba(21, 34, 71, 0.09);
  border-color: rgba(21, 34, 71, 0.15);
  color: var(--color-text);
}

html[data-theme="light"] .chat-hdr-icon-btn.close-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--color-danger);
}

html[data-theme="light"] .chat-quick-chips button {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

html[data-theme="light"] .chat-quick-chips button:hover {
  border-color: var(--component-selected-border);
  background: #ffffff;
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] .chat-input-box {
  border-color: var(--color-border);
  background: #ffffff !important;
  box-shadow: var(--shadow-1);
}

html[data-theme="light"] .chat-input-box:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-2);
}

html[data-theme="light"] .chat-input-box:focus-within {
  border-color: var(--component-selected-border);
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.14), var(--shadow-2);
}

html[data-theme="light"] .chat-input-field {
  color: var(--color-text) !important;
}

html[data-theme="light"] .chat-input-field::placeholder {
  color: var(--color-text-muted) !important;
  opacity: 0.8;
}

html[data-theme="light"] .chat-submit-btn {
  background: linear-gradient(135deg, var(--color-blue-600) 0%, var(--color-blue-700) 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(47, 91, 255, 0.32);
}

html[data-theme="light"] .chat-submit-btn:hover {
  background: linear-gradient(135deg, var(--color-blue-500) 0%, var(--color-blue-600) 100%) !important;
  box-shadow: 0 4px 14px rgba(47, 91, 255, 0.45);
}

html[data-theme="light"] .chat-bubble.gis .bubble-content {
  border-color: rgba(21, 34, 71, 0.1);
  background: #ffffff;
  color: var(--color-text);
  box-shadow: 0 2px 8px rgba(13, 19, 40, 0.04);
}

html[data-theme="light"] .chat-bubble.user .bubble-content {
  background: linear-gradient(135deg, var(--color-blue-600) 0%, var(--color-blue-700) 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(47, 91, 255, 0.22);
}

html[data-theme="light"] .action-chip-btn {
  background: rgba(47, 91, 255, 0.08);
  border-color: rgba(47, 91, 255, 0.25);
  color: var(--color-blue-700);
}

html[data-theme="light"] .action-chip-btn:hover {
  background: var(--color-blue-600);
  border-color: var(--color-blue-600);
  color: #ffffff !important;
}

html[data-theme="light"] .markdown-body {
  color: var(--color-text);
}

html[data-theme="light"] .markdown-body .md-inline-code,
html[data-theme="light"] .markdown-body .md-code-block {
  border-color: var(--color-border-strong);
  background: var(--component-code-bg);
  color: #145f4a;
}

html[data-theme="light"] .markdown-body .md-quote,
html[data-theme="light"] .markdown-body .md-table td {
  color: var(--color-text-secondary);
}

html[data-theme="light"] .markdown-body .md-table-wrapper {
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-1);
}

/* Authentication and Clerk */
html[data-theme="light"] .auth-card-wrapper {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
  box-shadow: var(--shadow-3);
}

html[data-theme="light"] .auth-brand-text h2,
html[data-theme="light"] .auth-title {
  color: var(--color-text);
}

html[data-theme="light"] .auth-tabs-toggle {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
}

html[data-theme="light"] .auth-tab-btn:hover:not(.active) {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

html[data-theme="light"] :where(
  .cl-formFieldLabel,
  .cl-identityPreviewText,
  .cl-userPreviewMainIdentifier,
  .cl-formFieldInputShowPasswordButton
) {
  color: var(--color-text) !important;
}

html[data-theme="light"] :where(
  .cl-headerSubtitle,
  .cl-dividerText,
  .cl-footerActionText,
  .cl-formFieldHintText,
  .cl-identityPreviewSecondaryIdentifier
) {
  color: var(--color-text-muted) !important;
}

html[data-theme="light"] .cl-formFieldInput,
html[data-theme="light"] .cl-socialButtonsBlockButton {
  border-color: var(--color-border-strong) !important;
  background: var(--component-control-bg) !important;
  color: var(--color-text) !important;
}

html[data-theme="light"] .cl-socialButtonsBlockButtonText {
  color: var(--color-text) !important;
}

html[data-theme="light"] .cl-dividerLine {
  background: var(--color-border) !important;
}

/* Gantt: preserve saturated bars, theme the surrounding data table */
html[data-theme="light"] .gantt-controls-bar,
html[data-theme="light"] .gantt-header-row,
html[data-theme="light"] .gantt-header-task-col {
  border-color: var(--color-border);
  background: var(--color-surface-raised);
}

html[data-theme="light"] .gantt-stage-row,
html[data-theme="light"] .gantt-stage-name-cell {
  border-color: var(--color-border);
  background: #eef2f8;
}

html[data-theme="light"] .gantt-stage-name-cell:hover,
html[data-theme="light"] .gantt-task-row:hover .gantt-task-name-cell {
  background: #e5ebf5;
}

html[data-theme="light"] .gantt-task-name-cell {
  border-color: var(--color-border);
  background: #ffffff;
}

html[data-theme="light"] :where(
  .gantt-stage-title,
  .gantt-task-title,
  .gantt-stage-name-cell,
  .gantt-tick-date,
  .gantt-action-btn
) {
  color: var(--color-text-secondary);
}

html[data-theme="light"] .gantt-action-btn {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
}

html[data-theme="light"] .gantt-scroll-container::-webkit-scrollbar-track {
  background: var(--color-surface-muted);
}

html[data-theme="light"] .gantt-tick-cell,
html[data-theme="light"] .gantt-task-row,
html[data-theme="light"] .gantt-grid-line {
  border-color: var(--color-border);
}

html[data-theme="light"] .gantt-project-start-line {
  background: #2563eb;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.4);
}

html[data-theme="light"] .gantt-project-start-badge {
  background: #2563eb;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

html[data-theme="light"] .gantt-project-end-line {
  background: #059669;
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.4);
}

html[data-theme="light"] .gantt-project-end-badge {
  background: #059669;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

html[data-theme="light"] .gantt-milestone-vertical-line {
  border-left-color: #d97706;
}

html[data-theme="light"] .gantt-milestone-header-badge {
  background: rgba(245, 158, 11, 0.12);
  border-color: #d97706;
  color: #b45309;
}

/* User management and Company Settings light mode support */
html[data-theme="light"] .user-mgmt-title h3,
html[data-theme="light"] .company-settings-title h3 {
  color: var(--color-text);
}

html[data-theme="light"] .company-select-card {
  background: var(--color-surface);
  border-color: var(--color-border);
}

html[data-theme="light"] .company-select-card:hover {
  background: var(--color-surface-hover);
}

html[data-theme="light"] .company-select-card.selected {
  background: var(--component-selected-bg);
  border-color: var(--color-primary);
}

html[data-theme="light"] .company-kpi-card {
  background: var(--color-surface);
  border-color: var(--color-border);
}

html[data-theme="light"] .user-directory-toolbar {
  background: var(--color-surface);
  border-color: var(--color-border);
}

html[data-theme="light"] .mgmt-tab:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

html[data-theme="light"] .mgmt-tab.active {
  background: var(--component-selected-bg);
  color: var(--color-primary);
}

html[data-theme="light"] .role-admin {
  color: #765800;
}

html[data-theme="light"] .status-approved {
  color: #087a58;
}

html[data-theme="light"] .status-pending {
  color: #985000;
}

html[data-theme="light"] .status-rejected {
  color: #bd3148;
}

html[data-theme="light"] .lock-banner-content[style] {
  background: #ffffff !important;
  color: var(--color-text) !important;
}

@media (max-width: 51.25rem) {
  html[data-theme="light"] .app-header {
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  html[data-theme="light"] .nav-tabs {
    border-color: var(--color-border-strong);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-2);
  }
}

/* ==========================================================================
   APP UNIVERSAL CONTRAST CORRECTION FOR LIGHT THEME
   ========================================================================== */

html[data-theme="light"] :where(
  h1, h2, h3, h4, h5, h6,
  strong, b,
  .brand span,
  .user-info strong,
  .project-card-title,
  .task-title,
  .timeline-task-name,
  .kpi-stat-info strong,
  .kpi-card strong,
  .modal-title,
  .modal-card h2,
  .modal-card h3,
  .table th,
  .table td strong,
  .an-kpi-card strong,
  .an-chart-card h3,
  .an-card h3,
  .summary-item strong,
  .form-group label,
  .control-label
) {
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] :where(
  p,
  .user-info small,
  .kpi-stat-info small,
  .text-muted,
  .table td,
  .task-meta,
  .project-card p,
  .modal-desc,
  .an-insight-item p,
  .an-card p,
  .tab-desc
) {
  color: var(--color-text-secondary, #3f4b63) !important;
}

/* Ensure solid blue/colored buttons, toasts, and user message bubbles ALWAYS keep white text & icons (Theme-Agnostic WCAG Invariant) */
:where(
  .btn-primary,
  .primary-btn,
  .primary-btn-sm,
  .action-btn.is-primary,
  .project-detail-btn.is-primary,
  .an-open-project-btn.is-primary,
  .approve-user-btn,
  .chat-submit-btn,
  .chat-bubble.user .bubble-content,
  .toast-success,
  .toast-error,
  .toast-primary,
  .toast-info
) {
  color: #ffffff !important;
}

:where(
  .btn-primary,
  .primary-btn,
  .primary-btn-sm,
  .action-btn.is-primary,
  .project-detail-btn.is-primary,
  .an-open-project-btn.is-primary,
  .approve-user-btn,
  .chat-submit-btn,
  .chat-bubble.user .bubble-content,
  .toast-success,
  .toast-error,
  .toast-primary,
  .toast-info
) :is(span, b, strong, i, em, small, p, svg, .ui-icon, use, line, path, polygon, circle) {
  color: #ffffff !important;
}

:where(.primary-btn, .primary-btn-sm, .btn-primary, .action-btn.is-primary, .chat-submit-btn) :is(svg, .ui-icon) {
  stroke: #ffffff !important;
}

/* ==========================================================================
   LIGHT THEME INTERACTIVE CONTRAST REINFORCEMENT (HOVER / ACTIVE / CLICK)
   Accentuates text from muted gray to crisp dark navy/black or primary blue
   ========================================================================== */

/* Main navigation tabs */
html[data-theme="light"] .nav-tab {
  color: var(--color-text-secondary, #3f4b63) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 8px !important;
}

html[data-theme="light"] .nav-tab:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--color-text, #18181b) !important;
}

html[data-theme="light"] .nav-tab.active {
  background: var(--component-selected-bg, #eaf1ff) !important;
  border: none !important;
  color: #2f5bff !important;
  font-weight: var(--weight-semibold) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

html[data-theme="light"] .nav-tab:active {
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] .nav-tab :is(span, svg, .ui-icon) {
  color: inherit !important;
  stroke: currentColor !important;
}

/* Project detail sub-tabs */
html[data-theme="light"] .detail-sub-tab {
  color: var(--color-text-secondary, #64748B) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 8px !important;
}

html[data-theme="light"] .detail-sub-tab:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--color-text, #18181b) !important;
}

html[data-theme="light"] .detail-sub-tab.active {
  color: #2449d8 !important;
  background: var(--color-surface, #ffffff) !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: var(--weight-semibold) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] .detail-sub-tab:active {
  color: #2449d8 !important;
}

html[data-theme="light"] .detail-sub-tab :is(span, b, strong, svg, .ui-icon) {
  color: inherit !important;
  stroke: currentColor !important;
}

/* Executive analysis and dashboard sub-tabs */
html[data-theme="light"] .an-tab-btn,
html[data-theme="light"] #view-executive .an-tab-btn {
  color: var(--color-text-secondary, #64748B) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 8px !important;
}

html[data-theme="light"] .an-tab-btn:hover,
html[data-theme="light"] #view-executive .an-tab-btn:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--color-text, #18181b) !important;
}

html[data-theme="light"] .an-tab-btn.active,
html[data-theme="light"] #view-executive .an-tab-btn.active {
  background: var(--color-surface, #ffffff) !important;
  border: none !important;
  border-radius: 8px !important;
  color: #2f5bff !important;
  font-weight: var(--weight-semibold) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] .an-tab-btn:active,
html[data-theme="light"] #view-executive .an-tab-btn:active {
  color: #2f5bff !important;
}

html[data-theme="light"] .an-tab-btn :is(span, b, strong, svg, .ui-icon) {
  color: inherit !important;
  stroke: currentColor !important;
}

/* User management and authentication tabs */
html[data-theme="light"] .mgmt-tab {
  color: var(--color-text-secondary, #64748B) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 8px !important;
}

html[data-theme="light"] .mgmt-tab:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--color-text, #18181b) !important;
}

html[data-theme="light"] .mgmt-tab.active {
  background: var(--color-surface, #ffffff) !important;
  border: none !important;
  border-radius: 8px !important;
  color: #2f5bff !important;
  font-weight: var(--weight-semibold) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] .mgmt-tab:active {
  color: #2f5bff !important;
}

html[data-theme="light"] .auth-tab-btn:hover:not(.active) {
  background: var(--color-surface-hover, #e5ebf5) !important;
  color: var(--color-text, #11182b) !important;
}

/* Secondary, Ghost, Outline and Default Action Buttons */
html[data-theme="light"] :where(
  .secondary-btn,
  .secondary-btn-sm,
  .btn-secondary,
  .btn-ghost,
  .btn-outline,
  .action-btn:not(.is-primary),
  .gantt-action-btn:not(.active)
) {
  color: var(--color-text-secondary, #3f4b63) !important;
  background: var(--color-surface-muted, #eef2f8) !important;
  border-color: var(--color-border, #dbe2ed) !important;
}

html[data-theme="light"] :where(
  .secondary-btn,
  .secondary-btn-sm,
  .btn-secondary,
  .btn-ghost,
  .btn-outline,
  .action-btn:not(.is-primary),
  .gantt-action-btn:not(.active)
):hover {
  color: var(--color-text, #11182b) !important;
  background: var(--color-surface-hover, #e5ebf5) !important;
  border-color: var(--color-border-strong, #c4cedd) !important;
}

html[data-theme="light"] :where(
  .secondary-btn,
  .secondary-btn-sm,
  .btn-secondary,
  .btn-ghost,
  .btn-outline,
  .action-btn:not(.is-primary),
  .gantt-action-btn
):active {
  color: var(--color-text, #11182b) !important;
  background: #dbe2ed !important;
}

html[data-theme="light"] :where(
  .secondary-btn,
  .secondary-btn-sm,
  .btn-secondary,
  .btn-ghost,
  .btn-outline,
  .action-btn:not(.is-primary),
  .gantt-action-btn
) :is(span, b, strong, i, em, small, p) {
  color: inherit !important;
}

html[data-theme="light"] :where(
  .secondary-btn,
  .secondary-btn-sm,
  .btn-secondary,
  .btn-ghost,
  .btn-outline,
  .action-btn:not(.is-primary),
  .gantt-action-btn
) :is(svg, .ui-icon) {
  stroke: currentColor !important;
  color: inherit !important;
}

/* Gantt active action buttons */
html[data-theme="light"] .gantt-action-btn.active {
  color: var(--color-primary, #2449d8) !important;
  background: var(--component-selected-bg, rgba(36, 73, 216, 0.12)) !important;
  border-color: var(--color-primary, #2449d8) !important;
  font-weight: var(--weight-semibold) !important;
}

html[data-theme="light"] .gantt-action-btn.active :is(span, b, strong, svg, .ui-icon) {
  color: inherit !important;
  stroke: currentColor !important;
}

/* Chips, Filter Chips, Interactive Chips and Chat Quick Chips */
html[data-theme="light"] .chip,
html[data-theme="light"] .filter-chip,
html[data-theme="light"] .status-tab,
html[data-theme="light"] .chat-quick-chips button,
html[data-theme="light"] .chips-interactive-wrap .chip {
  color: var(--color-text-secondary, #3f4b63) !important;
  background: var(--color-surface-muted, #eef2f8) !important;
  border-color: var(--color-border, #dbe2ed) !important;
}

html[data-theme="light"] .chip:hover,
html[data-theme="light"] .filter-chip:hover,
html[data-theme="light"] .status-tab:hover,
html[data-theme="light"] .chat-quick-chips button:hover,
html[data-theme="light"] .chips-interactive-wrap .chip:hover {
  color: var(--color-text, #11182b) !important;
  background: var(--color-surface-hover, #e5ebf5) !important;
  border-color: var(--color-border-strong, #c4cedd) !important;
}

html[data-theme="light"] .chip.selected,
html[data-theme="light"] .filter-chip.active,
html[data-theme="light"] .status-tab.active,
html[data-theme="light"] .chat-quick-chips button.active,
html[data-theme="light"] .chips-interactive-wrap .chip.selected {
  color: var(--color-primary, #2449d8) !important;
  background: var(--component-selected-bg, rgba(36, 73, 216, 0.09)) !important;
  border-color: var(--component-selected-border, rgba(36, 73, 216, 0.34)) !important;
  font-weight: var(--weight-medium) !important;
}

html[data-theme="light"] .chip:active,
html[data-theme="light"] .filter-chip:active,
html[data-theme="light"] .status-tab:active,
html[data-theme="light"] .chat-quick-chips button:active,
html[data-theme="light"] .chips-interactive-wrap .chip:active {
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] :where(
  .chip,
  .filter-chip,
  .status-tab,
  .chips-interactive-wrap .chip
) :is(span, b, strong, svg, .ui-icon),
html[data-theme="light"] .chat-quick-chips button :is(span, b, strong, svg, .ui-icon) {
  color: inherit !important;
  stroke: currentColor !important;
}

/* User badge, Company reset button and dropdown menus */
html[data-theme="light"] .user-access-badge:hover,
html[data-theme="light"] .user-access-badge:active,
html[data-theme="light"] .reset-btn:hover,
html[data-theme="light"] .reset-btn:active {
  border-color: var(--color-border-strong, #c4cedd) !important;
  background: var(--color-surface-hover, #e5ebf5) !important;
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] :is(.user-access-badge:hover, .user-access-badge:active) :is(.user-info strong, .user-info small, .dropdown-chevron),
html[data-theme="light"] .dropdown-user-name {
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] .dropdown-item:hover,
html[data-theme="light"] .dropdown-item:focus,
html[data-theme="light"] .dropdown-item:active,
html[data-theme="light"] .project-select-option:hover,
html[data-theme="light"] .project-select-option:focus,
html[data-theme="light"] .project-select-option:active {
  border-color: var(--color-border, #dbe2ed) !important;
  background: var(--color-surface-hover, #e5ebf5) !important;
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] .dropdown-item:hover :is(strong, small, span, b),
html[data-theme="light"] .project-select-option:hover :is(strong, small, span, b) {
  color: var(--color-text, #11182b) !important;
}

/* Interactive labels, summaries, assistance steps, and close/icon buttons */
html[data-theme="light"] :where(
  label,
  .control-label,
  .form-group label,
  .an-assistant-field label,
  .an-filter-fields > label > span,
  .chart-howto summary,
  .an-filter-panel > summary,
  .an-assistant-steps .active,
  .evidence-links a,
  .quick-suggestions button,
  .an-refresh-btn,
  .chat-hdr-icon-btn,
  .drawer-close-btn,
  .modal-close-btn,
  .icon-btn
):hover {
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] :where(
  label,
  .control-label,
  .form-group label,
  .an-assistant-field label,
  .an-filter-fields > label > span,
  .chart-howto summary,
  .an-filter-panel > summary,
  .an-assistant-steps .active,
  .evidence-links a,
  .quick-suggestions button,
  .an-refresh-btn,
  .chat-hdr-icon-btn,
  .drawer-close-btn,
  .modal-close-btn,
  .icon-btn
):active {
  color: var(--color-text, #11182b) !important;
}

html[data-theme="light"] .an-assistant-steps .active {
  color: var(--color-text, #11182b) !important;
  font-weight: var(--weight-semibold) !important;
}

html[data-theme="light"] .an-assistant-steps .active b {
  background: var(--color-primary, #2449d8) !important;
  color: #ffffff !important;
}

/* ====================================================
   Apple Design Accessibility & Motion Adaptations (§14)
   ==================================================== */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0.01ms;
    --duration-normal: 0.01ms;
    --duration-sheet: 0.01ms;
  }

  .gis-modal-card,
  .modal-card,
  .gis-chat-widget,
  .an-drawer-body,
  .user-dropdown-menu {
    transform: none !important;
    animation: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  :root,
  html[data-theme="light"] {
    --apple-material-thick: var(--color-bg);
    --apple-material-regular: var(--color-surface);
    --apple-material-thin: var(--color-surface-raised);
    --apple-blur-thick: none;
    --apple-blur-regular: none;
    --apple-blur-thin: none;
    --apple-blur-header: none;
  }

  .app-header,
  .user-dropdown-menu,
  .gis-chat-widget,
  .gis-modal-card,
  .modal-card,
  .an-drawer-body,
  .notification-center-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* Shared typography for server-independent view templates. */
strong, b { font-weight: var(--weight-semibold); }
.type-2xl { font-size: var(--text-2xl); }
.type-3xl { font-size: var(--text-3xl); }
.type-4xl { font-size: var(--text-4xl); }
.type-lg { font-size: var(--text-lg); }
.type-md { font-size: var(--text-md); }
.type-medium { font-weight: var(--weight-medium); }
.type-mono { font-family: var(--font-mono); }
.type-semibold { font-weight: var(--weight-semibold); }
.type-sm { font-size: var(--text-sm); }
.type-xl { font-size: var(--text-xl); }
.type-xs { font-size: var(--text-xs); }

.type-regular { font-weight: var(--weight-regular); }
