/* ========================================
   KNOX DASHBOARD - COMPREHENSIVE RESPONSIVE DESIGN
   Tablet & Mobile Adaptation
   ======================================== */

/* ════════════════════════════════════════
   CSS CUSTOM PROPERTIES - FLUID TYPOGRAPHY
   ════════════════════════════════════════ */
:root {
  /* Fluid font sizes using clamp() */
  --font-xs: clamp(10px, 1vw, 11px);
  --font-sm: clamp(11px, 1.2vw, 12px);
  --font-base: clamp(12px, 1.5vw, 14px);
  --font-md: clamp(13px, 1.8vw, 15px);
  --font-lg: clamp(14px, 2vw, 16px);
  --font-xl: clamp(16px, 2.5vw, 18px);
  --font-2xl: clamp(18px, 3vw, 24px);
  --font-3xl: clamp(20px, 4vw, 32px);
  
  /* Touch target sizes (min 44px for accessibility) */
  --touch-min: 44px;
  --touch-comfortable: 48px;
  --touch-large: 56px;
  
  /* Spacing scale */
  --space-xs: clamp(4px, 1vw, 8px);
  --space-sm: clamp(8px, 2vw, 12px);
  --space-md: clamp(12px, 3vw, 16px);
  --space-lg: clamp(16px, 4vw, 24px);
  --space-xl: clamp(20px, 5vw, 32px);
  
  /* Sidebar width */
  --sidebar-width: 300px;
  --sidebar-collapsed: 60px;
}

/* ════════════════════════════════════════
   MOBILE MENU & NAVIGATION
   ════════════════════════════════════════ */

/* Hamburger menu button - hidden on desktop */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  width: var(--touch-large);
  height: var(--touch-large);
  background: rgba(26, 26, 38, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 200, 0.3);
  border-radius: 10px;
  z-index: 2000;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
  border-color: var(--mint);
  box-shadow: 0 0 15px rgba(0, 255, 200, 0.2);
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--mint);
  border-radius: 1px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(5px);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* ════════════════════════════════════════
   TABLET OPTIMIZATIONS (768px - 1024px)
   iPad Portrait & Landscape
   ════════════════════════════════════════ */

@media (max-width: 1024px) {
  /* Adjust main grid for tablet */
  .nerve-center {
    grid-template-columns: var(--sidebar-width) 1fr 0px;
  }
  
  .nerve-center.drawer-open {
    grid-template-columns: var(--sidebar-width) 1fr 320px;
  }
  
  /* Touch-friendly navigation tabs */
  .nav-tabs {
    top: 80px;
    padding: 4px;
    gap: 4px;
  }
  
  .nav-tab {
    padding: 10px 14px;
    font-size: var(--font-xs);
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
  }
  
  /* Cyber heart - slightly smaller but still prominent */
  .cyber-heart {
    width: 180px;
    height: 180px;
  }
  
  /* Kanban - 2 columns on tablet */
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
  
  /* Touch-optimized kanban cards */
  .kanban-card {
    min-height: 80px;
    padding: 16px;
  }
  
  .kanban-card-title {
    font-size: var(--font-md);
  }
  
  /* Larger touch targets for buttons */
  .kanban-add-btn,
  .kanban-add-column-btn {
    min-height: var(--touch-min);
    font-size: var(--font-sm);
  }
  
  /* Sidebar adjustments */
  .activity-helix {
    padding: var(--space-md);
  }
  
  .helix-header {
    font-size: var(--font-sm);
  }
  
  /* Drawer adjustments */
  .spatial-drawer {
    width: 320px;
    padding: var(--space-lg);
  }
  
  /* System widgets - better positioning */
  .system-widget-left {
    left: 10px;
    bottom: 80px;
    transform: scale(0.9);
    transform-origin: bottom left;
  }
  
  .system-widget-right {
    right: 10px;
    bottom: 80px;
    transform: scale(0.9);
    transform-origin: bottom right;
  }
  
  /* Touch-friendly buttons */
  .drawer-btn,
  .logout-btn,
  .drawer-toggle {
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    font-size: var(--font-sm);
  }
  
  /* Projects grid - 2 columns */
  #projects-view .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Models grid - 2 columns */
  .models-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Systems view adjustments */
  .systems-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  
  .processes-panel {
    grid-column: span 2;
  }
  
  /* Files view - stack vertically */
  .files-content {
    flex-direction: column;
  }
  
  .files-list {
    flex: 0 0 auto;
    max-height: 40vh;
  }
  
  /* Floating chat - smaller */
  .floating-chat {
    width: 360px;
    height: 450px;
  }
  
  /* Command overlay - better sizing */
  .command-interface {
    width: 90vw;
    max-width: 560px;
  }
  
  /* Task modal - better sizing */
  .task-modal-inner {
    width: 90vw;
    max-width: 420px;
  }
}

