/* ==============================================================================
   NexusAgent - Enterprise Responsive Grid Architecture & Modern Dark Theme
   ==============================================================================
   Fluid CSS Grid, 200ms Hardware-Accelerated Transitions, Adaptive Touch Targets (>=44px),
   Modern Typography (Inter + JetBrains Mono), and Enterprise Slate/Obsidian Palette.
   ============================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  /* --- Obsidian & Slate Palette --- */
  --bg-app: #08090c;
  --bg-surface: #0e1117;
  --bg-pane: #12151e;
  --bg-header: #0f121a;
  --bg-toolbar: #151924;
  --bg-hover: #1c2230;
  --bg-active: #22293a;
  --bg-input: #0a0c12;
  --bg-drawer: #0d1017;
  --bg-card: #141722;

  /* --- High-Contrast Typography --- */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverse: #020617;

  /* --- Precise Electric Accents --- */
  --accent-cyan: #06b6d4;
  --accent-cyan-hover: #22d3ee;
  --accent-cyan-subtle: rgba(6, 182, 212, 0.12);
  --accent-cyan-border: rgba(6, 182, 212, 0.35);

  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-blue-subtle: rgba(59, 130, 246, 0.14);
  --accent-blue-border: rgba(59, 130, 246, 0.35);

  --accent-indigo: #6366f1;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  /* --- Subtle Enterprise Borders --- */
  --border-subtle: #1c2333;
  --border-medium: #273146;
  --border-bright: #3b4864;
  --border-focus: #06b6d4;

  /* --- Typography Stacks --- */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, "Cascadia Mono", "Segoe UI Mono", Menlo, Monaco, Consolas, monospace;

  /* --- Structural Metrics --- */
  --header-height: 48px;
  --toolbar-height: 38px;
  --statusbar-height: 28px;
  --bottom-nav-height: 56px;
  --min-touch-target: 44px;
  --drawer-width: 290px;
  --right-pane-width: 440px;

  /* --- 200ms Hardware-Accelerated Transitions --- */
  --transition-speed: 200ms;
  --transition-timing: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-all: all var(--transition-speed) var(--transition-timing);
  --transition-transform: transform var(--transition-speed) var(--transition-timing);
  --transition-opacity: opacity var(--transition-speed) var(--transition-timing);
}

/* Base Document */
html, body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Code and Mono Blocks */
code, pre, .mono {
  font-family: var(--font-mono);
}

/* App Shell Root */
#app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ==============================================================================
   Interactive Controls & Minimum Touch Targets (>= 44px)
   ============================================================================== */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-toolbar);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
  border-radius: 4px;
  outline: none;
  transition: var(--transition-all);
}

button:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
}

button:active {
  background: var(--bg-active);
  transform: translateY(1px);
}

button.btn-primary {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
  font-weight: 600;
}

button.btn-primary:hover {
  background: var(--accent-blue-hover);
  border-color: var(--accent-blue-hover);
}

button.btn-cyan {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: var(--text-inverse);
  font-weight: 600;
}

button.btn-cyan:hover {
  background: var(--accent-cyan-hover);
}

button.btn-danger {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #ffffff;
}

button.btn-icon {
  padding: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
}

button.btn-icon:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--text-main);
}

/* Inputs, Selects, Textareas */
input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  outline: none;
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--accent-cyan-border);
}

/* ==============================================================================
   Top System Header
   ============================================================================== */
.top-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-hamburger {
  display: none;
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
  width: var(--min-touch-target);
  height: var(--min-touch-target);
  border-radius: 4px;
  margin-right: 4px;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 1px;
  color: #ffffff;
  font-size: 13px;
  white-space: nowrap;
}

.brand-accent {
  color: var(--accent-cyan);
}

.brand-tag {
  background: var(--accent-cyan-subtle);
  color: var(--accent-cyan);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: 1px solid var(--accent-cyan-border);
  border-radius: 3px;
  white-space: nowrap;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.ws-select-input {
  min-width: 200px;
  max-width: 280px;
  height: 32px;
  font-size: 12px;
}

.btn-new-ws {
  height: 32px;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  white-space: nowrap;
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--text-dim);
  flex-shrink: 0;
}

.status-indicator.online {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-indicator.offline {
  background: var(--accent-red);
}

.status-indicator.busy {
  background: var(--accent-amber);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  font-size: 10px;
  height: 28px;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.watchdog-label {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ==============================================================================
   Main Layout & Panes
   ============================================================================== */
.main-layout {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg-app);
}

.pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-pane);
  overflow: hidden;
  position: relative;
  height: 100%;
}

.pane-header {
  height: var(--toolbar-height);
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==============================================================================
   File Tree Explorer (Left Pane)
   ============================================================================== */
.explorer-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.explorer-search input {
  width: 100%;
  height: 32px;
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0;
}

.tree-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
}

