/* ==========================================================================
   miCode Studio for iOS - Mobile-First Responsive Stylesheet
   Optimized for iPhone, iPad, Safari Mobile & Standalone PWA
   Developer: Mante Isaac
   ========================================================================== */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh; /* Dynamic viewport height handles iOS Safari address bar collapse */
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* Safe Area Insets for iPhone Dynamic Island & Home Bar */
#app-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   1. Compact Top Navigation Bar
   ========================================================================== */
.top-navbar {
  height: var(--navbar-height);
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
  z-index: 100;
  user-select: none;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-btn:active {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  transform: scale(0.96);
}

.nav-btn.primary-btn {
  background: var(--accent-primary);
  color: #ffffff;
  padding: 0 12px;
  width: auto;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
}

.nav-btn.primary-btn:active {
  background: var(--accent-hover);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.brand-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
}

.nav-project-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-project-picker i {
  font-size: 9px;
  color: var(--text-muted);
}

/* ==========================================================================
   2. File Tabs Row
   ========================================================================== */
.tabs-bar {
  height: var(--tabs-height);
  background: var(--bg-tabs);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  user-select: none;
}

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

.file-tab {
  height: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--bg-tab-inactive);
  color: var(--text-muted);
  border-right: 1px solid var(--border-subtle);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  position: relative;
}

.file-tab.active {
  background: var(--bg-tab-active);
  color: var(--text-primary);
  font-weight: 500;
  border-top: 2px solid var(--accent-primary);
}

.tab-icon {
  font-size: 12px;
}

.tab-title {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-dirty-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: inline-block;
}

.tab-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
}

.tab-close-btn:hover, .tab-close-btn:active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

/* ==========================================================================
   3. Main Workspace Area (Editor & Preview Panels)
   ========================================================================== */