/* ════════════════════════════════════════
   MOBILE ONLY (up to 767px)
   Tablets (iPad) use slide-out, not hamburger
   ════════════════════════════════════════ */

@media (max-width: 767px) {
  /* Show mobile menu toggle - only on phones, not tablets */
  .mobile-menu-toggle {
    display: flex;
  }
  
  /* Sidebar becomes slide-out overlay */
  .activity-helix {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: linear-gradient(180deg, var(--obsidian) 0%, rgba(18, 18, 26, 0.98) 100%);
  }
  
  .activity-helix.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    display: block;
  }
  
  /* Main content takes full width */
  .nerve-center {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
  }
  
  .nerve-center.drawer-open {
    grid-template-columns: 1fr;
  }
  
  /* Hide cyber heart in sidebar, show smaller version in main */
  .activity-helix .cyber-heart {
    width: 140px;
    height: 140px;
    margin: 20px auto;
  }
  
  /* Move sigil to accommodate menu toggle */
  .sigil-core {
    top: 20px;
    left: calc(50% + 30px);
    width: 40px;
    height: 40px;
  }
  
  /* Navigation tabs - horizontal scroll */
  .nav-tabs {
    left: 70px;
    right: 20px;
    transform: none;
    max-width: none;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 6px;
    gap: 4px;
  }
  
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .nav-tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 11px;
  }
  
  /* Kanban remains 2 columns */
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  /* Adjust main orbital padding */
  .main-orbital {
    padding: var(--space-md);
  }
  
  /* Drawer becomes full-screen modal */
  .spatial-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100vw;
    max-width: 400px;
    height: 100vh;
    z-index: 210;
    transform: translateX(100%);
  }
  
  .spatial-drawer.open,
  .nerve-center.drawer-open .spatial-drawer {
    transform: translateX(0);
  }
  
  /* Hide complex widgets, show essential only */
  .n8n-widget-container,
  .agent-panel-container {
    display: none;
  }
  
  /* System widgets repositioned */
  .system-widget-left {
    left: 10px;
    bottom: 80px;
    transform: scale(0.85);
  }
  
  .system-widget-right {
    right: 10px;
    bottom: 80px;
    transform: scale(0.85);
  }
  
  /* Logout button repositioned */
  .logout-btn {
    right: 20px;
    top: 80px;
  }
  
  /* Drawer toggle repositioned */
  .drawer-toggle {
    right: 90px;
    top: 80px;
  }
  
  /* Status bar adjustments */
  .status-bar {
    left: 10px;
    right: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  /* Chat panel - full screen on tablet */
  .floating-chat {
    width: calc(100vw - 40px);
    height: calc(100vh - 160px);
    bottom: 80px;
    right: 20px;
    left: 20px;
  }
  
  .chat-toggle {
    bottom: 20px;
    right: 20px;
  }
}