.tree-item {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 32px;
  cursor: pointer;
  color: var(--text-main);
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-left: 2px solid transparent;
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.tree-item:hover {
  background: var(--bg-hover);
}

.tree-item.active {
  background: var(--accent-cyan-subtle);
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
}

.tree-item .icon {
  font-size: 14px;
  flex-shrink: 0;
}

.tree-item .item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-item .item-meta {
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ==============================================================================
   Code Editor (Center Pane)
   ============================================================================== */
.tabs-bar {
  display: flex;
  align-items: center;
  height: 36px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  scrollbar-width: none;
}

.tabs-bar::-webkit-scrollbar {
  display: none;
}

.editor-tab {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 12px;
  gap: 8px;
  background: var(--bg-header);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-all);
}

.editor-tab:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.editor-tab.active {
  background: var(--bg-pane);
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  font-weight: 500;
}

.editor-tab .dirty-indicator {
  color: var(--accent-amber);
  font-size: 10px;
}

.editor-tab .tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--text-dim);
  transition: background-color var(--transition-speed) ease;
}

.editor-tab .tab-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

.editor-content-area {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  background: var(--bg-input);
}

.line-numbers {
  width: 48px;
  padding: 12px 8px 12px 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  color: var(--text-dim);
  background: var(--bg-pane);
  border-right: 1px solid var(--border-subtle);
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
}

.code-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  padding: 12px;
  resize: none;
  outline: none;
  box-shadow: none;
  white-space: pre;
  overflow: auto;
  tab-size: 4;
}

.code-textarea:focus {
  box-shadow: none;
}

.editor-statusbar {
  height: var(--statusbar-height);
  background: var(--bg-toolbar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.editor-statusbar .status-left,
.editor-statusbar .status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==============================================================================
   Right Pane: Terminal Console & AI Agent Chat
   ============================================================================== */
.right-tab-switch {
  display: flex;
  height: var(--toolbar-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.switch-tab {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: 0;
  transition: var(--transition-all);
}

.switch-tab:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.switch-tab.active {
  background: var(--bg-pane);
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.tab-pane-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100% - var(--toolbar-height));
}

/* Terminal View */
.terminal-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #06070a;
}

.terminal-header {
  height: 32px;
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  background: #06070a;
}

.term-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  word-break: break-all;
  white-space: pre-wrap;
}

.term-time {
  color: var(--text-dim);
  font-size: 10px;
  flex-shrink: 0;
}

.term-stdout {
  color: #e2e8f0;
}

.term-stderr {
  color: #f87171;
}

.term-system {
  color: var(--accent-cyan);
}

.terminal-prompt-bar {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  gap: 8px;
  flex-shrink: 0;
}

.prompt-prefix {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  white-space: nowrap;
}

#term-cmd-input {
  flex: 1;
  height: 32px;
  font-size: 12px;
}

/* Agent Chat View */
.agent-chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-pane);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-blue-subtle);
  border: 1px solid var(--accent-blue-border);
  color: #ffffff;
}

.chat-sender {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-cyan);
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.agent-input-bar {
  display: flex;
  padding: 10px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  gap: 8px;
  flex-shrink: 0;
}

#agent-prompt-input {
  flex: 1;
  height: 52px;
  font-family: var(--font-sans);
  font-size: 13px;
  resize: none;
}

/* Tool execution audit card */
.audit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 4px;
  padding: 8px 10px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.audit-card-title {
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 4px;
}

/* ==============================================================================
   Login Overlay
   ============================================================================== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.login-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.login-header {
  padding: 20px 24px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
}

.login-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #ffffff;
}

.login-subtitle {
  font-size: 11px;
  color: var(--accent-cyan);
  margin-top: 2px;
}

.login-body {
  padding: 24px;
}

.login-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.login-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.login-field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.login-input-wrap {
  display: flex;
  gap: 8px;
}

.login-input-wrap input {
  flex: 1;
  height: 40px;
  font-size: 13px;
}

.btn-token-toggle {
  height: 40px;
  padding: 0 12px;
}

.btn-login-primary {
  width: 100%;
  height: 44px;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.login-footer {
  padding: 12px 24px;
  background: var(--bg-header);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ==============================================================================
   RESPONSIVE BREAKPOINTS (Desktop, Tablet, Mobile)
   ============================================================================== */

/* ------------------------------------------------------------------------------
   1. DESKTOP (> 1024px)
   Full 3-Pane Fluid CSS Grid Layout
   ------------------------------------------------------------------------------ */
