:root {
  /* Surface and UI tokens can vary between versions, 
     but branding tokens are imported from branding.css */
  --surface: #f9f9f9;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f1f3f4;
  --surface-container: #eeeeee;
  --surface-container-high: #e2e2e2;
  --on-surface: #1a1c1c;
  --on-surface-variant: #3f4949;
  --outline-variant: rgba(63, 73, 73, 0.15);
}

body {
  background-color: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-main);
}

.financial-card {
  background: var(--surface-container-lowest);
  border-radius: 1.5rem;
  padding: 2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.financial-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.08);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
  color: white;
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--surface-container-high);
  color: var(--on-surface);
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.metric-spotlight {
  border-left: 4px solid var(--secondary);
  background: var(--surface-container-lowest);
  padding: 1.5rem;
  border-radius: 0.5rem 1.5rem 1.5rem 0.5rem;
}

.glass-modal {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid var(--outline-variant);
}

/* Utility for Grab-to-Scroll */
.grab-scroll { 
  cursor: grab; 
  user-select: text; 
  scroll-behavior: auto !important; /* Smooth scroll makes drag jerky */
}
.grabbing-scroll { 
  cursor: grabbing; 
  user-select: text; 
}

/* Hide mobile trigger by default (Desktop) */
.mobile-menu-trigger {
  display: none !important;
}
#kanbanBoard::-webkit-scrollbar {
  height: 6px;
}
#kanbanBoard::-webkit-scrollbar-track {
  background: transparent;
}
#kanbanBoard::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
#kanbanBoard::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Ensure main content takes remaining space */
main, .main-canvas {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  min-width: 0;
}

.app-container {
  display: flex !important;
  flex-direction: row !important;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* Sidebar States (Unified Styles for #sidebar and .sidebar) */
#sidebar, .sidebar {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
}

#sidebar.collapsed, .sidebar.collapsed {
  width: 80px !important;
}

#sidebar.collapsed .sidebar-text,
#sidebar.collapsed .logo-info,
#sidebar.collapsed .export-label,
#sidebar.collapsed .logo-container h1,
#sidebar.collapsed .logo-container p,
.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .logo-info {
  display: none !important;
}

#sidebar.collapsed .logo-container,
.sidebar.collapsed .logo-container {
  padding-left: 0;
  padding-right: 0;
  justify-content: center;
}

#sidebar.collapsed .nav-link,
.sidebar.collapsed .nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

#sidebar.collapsed .export-btn span:last-child {
  display: none;
}

#sidebar.collapsed .export-card {
  padding: 1rem 0.5rem;
}

.toggle-sidebar-btn {
  position: absolute;
  right: -16px;
  top: 36px;
  width: 32px;
  height: 32px;
  background: var(--primary, #004042);
  border: 4px solid #f9f9f9; /* Surface color match to look integrated */
  border-radius: 50%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: white;
}

.toggle-sidebar-btn span {
  font-size: 18px !important;
  font-weight: bold;
}

.toggle-sidebar-btn:hover {
  background: var(--primary-container, #00595c);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#sidebar.collapsed .toggle-sidebar-btn,
.sidebar.collapsed .toggle-sidebar-btn {
  transform: rotate(180deg);
}

/* Language Selector */
.lang-selector {
  @apply flex items-center gap-2 bg-slate-50 border border-slate-200 rounded-xl px-2 py-1.5 transition-all hover:bg-white hover:border-slate-300;
}
.lang-btn {
  @apply px-2 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest cursor-pointer transition-all border border-transparent;
}
.lang-btn.active#btn-pt {
  @apply bg-emerald-600 border-emerald-600 text-white shadow-sm;
}
.lang-btn.active#btn-en {
  @apply bg-indigo-600 border-indigo-600 text-white shadow-sm;
}
.lang-btn.active#btn-de {
  @apply bg-amber-500 border-amber-500 text-black shadow-sm;
}
.lang-btn:not(.active) {
  @apply text-slate-400 hover:text-[#004042] hover:bg-slate-100;
}

/* ============================================================
   MOBILE-FIRST RESPONSIVE UTILITIES 2026
   ============================================================ */

/* 1. Global Touch Optimization */
@media (max-width: 1024px) {
  :root { --sidebar-width: 0px !important; }

  aside#sidebar, aside.sidebar {
    position: fixed !important;
    left: -320px !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    z-index: 1000 !important;
    margin-left: 0 !important;
    box-shadow: 20px 0 50px rgba(0,0,0,0.15) !important;
    background: white !important;
    display: flex !important;
    visibility: hidden !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), left 0.4s ease, visibility 0.4s !important;
  }

  aside#sidebar.sidebar-opened, aside.sidebar.sidebar-opened {
    left: 0 !important;
    visibility: visible !important;
  }




  main, .main-canvas {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    padding-bottom: 80px !important; /* Space for floating button */
  }

  .toggle-sidebar-btn {
    display: none !important;
  }

  /* Overlay */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 64, 66, 0.3);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Mobile Floating Menu Trigger - Bottom Right for ergonomics */
  .mobile-menu-trigger {
    display: flex !important;
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    width: 60px !important;
    height: 60px !important;
    background: #004042 !important;
    color: white !important;
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 950 !important;
    box-shadow: 0 8px 32px rgba(0, 64, 66, 0.4) !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  }
  .mobile-menu-trigger:active {
    transform: scale(0.9);
  }
  .mobile-menu-trigger span {
    font-size: 28px !important;
  }
}


/* 2. Responsive Layout Grids */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  header {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 1.5rem !important;
    gap: 1.5rem !important;
  }

  header .flex {
    justify-content: center !important;
    width: 100% !important;
  }

  .p-8, .px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 1rem !important;
  }
}

/* 3. Modal Scalability */
@media (max-width: 640px) {
  .fixed.inset-0 .bg-white {
    width: 95% !important;
    margin: 1rem !important;
    max-height: 90vh !important;
    border-radius: 1.5rem !important;
  }

  .text-5xl { font-size: 2.25rem !important; }
  .text-4xl { font-size: 1.875rem !important; }
  .text-3xl { font-size: 1.5rem !important; }
  
  /* Tables horizontal scroll indicator */
  .overflow-x-auto {
    position: relative;
    border-radius: 0.75rem;
    border: 1px solid #f1f5f9;
  }
}

/* 4. Kanban Column Stacking for Swipeable Experience */
@media (max-width: 640px) {
  #contentCanvas {
    display: flex !important;
    overflow-x: auto !important;
    gap: 1rem !important;
    padding: 1rem !important;
    scroll-snap-type: x mandatory;
  }

  .kanban-column {
    min-width: 85vw !important;
    max-width: 85vw !important;
    scroll-snap-align: center;
  }
}