/* ════════════════════════════════════════
   MOBILE OPTIMIZATIONS (< 768px)
   iPhone and small devices
   ════════════════════════════════════════ */

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }
  
  /* Hide sidebar completely on mobile */
  .activity-helix {
    width: 100vw;
    max-width: 320px;
  }
  
  /* Main content full width */
  .nerve-center {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
    padding-top: 60px; /* Space for mobile header */
  }
  
  /* Mobile header bar */
  .mobile-header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 255, 200, 0.1);
    z-index: 150;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
  }
  
  .mobile-header-title {
    font-family: var(--font-display);
    font-size: var(--font-md);
    color: var(--mint);
    font-weight: 600;
    letter-spacing: 1px;
    flex: 1;
    text-align: center;
  }
  
  /* Sigil in mobile header */
  .sigil-core {
    position: static;
    transform: none;
    width: 36px;
    height: 36px;
    animation: sigilBreatheMobile 4s ease-in-out infinite;
  }
  
  @keyframes sigilBreatheMobile {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
  }
  
  /* Navigation - horizontal scroll below header */
  .nav-tabs {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    padding: 8px 12px;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: rgba(18, 18, 26, 0.95);
  }
  
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .nav-tab {
    padding: 10px 14px;
    font-size: 11px;
    min-height: var(--touch-comfortable);
    border-radius: 6px;
  }
  
  /* Main orbital adjusted for mobile header */
  .main-orbital {
    padding: 80px 12px 100px 12px;
    height: 100vh;
    overflow-y: auto;
  }
  
  /* KANBAN - Single column on mobile */
  .kanban-board {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .kanban-column {
    min-height: 150px;
    padding: var(--space-md);
  }
  
  .kanban-column-header {
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-sm);
  }
  
  .kanban-column-title {
    font-size: var(--font-sm);
  }
  
  /* Touch-optimized kanban cards */
  .kanban-card {
    min-height: var(--touch-large);
    padding: 16px;
    margin-bottom: 8px;
  }
  
  .kanban-card-title {
    font-size: var(--font-md);
    line-height: 1.4;
  }
  
  .kanban-card-meta {
    font-size: var(--font-xs);
    margin-top: 8px;
  }
  
  /* Priority dots - larger for touch */
  .kanban-card-priority-dot {
    width: 10px;
    height: 10px;
    top: 10px;
    right: 12px;
  }
  
  /* Add buttons - large touch targets */
  .kanban-add-btn,
  .kanban-add-column-btn {
    min-height: var(--touch-large);
    font-size: var(--font-sm);
    margin-top: 12px;
  }
  
  /* Projects - single column */
  #projects-view .project-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .project-card {
    padding: var(--space-md);
  }
  
  .project-name {
    font-size: var(--font-md);
  }
  
  /* Models - single column */
  .models-grid {
    grid-template-columns: 1fr;
  }
  
  .model-card {
    padding: var(--space-md);
  }
  
  .model-name {
    font-size: var(--font-lg);
  }
  
  /* Systems view - single column */
  .systems-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .processes-panel {
    grid-column: span 1;
  }
  
  .system-panel {
    padding: var(--space-md);
  }
  
  .gauge-container {
    width: 100px;
    height: 100px;
  }
  
  .gauge-value {
    font-size: var(--font-lg);
  }
  
  /* Files view - stacked */
  .files-view {
    padding: 80px 12px 100px 12px;
  }
  
  .files-content {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .files-list {
    flex: 0 0 auto;
    width: 100%;
    max-height: 35vh;
  }
  
  .file-item {
    padding: 12px 16px;
    min-height: var(--touch-comfortable);
  }
  
  /* Logs view */
  .logs-view {
    padding: 80px 12px 100px 12px;
  }
  
  .logs-controls {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  
  .logs-terminal {
    font-size: 11px;
    padding: var(--space-md);
  }
  
  /* Chat view */
  .chat-view {
    padding: 80px 12px 100px 12px;
    height: calc(100vh - 180px);
  }
  
  .chat-message-content {
    max-width: 85%;
    font-size: var(--font-sm);
  }
  
  /* MODALS - Full screen on mobile */
  .task-modal-inner {
    width: 95vw;
    max-width: none;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--space-lg);
    border-radius: 12px;
  }
  
  .task-modal-title {
    font-size: var(--font-lg);
    margin-bottom: var(--space-md);
  }
  
  .task-modal label {
    font-size: var(--font-xs);
    margin-top: var(--space-md);
  }
  
  .task-modal input[type="text"] {
    padding: 14px 16px;
    font-size: var(--font-md);
    min-height: var(--touch-large);
  }
  
  .priority-selector {
    gap: var(--space-sm);
  }
  
  .priority-option {
    min-height: var(--touch-large);
    font-size: var(--font-sm);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .task-modal-actions {
    margin-top: var(--space-lg);
    gap: var(--space-md);
  }
  
  .task-modal-btn {
    min-height: var(--touch-large);
    font-size: var(--font-sm);
  }
  
  /* Command overlay */
  .command-interface {
    width: 95vw;
    max-width: none;
    padding: var(--space-lg);
  }
  
  .command-input {
    padding: 16px;
    font-size: var(--font-md);
    min-height: var(--touch-large);
  }
  
  .command-help {
    max-height: 50vh;
  }
  
  .command-help-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: var(--space-sm) 0;
  }
  
  /* Login overlay */
  .login-form {
    width: 90vw;
    max-width: 360px;
    padding: var(--space-xl);
  }
  
  .login-title {
    font-size: var(--font-xl);
  }
  
  .login-input {
    padding: 16px;
    font-size: var(--font-md);
    min-height: var(--touch-large);
  }
  
  .login-btn {
    padding: 16px;
    font-size: var(--font-md);
    min-height: var(--touch-large);
  }
  
  /* Floating elements repositioned */
  .floating-chat {
    position: fixed;
    top: 120px;
    left: 10px;
    right: 10px;
    bottom: 80px;
    width: auto;
    height: auto;
    border-radius: 12px;
  }
  
  .chat-toggle {
    bottom: 20px;
    right: 20px;
    width: var(--touch-large);
    height: var(--touch-large);
  }
  
  /* System widgets - simplified */
  .system-widget-left {
    left: 10px;
    bottom: 80px;
    transform: scale(0.75);
    transform-origin: bottom left;
    gap: 8px;
  }
  
  .system-widget-right {
    display: none; /* Hide on very small screens */
  }
  
  .sys-gauge {
    width: 60px;
    height: 60px;
  }
  
  .sys-gauge-mini {
    width: 50px;
    height: 50px;
  }
  
  .gauge-value {
    font-size: 13px;
  }
  
  /* Status bar - compact */
  .status-bar {
    left: 10px;
    right: 80px; /* Space for chat toggle */
    bottom: 20px;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .status-indicator {
    padding: 6px 10px;
    font-size: 10px;
  }
  
  /* Logout button - repositioned */
  .logout-btn {
    top: auto;
    bottom: 20px;
    right: 80px;
    padding: 8px 12px;
    min-height: var(--touch-min);
    font-size: var(--font-xs);
  }
  
  /* Drawer toggle - hidden on mobile (use menu instead) */
  .drawer-toggle {
    display: none;
  }
  
  /* Undo toast - full width */
  .undo-toast {
    left: 10px;
    right: 10px;
    transform: none;
    bottom: 80px;
    padding: 14px var(--space-md);
    font-size: var(--font-sm);
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }
  
  /* Touch-optimized scrollbar */
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  
  ::-webkit-scrollbar-thumb {
    background: rgba(107, 107, 128, 0.4);
    border-radius: 3px;
  }
  
  /* Drawer on mobile - full screen or nearly */
  .spatial-drawer {
    width: 100vw;
    max-width: none;
    padding: var(--space-lg);
  }
  
  .drawer-header {
    margin-bottom: var(--space-md);
  }
  
  .drawer-title {
    font-size: var(--font-lg);
  }
  
  .drawer-btn {
    width: var(--touch-comfortable);
    height: var(--touch-comfortable);
  }
  
  /* Reduced motion support */
  @media (prefers-reduced-motion: reduce) {
    .kanban-card,
    .kanban-column,
    .project-card,
    .model-card,
    .system-panel,
    .nav-tab,
    .mobile-menu-toggle,
    .activity-helix,
    .spatial-drawer {
      transition: none !important;
      animation: none !important;
    }
  }
}

/* ════════════════════════════════════════
   SMALL MOBILE (< 480px)
   Extra small devices
   ════════════════════════════════════════ */

@media (max-width: 480px) {
  :root {
    --touch-min: 44px;
    --touch-comfortable: 48px;
    --touch-large: 52px;
  }
  
  /* Even more compact */
  .kanban-card {
    padding: 12px;
    min-height: 70px;
  }
  
  .kanban-card-title {
    font-size: 14px;
  }
  
  /* Minimal system widgets */
  .system-widget-left {
    transform: scale(0.65);
    bottom: 70px;
  }
  
  .sys-gauge {
    width: 55px;
    height: 55px;
  }
  
  /* Compact status bar */
  .status-indicator {
    padding: 4px 8px;
    font-size: 9px;
  }
  
  .status-dot {
    width: 4px;
    height: 4px;
  }
  
  /* Very compact nav */
  .nav-tab {
    padding: 8px 10px;
    font-size: 10px;
  }
  
  /* Chat takes most of screen */
  .floating-chat {
    top: 110px;
    left: 8px;
    right: 8px;
    bottom: 70px;
  }
  
  .chat-input {
    font-size: 16px; /* Prevent iOS zoom */
  }
  
  /* Mobile header smaller */
  .mobile-header {
    height: 50px;
    padding: 0 12px;
  }
  
  .mobile-header-title {
    font-size: 14px;
  }
  
  .mobile-menu-toggle {
    width: 40px;
    height: 40px;
  }
  
  /* Adjust main orbital for smaller header */
  .main-orbital {
    padding-top: 70px;
  }
  
  .nav-tabs {
    top: 50px;
  }
  
  /* Models - even more compact */
  .model-specs {
    grid-template-columns: 1fr;
  }
  
  .model-card {
    padding: 12px;
  }
  
  /* Systems - hide some decorative elements */
  .systems-view::before {
    display: none;
  }
  
  .systems-title {
    font-size: 18px;
  }
  
  /* Task modal - very compact */
  .task-modal-inner {
    padding: 16px;
    width: 96vw;
  }
  
  .priority-option {
    font-size: 11px;
    padding: 10px 4px;
  }
  
  /* Prevent iOS zoom on inputs */
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* ════════════════════════════════════════
   LANDSCAPE ORIENTATION FIXES
   ════════════════════════════════════════ */

@media (max-width: 900px) and (orientation: landscape) {
  /* On landscape mobile, show 2 kanban columns */
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Smaller header */
  .mobile-header {
    height: 50px;
  }
  
  .main-orbital {
    padding-top: 60px;
    padding-bottom: 80px;
  }
  
  /* Side-by-side in landscape where possible */
  .systems-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .processes-panel {
    grid-column: span 2;
  }
  
  /* Floating chat - side panel style */
  .floating-chat {
    width: 50vw;
    top: 60px;
    bottom: 20px;
    left: auto;
    right: 20px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  /* Even more compact in landscape */
  .kanban-column {
    min-height: 120px;
  }
  
  /* System widgets in landscape */
  .system-widget-left {
    bottom: 20px;
    transform: scale(0.7);
  }
  
  .status-bar {
    bottom: 20px;
  }
}

/* ════════════════════════════════════════
   TOUCH DEVICE OPTIMIZATIONS
   ════════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets for touch devices */
  .kanban-card {
    cursor: pointer;
  }
  
  .kanban-card:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, rgba(0, 255, 200, 0.1) 0%, var(--smoke) 100%);
    border-color: var(--mint);
  }
  
  /* Remove hover effects on touch */
  .kanban-card:hover {
    filter: none;
    background: linear-gradient(135deg, var(--smoke) 0%, var(--obsidian) 100%);
  }
  
  .kanban-column:hover {
    border-color: rgba(107, 107, 128, 0.15);
    box-shadow: none;
    background: rgba(18, 18, 26, 0.4);
  }
  
  .project-card:hover,
  .model-card:hover,
  .file-item:hover {
    filter: none;
    border-color: rgba(107, 107, 128, 0.25);
  }
  
  /* Active states instead of hover */
  .nav-tab:active {
    background: rgba(0, 255, 200, 0.1);
  }
  
  .nav-tab.active {
    background: rgba(0, 255, 200, 0.05);
    border-color: rgba(0, 255, 200, 0.2);
  }
  
  /* Remove hover ripple on touch */
  .hover-ripple {
    display: none;
  }
  
  /* Touch-friendly scrolling */
  .kanban-cards,
  .activity-helix,
  .main-orbital,
  .files-list-body,
  .logs-terminal,
  .chat-messages,
  .note-canvas {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
}

/* ════════════════════════════════════════
   N8N & AGENT WIDGETS - TABLET RESPONSIVE
   ════════════════════════════════════════ */

@media (max-width: 1200px) {
  /* Reposition widgets on smaller screens */
  .n8n-widget-container,
  .agent-panel-container {
    position: fixed !important;
    top: auto !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    width: 260px;
    max-width: calc(100vw - 40px);
  }
  
  .n8n-widget-container {
    bottom: 20px;
    z-index: 700 !important;
  }
  
  .agent-panel-container {
    bottom: 180px;
    z-index: 699 !important;
  }
}

@media (max-width: 900px) {
  /* Stack widgets vertically on tablet */
  .n8n-widget-container,
  .agent-panel-container {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    width: 100%;
    max-width: none;
    margin: 12px 0;
  }
  
  .n8n-status-widget,
  .agent-status-panel {
    font-size: 12px;
  }
  
  .n8n-stats-grid,
  .agent-stats-grid {
    gap: 8px;
  }
  
  .n8n-stat,
  .agent-stat {
    padding: 6px;
  }
  
  .n8n-stat-value,
  .agent-stat-value {
    font-size: 14px;
  }
  
  /* Mobile: Show widgets inline in system vitals area */
  .system-widget-left,
  .system-widget-right {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100%;
    margin: 8px 0;
  }
}