@media (min-width: 1025px) {
  .header-hamburger {
    display: none !important;
  }

  .mobile-bottom-nav {
    display: none !important;
  }

  .drawer-backdrop {
    display: none !important;
  }

  .main-layout {
    display: grid;
    grid-template-columns: var(--drawer-width) 1fr var(--right-pane-width);
    grid-template-rows: 1fr;
    height: calc(100vh - var(--header-height));
    width: 100vw;
  }

  .left-pane {
    border-right: 1px solid var(--border-subtle);
    display: flex !important;
    position: static;
    transform: none !important;
    box-shadow: none !important;
  }

  .center-pane {
    border-right: 1px solid var(--border-subtle);
    display: flex !important;
  }

  .right-pane {
    display: flex !important;
  }
}

/* ------------------------------------------------------------------------------
   2. TABLET (768px - 1024px)
   2-Pane Grid with Off-Canvas Slide-Out Left Drawer
   ------------------------------------------------------------------------------ */
@media (min-width: 768px) and (max-width: 1024px) {
  .header-hamburger {
    display: inline-flex !important;
  }

  .mobile-bottom-nav {
    display: none !important;
  }

  .main-layout {
    display: grid;
    grid-template-columns: 1fr minmax(320px, 400px);
    grid-template-rows: 1fr;
    height: calc(100vh - var(--header-height));
    width: 100vw;
  }

  /* Slide-Out Drawer for File Tree */
  .left-pane {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--drawer-width);
    max-width: 80vw;
    z-index: 1100;
    background: var(--bg-drawer);
    border-right: 1px solid var(--border-medium);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.7);
    transform: translateX(-100%);
    transition: var(--transition-transform);
    will-change: transform;
    display: flex !important;
  }

  .left-pane.drawer-open {
    transform: translateX(0);
  }

  .center-pane {
    border-right: 1px solid var(--border-subtle);
    display: flex !important;
  }

  .right-pane {
    display: flex !important;
  }

  /* Backdrop Scrim */
  .drawer-backdrop {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-opacity);
  }

  .drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ------------------------------------------------------------------------------
   3. MOBILE (< 768px)
   Single-Pane View with Fixed Bottom Navigation Bar (>=44px touch targets)
   ------------------------------------------------------------------------------ */
@media (max-width: 767px) {
  .header-hamburger {
    display: none !important;
  }

  .top-header {
    height: var(--header-height);
    padding: 0 10px;
    gap: 8px;
  }

  .brand-tag,
  #system-health-text,
  .ws-select-wrap label,
  .watchdog-label {
    display: none;
  }

  .ws-select-input {
    min-width: 110px;
    max-width: 140px;
    font-size: 11px;
  }

  .main-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
    width: 100vw;
    position: relative;
    overflow: hidden;
  }

  .pane {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none !important;
    opacity: 0;
    transform: none;
    border: none !important;
    box-shadow: none !important;
  }

  /* Display only active mobile pane */
  .main-layout[data-mobile-active="files"] .left-pane {
    display: flex !important;
    opacity: 1;
    z-index: 20;
    position: relative;
    width: 100%;
    max-width: 100%;
  }

  .main-layout[data-mobile-active="editor"] .center-pane {
    display: flex !important;
    opacity: 1;
    z-index: 20;
    position: relative;
    width: 100%;
  }

  .main-layout[data-mobile-active="terminal"] .right-pane {
    display: flex !important;
    opacity: 1;
    z-index: 20;
    position: relative;
    width: 100%;
  }

  .drawer-backdrop {
    display: none !important;
  }

  /* Fixed Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: var(--bottom-nav-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-medium);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-item {
    flex: 1;
    height: 100%;
    min-height: var(--min-touch-target);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-dim);
    gap: 3px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    position: relative;
    transition: var(--transition-all);
  }

  .mobile-nav-item .nav-icon-svg {
    stroke: currentColor;
    transition: stroke var(--transition-speed) ease;
  }

  .mobile-nav-item.active {
    color: var(--accent-cyan);
  }

  .mobile-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent-cyan);
    border-radius: 2px;
  }

  /* Touch Target Optimizations for Mobile */
  .tree-item {
    height: var(--min-touch-target);
    padding: 0 14px;
    font-size: 13px;
  }

  .editor-tab {
    height: 100%;
    min-height: var(--min-touch-target);
    padding: 0 14px;
  }

  .editor-tab .tab-close {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .pane-header {
    height: var(--min-touch-target);
  }

  .pane-actions button {
    min-height: 36px;
    padding: 6px 14px;
  }

  .right-tab-switch {
    height: var(--min-touch-target);
  }

  .switch-tab {
    min-height: var(--min-touch-target);
    font-size: 12px;
  }

  .terminal-prompt-bar {
    padding: 8px;
  }

  #term-cmd-input {
    height: var(--min-touch-target);
  }

  #btn-term-send {
    min-height: var(--min-touch-target);
    min-width: 54px;
  }

  #agent-prompt-input {
    height: 60px;
    font-size: 14px;
  }

  #btn-send-agent-prompt {
    min-height: 60px;
    min-width: 68px;
  }
}