.workspace-container {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.editor-view-pane, .preview-view-pane {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-editor);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.preview-view-pane {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  background: #ffffff;
}

.preview-view-pane.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#editor-mount {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* CodeMirror Mobile Overrides */
.CodeMirror {
  height: 100% !important;
  font-family: var(--font-mono) !important;
  line-height: 1.55;
  background-color: var(--bg-editor) !important;
  color: var(--text-primary) !important;
}

.CodeMirror-gutters {
  background-color: var(--bg-editor) !important;
  border-right: 1px solid var(--border-subtle) !important;
}

.CodeMirror-linenumber {
  color: var(--text-muted) !important;
  padding: 0 5px 0 3px !important;
}

.CodeMirror-cursor {
  border-left: 2px solid var(--accent-primary) !important;
}

.CodeMirror-activeline-background {
  background: rgba(255, 255, 255, 0.04) !important;
}

.cm-s-micode-dark.CodeMirror {
  background: #0f1217 !important;
  color: #f0f6fc !important;
}

.cm-s-micode-light.CodeMirror {
  background: #ffffff !important;
  color: #1f2328 !important;
}

.cm-s-micode-dark .cm-keyword { color: #ff7b72; font-weight: bold; }
.cm-s-micode-dark .cm-atom { color: #79c0ff; }
.cm-s-micode-dark .cm-number { color: #79c0ff; }
.cm-s-micode-dark .cm-def { color: #d2a8ff; font-weight: 500; }
.cm-s-micode-dark .cm-variable { color: #e6edf3; }
.cm-s-micode-dark .cm-variable-2 { color: #79c0ff; }
.cm-s-micode-dark .cm-property { color: #79c0ff; }
.cm-s-micode-dark .cm-operator { color: #ff7b72; }
.cm-s-micode-dark .cm-comment { color: #8b949e; font-style: italic; }
.cm-s-micode-dark .cm-string { color: #a5d6ff; }
.cm-s-micode-dark .cm-meta { color: #ffa657; }
.cm-s-micode-dark .cm-tag { color: #7ee787; font-weight: bold; }
.cm-s-micode-dark .cm-attribute { color: #79c0ff; }
.cm-s-micode-dark .cm-qualifier { color: #d2a8ff; }

/* Autocomplete Hints Popup */
.CodeMirror-hints {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: var(--font-sans) !important;
  padding: 4px !important;
  max-width: 320px;
  z-index: 9999 !important;
}

.CodeMirror-hint {
  padding: 6px 10px !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13px !important;
  color: var(--text-primary) !important;
}

li.CodeMirror-hint-active {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
}

/* ==========================================================================
   4. Mobile Keyboard Accessory Toolbar
   ========================================================================== */
.keyboard-toolbar {
  height: var(--toolbar-height);
  background: var(--bg-toolbar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 6px;
  gap: 5px;
  flex-shrink: 0;
  user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 90;
}

.keyboard-toolbar::-webkit-scrollbar {
  display: none;
}

.kb-symbol-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s ease, background 0.15s ease;
}

.kb-symbol-btn:active {
  transform: scale(0.92);
  background: var(--accent-primary);
  color: #ffffff;
}

/* ==========================================================================
   5. Bottom Status Bar & Mode Switcher
   ========================================================================== */
.bottom-statusbar {
  height: var(--statusbar-height);
  background: var(--bg-navbar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  user-select: none;
  z-index: 80;
}

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

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-save.saved {
  color: var(--status-success);
}

.status-save.saving {
  color: var(--status-warning);
}

.status-save.error {
  color: var(--status-danger);
}

.view-segmented-switch {
  display: inline-flex;
  background: var(--bg-surface);
  border-radius: var(--radius-pill);
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.view-segment-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.view-segment-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

/* ==========================================================================
   6. Slide-in Drawers (Files & Search)
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.slide-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 85%;
  max-width: 340px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-strong);
  z-index: 160;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

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

.drawer-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  -webkit-overflow-scrolling: touch;
}

/* Project Selector Box in Drawer */
.drawer-project-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.drawer-project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-select-menu {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
  margin-top: 6px;
}

.drawer-project-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.btn-small {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-small:active {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Tree View */
.file-tree-container {
  margin-top: 8px;
}

.tree-node-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  min-height: 38px;
}

.tree-node-row:active {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.tree-node-row.active {
  background: rgba(135, 1, 251, 0.15);
  color: var(--text-primary);
  font-weight: 500;
}

.tree-indent {
  display: inline-block;
  width: 14px;
}

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

.tree-node-actions {
  display: none;
  gap: 4px;
}

.tree-node-row:hover .tree-node-actions,
.tree-node-row:active .tree-node-actions {
  display: flex;
}

.node-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.node-action-btn:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   7. Preview Screen Layout
   ========================================================================== */
.preview-toolbar {
  height: 44px;
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
}

.preview-body {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  background: #11141b;
  overflow: hidden;
}

#preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
  transition: width 0.2s ease, max-width 0.2s ease;
}

#preview-iframe.viewport-iphone {
  max-width: 375px;
  box-shadow: 0 0 24px rgba(0,0,0,0.5);
}

#preview-iframe.viewport-ipad {
  max-width: 768px;
  box-shadow: 0 0 24px rgba(0,0,0,0.5);
}

/* Collapsible Console Drawer inside Preview */
.preview-console-drawer {
  height: 160px;
  background: #08090c;
  border-top: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: height 0.2s ease;
}

.preview-console-drawer.collapsed {
  height: 28px;
}

.console-header {
  height: 28px;
  background: #0f1217;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.console-error-badge {
  background: var(--status-danger);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  display: none;
}

.console-body {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px;
  -webkit-overflow-scrolling: touch;
}

.console-log-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.console-log-row.console-error {
  background: rgba(248, 81, 73, 0.1);
  color: #ff7b72;
}

.console-log-row.console-warn {
  background: rgba(210, 153, 34, 0.1);
  color: #e3b341;
}

.console-time {
  color: var(--text-muted);
  font-size: 10px;
  min-width: 55px;
}

.console-icon {
  margin-top: 2px;
}

.console-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   8. Modals (Settings, Search, Add to Home Screen)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.setting-info h4 {
  margin: 0 0 2px 0;
  font-size: 14px;
  color: var(--text-primary);
}

.setting-info p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.setting-control select, .setting-control input[type="text"] {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
}

/* iOS Add to Home Screen visual card */
.a2hs-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
}

/* Toast Alerts */
.toast-notice {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(21, 25, 33, 0.95);
  border: 1px solid var(--border-strong);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  box-shadow: var(--shadow-md);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Tablet (iPad) Responsive Layout Enhancements */
@media (min-width: 768px) {
  .slide-drawer {
    width: 320px;
  }
}

/* ==========================================================================
   Tabs Header Wrap with Add Button
   ========================================================================== */
.tabs-header-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-tabs);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--tabs-height);
  flex-shrink: 0;
  overflow: hidden;
}

.tabs-header-wrap .tabs-bar {
  flex: 1;
  border-bottom: none;
}

.tab-add-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: var(--tabs-height);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.tab-add-btn:active {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (Thumb-Friendly for iOS & Android)
   ========================================================================== */
.mobile-bottom-nav {
  height: 48px;
  background: var(--bg-navbar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  z-index: 100;
  user-select: none;
}

.bnav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  cursor: pointer;
  font-size: 15px;
  transition: color 0.15s ease;
  padding: 0;
}

.bnav-btn span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.bnav-btn:active, .bnav-btn.active {
  color: var(--accent-primary);
}

/* ==========================================================================
   Terminal Bottom Sheet & Console
   ========================================================================== */
.terminal-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60dvh;
  max-height: 520px;
  background: #08090c;
  border-top: 1px solid var(--border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 250;
  overflow: hidden;
}

.terminal-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.terminal-toolbar {
  height: 38px;
  background: #0e1117;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.btn-terminal-tool {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-terminal-tool:active {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  background: #08090c;
  color: #f0f6fc;
}

.term-line {
  margin-bottom: 4px;
  word-break: break-all;
  white-space: pre-wrap;
}

.term-banner {
  background: rgba(135, 1, 251, 0.08);
  border-left: 3px solid var(--accent-primary);
  padding: 6px 8px;
  margin-bottom: 8px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.term-cmd { color: #f0f6fc; font-weight: 600; }
.term-prompt-echo { color: #58a6ff; font-weight: 700; margin-right: 4px; }
.term-stdout { color: #c9d1d9; }
.term-success { color: #3fb950; font-weight: 600; }
.term-warning { color: #d29922; }
.term-error { color: #f85149; font-weight: 600; }
.term-info { color: #a5d6ff; }
.term-muted { color: #57606a; }
.term-highlight { color: #e3b341; font-weight: 600; }

.terminal-input-row {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: #0e1117;
  border-top: 1px solid var(--border-subtle);
  gap: 8px;
  flex-shrink: 0;
}

.terminal-prompt {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #58a6ff;
  user-select: none;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f0f6fc;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 0;
}

.terminal-submit-btn {
  background: var(--accent-primary);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

.terminal-quick-shortcuts {
  display: flex;
  gap: 6px;
  padding: 4px 10px 8px;
  background: #0e1117;
  overflow-x: auto;
  flex-shrink: 0;
}

.term-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: nowrap;
  cursor: pointer;
}

.term-chip:active {
  background: var(--accent-primary);
  color: #fff;
}

/* ==========================================================================
   Tools Bottom Sheet
   ========================================================================== */
.tools-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  padding: 12px 16px 24px;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto 4px;
}

.sheet-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: center;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tool-grid-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.tool-grid-item span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.tool-grid-item:active {
  transform: scale(0.96);
  background: var(--bg-surface-hover);
}

/* ==========================================================================
   Large Responsive Modals (Git, DB, PHP, miAI, Snippets)
   ========================================================================== */
.modal-card.modal-lg {
  max-width: 600px;
  max-height: 85dvh;
}

.git-status-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 12px;
}

.git-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}

.git-commit-item {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}

.git-commit-hash {
  font-family: var(--font-mono);
  color: #e3b341;
  font-weight: 600;
  font-size: 11px;
}

/* Database Explorer Styles */
.db-table-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.db-table-pill.active {
  background: #38bdf8;
  color: #0f172a;
  font-weight: 600;
}

.db-table-result {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-family: var(--font-mono);
}

.db-table-result th {
  background: var(--bg-surface);
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.db-table-result td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* PHP Server Banner */
.php-server-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-sm);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #57606a;
}

.status-indicator.online {
  background: #3fb950;
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.6);
}

/* miAI Assistant */
.ai-chips-bar {
  display: flex;
  gap: 6px;
  padding-bottom: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
}

.ai-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.ai-chip:active {
  background: var(--accent-primary);
  color: #fff;
}

.ai-msg {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  line-height: 1.5;
  max-width: 90%;
  word-break: break-word;
}

.ai-msg.user {
  background: var(--accent-primary);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.ai-msg.assistant {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.ai-input-wrap {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Snippet Explorer */
.snip-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.snip-pill.active {
  background: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
}

.snippet-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.snippet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.snippet-trigger-badge {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-right: 6px;
}

.snippet-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-insert-snippet {
  background: var(--accent-primary);
  border: none;
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}

.snippet-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 6px;
}

.snippet-preview {
  background: var(--bg-app);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  margin: 0;
  overflow-x: auto;
}

