/* 🐕 Woofson Design Tokens - Golden Amber & Charcoal */
:root {
  --bg-dark: #121214;
  --bg-panel: #18181b;
  --bg-header: #202024;
  --bg-active: #27272a;
  --bg-hover: #323238;
  --bg-selected: rgba(245, 158, 11, 0.18);
  --border: #3f3f46;
  --border-focus: #f59e0b;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-dark: #d97706;
  --accent-subtle: rgba(245, 158, 11, 0.12);
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --danger: #ef4444;
  --success: #10b981;
  --info: #38bdf8;
  --archive: #f472b6;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 6px;
  --pane-border-width: 1px;
  --pane-active-ring-width: 1px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html {
  height: 100%;
  height: 100dvh;
  height: -webkit-fill-available;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-size: 13px;
  overflow: hidden;
  height: 100%;
  height: 100dvh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
}

/* App Header */
.app-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.5px;
  margin-right: auto;
}

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

.header-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.desktop-only {
  display: flex;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: flex !important;
  }
}

.btn {
  background-color: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent);
}

.btn.active {
  background-color: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.btn.btn-accent {
  background-color: var(--accent);
  color: #121214;
  border-color: var(--accent);
  font-weight: 700;
}

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

.btn.btn-danger {
  background-color: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
  box-sizing: border-box;
}

.btn-icon i,
.btn-icon svg,
.btn-icon img {
  width: 15px;
  height: 15px;
  display: block;
}

.paranoid-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
}

.paranoid-badge.disabled {
  background: var(--bg-panel);
  border-color: var(--border);
  color: var(--text-muted);
}

/* Layout Container */
.main-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Panes Grid */
.panes-container {
  flex: 1;
  display: grid;
  gap: 6px;
  padding: 6px;
  overflow: hidden;
  height: 100%;
}

.panes-container.layout-single {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.panes-container.layout-dual-vertical {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.panes-container.layout-dual-horizontal {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
}

.panes-container.layout-triple {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr;
}

.panes-container.layout-quad {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

/* Individual Pane */
.pane {
  background-color: var(--bg-panel);
  border: var(--pane-border-width, 1px) solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pane.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) var(--accent);
}

.pane-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-height: 34px;
}

.pane-nav-btns {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 26px;
}

.pane-nav-btns button,
.pane-header .btn-icon,
.pane-favorites-wrapper .btn-icon,
.pane-color-wrapper .btn-icon,
.pane-idx-badge,
.pane-quick-transfer-btn,
.pane-upload-btn,
.pane-tools-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 !important;
  width: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;
  border-radius: 4px !important;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  line-height: 1;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.pane-nav-btns button:hover,
.pane-header .btn-icon:hover,
.pane-favorites-wrapper .btn-icon:hover,
.pane-color-wrapper .btn-icon:hover,
.pane-idx-badge:hover,
.pane-quick-transfer-btn:hover,
.pane-upload-btn:hover,
.pane-tools-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--accent);
}

.pane-nav-btns button i,
.pane-nav-btns button svg,
.pane-header .btn-icon i,
.pane-header .btn-icon svg,
.pane-quick-transfer-btn i,
.pane-quick-transfer-btn svg,
.pane-upload-btn i,
.pane-upload-btn svg,
.pane-tools-btn i,
.pane-tools-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.pane-path-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  overflow: hidden;
  height: 26px;
}

.pane-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  font-family: var(--font-mono);
  font-size: 11px;
}

.crumb {
  color: var(--text-muted);
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 2px;
}

.crumb:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.crumb-sep {
  color: var(--text-dim);
}

.pane-path-input {
  display: none;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11px;
}

.pane-quick-filter {
  width: 110px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  color: var(--text-main);
  font-size: 11px;
  outline: none;
}

.pane-quick-filter:focus {
  border-color: var(--accent);
}

/* File Table View */
.pane-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background-color: var(--bg-panel);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.file-table th {
  position: sticky;
  top: 0;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 5px 8px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  z-index: 10;
}

.file-table th:hover {
  color: var(--accent);
}

.file-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.file-row:hover {
  background-color: var(--bg-hover);
}

.file-row.selected {
  background-color: var(--bg-selected);
  color: var(--accent-hover);
}

.file-row.cursor-focus {
  outline: 1px dotted var(--accent);
}

.file-cell {
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle !important;
  line-height: normal;
}

.file-cell-icon {
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  padding: 0 4px !important;
  text-align: center;
  vertical-align: middle !important;
}

.row-icon-wrapper {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 50%;
  margin: 0 auto;
  line-height: 1;
}

.row-icon-wrapper svg,
.row-icon-wrapper i {
  display: inline-block;
  vertical-align: middle;
}

.file-cell-name {
  vertical-align: middle !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.file-name-text {
  display: inline-block;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: normal;
}

.file-icon {
  font-size: 14px;
  flex-shrink: 0;
  vertical-align: middle;
}

.file-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
  user-select: none;
  -webkit-user-drag: none;
}

.file-icon.dir {
  color: var(--accent);
}

.file-icon.dir.dir-filled {
  fill: var(--accent);
  color: var(--accent);
}

.file-icon.dir.dir-empty {
  fill: transparent;
  color: var(--accent);
  stroke: var(--accent);
}

.file-icon.archive { color: #f472b6; }
.file-icon.text { color: #60a5fa; }
.file-icon.code { color: #34d399; }
.file-icon.media { color: #a78bfa; }

.file-cell-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  vertical-align: middle !important;
}

.pane-footer {
  background-color: var(--bg-header);
  border-top: 1px solid var(--border);
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Bottom Orthodox Function Key Bar */
.bottom-fkey-bar {
  background-color: #09090b;
  border-top: 1px solid var(--border);
  height: 28px;
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.fkey-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.fkey-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.fkey-btn span.fkey-num {
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background-color: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.modal-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  background-color: var(--bg-header);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Permissions Manager Modal */
.perm-matrix {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12px;
}

.perm-matrix th, .perm-matrix td {
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border);
}

.perm-matrix th {
  background: var(--bg-header);
  color: var(--accent);
}

.perm-preset-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.perm-chip {
  background: var(--bg-header);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.perm-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.perm-octal-badge {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-dark);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-block;
}

/* Tabbed Settings Modal */
.settings-tabs {
  display: flex;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.settings-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-panel);
}

.settings-tab-content {
  display: none;
  padding: 16px;
}

.settings-tab-content.active {
  display: block;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.form-group .form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Floating Multi-Tab Developer Power Editor & Markdown Live Preview */
.floating-editor-window {
  position: fixed;
  top: 50px;
  left: 60px;
  width: min(1120px, calc(100vw - 80px));
  height: min(740px, calc(100vh - 90px));
  max-width: 100vw;
  max-height: 100vh;
  min-width: 360px;
  min-height: 240px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 1500;
  overflow: hidden;
  animation: editorWinPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes editorWinPop {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.floating-editor-window.maximized {
  top: 40px !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - 72px) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.editor-pill {
  position: fixed;
  bottom: 42px;
  left: 20px;
  z-index: 1800;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #181a20;
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
}

.editor-pill:hover {
  transform: translateY(-2px);
  background: #222630;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 12px rgba(245, 158, 11, 0.3);
}

.editor-pill-dirty {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Floating Window Edge & Corner Resize Handles */
.win-resize-handle {
  position: absolute;
  z-index: 30;
}

.win-resize-top {
  top: 0; left: 0; right: 0; height: 6px; cursor: n-resize;
}

.win-resize-bottom {
  bottom: 0; left: 0; right: 0; height: 6px; cursor: s-resize;
}

.win-resize-left {
  top: 0; bottom: 0; left: 0; width: 6px; cursor: w-resize;
}

.win-resize-right {
  top: 0; bottom: 0; right: 0; width: 6px; cursor: e-resize;
}

.win-resize-corner {
  bottom: 0; right: 0; width: 14px; height: 14px;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 2px; cursor: nwse-resize;
}

.editor-header {
  padding: 8px 14px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  user-select: none;
}

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

/* Multi-Tab Bar Strip */
.editor-tab-strip {
  display: flex;
  align-items: center;
  background: #15161b;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  height: 34px;
}

.editor-tabs-scroll {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  height: 100%;
}

.editor-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.editor-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 100%;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  background: #181a20;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
}

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

.editor-tab.active {
  background: var(--bg-panel);
  color: var(--accent);
  font-weight: 600;
  border-bottom: 2px solid var(--accent);
}

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

.editor-tab-close {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  margin-left: 2px;
  transition: all 0.15s ease;
}

.editor-tab-close:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.editor-add-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.editor-add-tab-btn:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

/* Integrated Find & Replace Toolbar */
.editor-find-bar {
  padding: 6px 12px;
  background: #1c1e25;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 11px;
}

.filter-opt-btn {
  padding: 3px 6px !important;
  font-size: 10.5px !important;
  font-family: var(--font-mono) !important;
  min-width: 24px !important;
  height: 24px !important;
}

.filter-opt-btn.active {
  background: var(--accent) !important;
  color: #000 !important;
  font-weight: 700 !important;
}

/* Editor Multi-Pane Grid & Split Views */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  flex: 1;
  min-height: 0;
  gap: 4px;
  padding: 4px;
  background: var(--bg-dark);
  overflow: hidden;
}

.editor-grid.dual-vertical {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.editor-grid.dual-horizontal {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
}

.editor-grid.split-markdown {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.editor-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #191b21;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.editor-pane-title {
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-pane-tag {
  font-size: 9.5px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

.editor-body-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg-panel);
  min-height: 0;
}

.editor-gutter {
  width: 48px;
  background: #14161a;
  color: #52525b;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 6px 10px 2px;
  text-align: right;
  user-select: none;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  flex-shrink: 0;
  white-space: pre;
}

.editor-textarea {
  flex: 1;
  background: transparent;
  color: var(--text-main);
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 10px 12px;
  resize: none;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  overflow: auto;
  min-width: 0;
}

.editor-textarea:focus {
  outline: none;
}

.markdown-preview-pane {
  flex: 1;
  background: var(--bg-panel);
  color: var(--text-main);
  padding: 16px 20px;
  overflow-y: auto;
  line-height: 1.6;
  font-size: 13px;
  min-height: 0;
}

/* Bottom Status Bar */
.editor-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: #14161a;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.status-sep {
  color: var(--border);
  opacity: 0.6;
}

.markdown-preview-pane h1, .markdown-preview-pane h2, .markdown-preview-pane h3 {
  color: var(--accent);
  margin-top: 12px;
  margin-bottom: 8px;
}

.markdown-preview-pane pre {
  background: var(--bg-dark);
  padding: 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
  overflow-x: auto;
  border: 1px solid var(--border);
  margin: 10px 0;
}

.markdown-preview-pane blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  color: var(--text-muted);
  margin: 10px 0;
}

/* Diff View */
.diff-container {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  max-height: 60vh;
}

.diff-line {
  display: flex;
  padding: 2px 6px;
  white-space: pre;
}

.diff-line.insert {
  background-color: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.diff-line.delete {
  background-color: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.diff-gutter {
  width: 50px;
  color: var(--text-dim);
  text-align: right;
  padding-right: 10px;
  user-select: none;
}

/* Context Menu Backdrop */
.context-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1990;
}

.context-menu-backdrop.active {
  display: block;
}

/* Context Menu */
.context-menu {
  display: none;
  position: fixed;
  background-color: var(--bg-header);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  padding: 4px 0;
  z-index: 2000;
  min-width: 200px;
}

.context-item {
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-main);
}

.context-item:hover {
  background-color: var(--bg-hover);
  color: var(--accent);
}

.context-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Drag & Drop Highlight */
.pane.drag-over {
  border-color: var(--accent) !important;
  background-color: rgba(245, 158, 11, 0.05) !important;
}

@media (pointer: coarse), (max-width: 768px) {
  .file-row,
  .file-table,
  .file-table tbody tr {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    touch-action: pan-y !important;
    -webkit-touch-callout: none !important;
  }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Slider & Font Size Customizer */
.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.range-slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 6px;
}

.slider-val-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 65px;
  text-align: center;
  font-size: 12px;
}

.bottom-fkey-bar.fkey-hidden {
  display: none !important;
}

/* Terminal Slide-Up Drawer */
.terminal-drawer {
  position: fixed;
  bottom: 28px;
  left: 0;
  right: 0;
  height: 320px;
  background: #0d0e11;
  border-top: 2px solid var(--accent);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
  z-index: 500;
  display: none;
  flex-direction: column;
  transition: height 0.2s ease;
}

.terminal-drawer.active {
  display: flex;
}

.terminal-drawer.fullscreen {
  height: calc(100vh - 72px);
}

.terminal-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-family: var(--font-mono);
}

.terminal-body {
  flex: 1;
  background: #090a0d;
  color: #f4f4f5;
  padding: 6px 10px;
  font-family: var(--font-mono);
  overflow: hidden;
  outline: none;
  position: relative;
}

.terminal-body .xterm {
  height: 100%;
  width: 100%;
}

.terminal-body .xterm-viewport {
  overflow-y: auto !important;
}

.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--accent);
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Tasks Transfer Floating Pill */
.tasks-pill {
  position: fixed;
  bottom: 36px;
  right: 16px;
  background: var(--bg-header);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  z-index: 600;
}

.tasks-pill.active {
  display: flex;
}

/* Context Submenus & Quick Destinations */
.context-item.has-submenu {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.context-submenu {
  display: none;
  position: absolute;
  left: calc(100% - 2px);
  top: -4px;
  background-color: var(--bg-header);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 0;
  min-width: 220px;
  max-width: 320px;
  z-index: 2100;
}

.submenu-flip-left .context-submenu {
  left: auto;
  right: calc(100% - 2px);
}

@media (min-width: 769px) and (pointer: fine) {
  .context-item.has-submenu:hover > .context-submenu {
    display: block;
  }
}

.submenu-header {
  padding: 4px 10px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Mobile & Touch / Narrow screen Accordion Drawer */
@media (max-width: 768px), (pointer: coarse) {
  .context-menu {
    overflow-x: hidden !important;
    max-width: calc(100vw - 20px) !important;
  }

  .context-item.has-submenu {
    flex-wrap: wrap;
    align-items: center;
  }

  .context-item.has-submenu.expanded {
    background-color: rgba(245, 158, 11, 0.08);
  }

  .context-item.has-submenu .submenu-chevron {
    transition: transform 0.2s ease;
  }

  .context-item.has-submenu.expanded .submenu-chevron {
    transform: rotate(90deg);
  }

  .context-submenu {
    position: static !important;
    display: none;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    border-left: 2px solid var(--accent) !important;
    border-radius: 0 0 6px 6px !important;
    background: rgba(0, 0, 0, 0.28) !important;
    margin: 6px 0 2px 8px !important;
    padding: 4px 0 !important;
    left: auto !important;
    top: auto !important;
  }

  .context-item.has-submenu.expanded > .context-submenu {
    display: block !important;
  }

  .context-item.has-submenu:hover > .context-submenu {
    display: none;
  }

  .context-item.has-submenu.expanded:hover > .context-submenu {
    display: block !important;
  }
}

/* Image Viewer Modal */
.image-viewer-box {
  width: 90vw;
  height: 88vh;
  display: flex;
  flex-direction: column;
  background: #09090b;
}

.image-viewer-toolbar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.image-viewer-viewport {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#141417 0% 25%, #18181b 0% 50%) 50% / 20px 20px;
  position: relative;
  user-select: none;
}

.image-viewer-img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  transition: transform 0.15s ease-out;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  border-radius: 2px;
}

/* Bulk Renamer Modal */
.bulk-renamer-box {
  width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.rename-rule-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}

.rename-preview-table-wrap {
  flex: 1;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-dark);
}

.diff-tag-new {
  color: var(--success);
  font-weight: 600;
}

.diff-tag-conflict {
  color: var(--danger);
  font-weight: 700;
  background: rgba(239, 68, 68, 0.15);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Mobile Pane Switcher Bar */
.mobile-pane-switcher-bar {
  display: none;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 4px 6px;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-pane-switcher-bar::-webkit-scrollbar {
  display: none;
}
.mobile-pane-tab {
  flex: 1;
  min-width: 80px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
  user-select: none;
}
.mobile-pane-tab.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

/* Mobile Menu Drawer */
/* Custom Pane Border Identification Colors */
.pane.pane-color-amber {
  border-color: rgba(245, 158, 11, 0.45);
}
.pane.pane-color-amber.active {
  border-color: #f59e0b;
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) #f59e0b;
}
.pane.pane-color-amber .pane-idx-badge {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}
.pane.pane-color-amber .pane-idx-badge i,
.pane.pane-color-amber .pane-idx-badge svg {
  color: #f59e0b;
}

.pane.pane-color-emerald {
  border-color: rgba(16, 185, 129, 0.45);
}
.pane.pane-color-emerald.active {
  border-color: #10b981;
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) #10b981;
}
.pane.pane-color-emerald .pane-idx-badge {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
}
.pane.pane-color-emerald .pane-idx-badge i,
.pane.pane-color-emerald .pane-idx-badge svg {
  color: #10b981;
}

.pane.pane-color-sky {
  border-color: rgba(56, 189, 248, 0.45);
}
.pane.pane-color-sky.active {
  border-color: #38bdf8;
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) #38bdf8;
}
.pane.pane-color-sky .pane-idx-badge {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
}
.pane.pane-color-sky .pane-idx-badge i,
.pane.pane-color-sky .pane-idx-badge svg {
  color: #38bdf8;
}

.pane.pane-color-purple {
  border-color: rgba(192, 132, 252, 0.45);
}
.pane.pane-color-purple.active {
  border-color: #c084fc;
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) #c084fc;
}
.pane.pane-color-purple .pane-idx-badge {
  background: rgba(192, 132, 252, 0.15);
  border-color: #c084fc;
}
.pane.pane-color-purple .pane-idx-badge i,
.pane.pane-color-purple .pane-idx-badge svg {
  color: #c084fc;
}

.pane.pane-color-rose {
  border-color: rgba(244, 63, 94, 0.45);
}
.pane.pane-color-rose.active {
  border-color: #f43f5e;
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) #f43f5e;
}
.pane.pane-color-rose .pane-idx-badge {
  background: rgba(244, 63, 94, 0.15);
  border-color: #f43f5e;
}
.pane.pane-color-rose .pane-idx-badge i,
.pane.pane-color-rose .pane-idx-badge svg {
  color: #f43f5e;
}

.pane.pane-color-indigo {
  border-color: rgba(99, 102, 241, 0.45);
}
.pane.pane-color-indigo.active {
  border-color: #6366f1;
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) #6366f1;
}
.pane.pane-color-indigo .pane-idx-badge {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
}
.pane.pane-color-indigo .pane-idx-badge i,
.pane.pane-color-indigo .pane-idx-badge svg {
  color: #6366f1;
}

.pane.pane-color-teal {
  border-color: rgba(20, 184, 166, 0.45);
}
.pane.pane-color-teal.active {
  border-color: #14b8a6;
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) #14b8a6;
}
.pane.pane-color-teal .pane-idx-badge {
  background: rgba(20, 184, 166, 0.15);
  border-color: #14b8a6;
}
.pane.pane-color-teal .pane-idx-badge i,
.pane.pane-color-teal .pane-idx-badge svg {
  color: #14b8a6;
}

.pane.pane-color-orange {
  border-color: rgba(249, 115, 22, 0.45);
}
.pane.pane-color-orange.active {
  border-color: #f97316;
  box-shadow: 0 0 0 var(--pane-active-ring-width, 1px) #f97316;
}
.pane.pane-color-orange .pane-idx-badge {
  background: rgba(249, 115, 22, 0.15);
  border-color: #f97316;
}
.pane.pane-color-orange .pane-idx-badge i,
.pane.pane-color-orange .pane-idx-badge svg {
  color: #f97316;
}

/* Mobile Pane Switcher Tab Color Tinting */
.mobile-pane-tab.pane-tab-color-amber {
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}
.mobile-pane-tab.pane-tab-color-amber.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.mobile-pane-tab.pane-tab-color-emerald {
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}
.mobile-pane-tab.pane-tab-color-emerald.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.mobile-pane-tab.pane-tab-color-sky {
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}
.mobile-pane-tab.pane-tab-color-sky.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.mobile-pane-tab.pane-tab-color-purple {
  border-color: rgba(192, 132, 252, 0.35);
  color: #c084fc;
}
.mobile-pane-tab.pane-tab-color-purple.active {
  background: rgba(192, 132, 252, 0.18);
  border-color: #c084fc;
  color: #c084fc;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.3);
}

.mobile-pane-tab.pane-tab-color-rose {
  border-color: rgba(244, 63, 94, 0.35);
  color: #f43f5e;
}
.mobile-pane-tab.pane-tab-color-rose.active {
  background: rgba(244, 63, 94, 0.18);
  border-color: #f43f5e;
  color: #f43f5e;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.3);
}

.mobile-pane-tab.pane-tab-color-indigo {
  border-color: rgba(99, 102, 241, 0.35);
  color: #6366f1;
}
.mobile-pane-tab.pane-tab-color-indigo.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: #6366f1;
  color: #6366f1;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.mobile-pane-tab.pane-tab-color-teal {
  border-color: rgba(20, 184, 166, 0.35);
  color: #14b8a6;
}
.mobile-pane-tab.pane-tab-color-teal.active {
  background: rgba(20, 184, 166, 0.18);
  border-color: #14b8a6;
  color: #14b8a6;
  box-shadow: 0 0 10px rgba(20, 184, 166, 0.3);
}

.mobile-pane-tab.pane-tab-color-orange {
  border-color: rgba(249, 115, 22, 0.35);
  color: #f97316;
}
.mobile-pane-tab.pane-tab-color-orange.active {
  background: rgba(249, 115, 22, 0.18);
  border-color: #f97316;
  color: #f97316;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.3);
}

/* Custom Hex Arbitrary Color Support */
.pane.pane-color-custom {
  border-color: var(--pane-custom-border) !important;
}
.pane.pane-color-custom.active {
  border-color: var(--pane-custom-border) !important;
  box-shadow: 0 0 0 1.5px var(--pane-custom-border) !important;
}
.mobile-pane-tab.pane-tab-color-custom {
  border-color: var(--pane-custom-border) !important;
  color: var(--pane-custom-border) !important;
}
.mobile-pane-tab.pane-tab-color-custom.active {
  border-color: var(--pane-custom-border) !important;
  color: var(--pane-custom-border) !important;
  box-shadow: 0 0 10px var(--pane-custom-border) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.pane-favorites-wrapper,
.pane-color-wrapper,
.pane-title-badge-wrapper {
  display: inline-flex;
  align-items: center;
  height: 26px;
  position: relative;
  flex-shrink: 0;
}

.pane-title-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 8px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}

.pane-title-badge:hover {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.4);
}

.pane-favorites-wrapper .btn-icon,
.pane-color-wrapper .btn-icon,
.pane-idx-badge {
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  line-height: 1;
}

.pane-favorites-wrapper .btn-icon:hover,
.pane-color-wrapper .btn-icon:hover,
.pane-idx-badge:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.desktop-header-tool {
  display: inline-flex;
}

.mobile-foldable-tool {
  display: none;
}

@media (max-width: 1024px) {
  .desktop-header-tool {
    display: none !important;
  }
  .mobile-foldable-tool {
    display: inline-flex !important;
  }
}

.pane-tools-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
  z-index: 2500;
  width: 260px;
  max-width: 90vw;
  overflow: hidden;
  animation: fadeInDown 0.15s ease-out;
}

/* ---------------- SPOTLIGHT QUICK-SWITCHER ---------------- */
.spotlight-box {
  width: 620px;
  max-width: 92vw;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(245, 158, 11, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: spotlightPop 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes spotlightPop {
  0% { transform: scale(0.96) translateY(-10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.spotlight-input-wrapper {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-header);
  gap: 10px;
}

.spotlight-search-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}

.spotlight-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  font-family: 'Inter', -apple-system, sans-serif;
}

.spotlight-input::placeholder {
  color: var(--text-dim);
  font-size: 13.5px;
}

.spotlight-clear-btn {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  padding: 0 !important;
}

.spotlight-categories {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.spotlight-cat-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.spotlight-cat-btn i, .spotlight-cat-btn svg {
  width: 12px;
  height: 12px;
}

.spotlight-cat-btn.active, .spotlight-cat-btn:hover {
  background: var(--bg-panel);
  color: var(--accent);
  border-color: var(--border);
}

.spotlight-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
}

.spotlight-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  gap: 12px;
  transition: background-color 0.1s ease;
  border: 1px solid transparent;
}

.spotlight-item:hover, .spotlight-item.selected {
  background: var(--bg-hover);
  border-color: rgba(245, 158, 11, 0.3);
}

.spotlight-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.spotlight-item.selected .spotlight-item-icon {
  background: rgba(245, 158, 11, 0.15);
}

.spotlight-item-content {
  flex: 1;
  min-width: 0;
}

.spotlight-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotlight-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.spotlight-item-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-dark);
  color: var(--text-dim);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.spotlight-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.spotlight-hint {
  display: flex;
  align-items: center;
}

.spotlight-hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-main);
  margin-right: 4px;
}

/* ---------------- UNIVERSAL DOCUMENT & PDF VIEWER ---------------- */
.doc-viewer-box {
  width: 92vw;
  height: 90vh;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.doc-viewer-box.fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  border-radius: 0 !important;
  border: none !important;
}

.doc-viewer-header {
  padding: 8px 14px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.doc-viewer-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 35%;
}

.doc-viewer-toolbar-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.doc-viewer-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.doc-viewer-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg-dark);
}

.doc-view-panel {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* CSV Data Table Grid */
.doc-csv-table-wrapper {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.doc-csv-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-align: left;
}

.doc-csv-table th {
  position: sticky;
  top: 0;
  background: var(--bg-header);
  color: var(--accent);
  font-weight: 700;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  z-index: 10;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.doc-csv-table th:hover {
  background: var(--bg-hover);
}

.doc-csv-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text-main);
}

.doc-csv-table tr:hover td {
  background: var(--bg-hover);
}

.doc-csv-table td.row-num {
  color: var(--text-dim);
  background: var(--bg-dark);
  font-size: 10px;
  text-align: right;
  width: 40px;
  user-select: none;
  position: sticky;
  left: 0;
  z-index: 5;
}

.doc-csv-table th.row-num-header {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 15;
  width: 40px;
  text-align: right;
}

/* ---------------- RICH MEDIA & EXIF INSPECTOR ---------------- */
.media-inspector-box {
  width: 680px;
  max-width: 94vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.media-inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.media-inspector-preview-row {
  display: flex;
  gap: 16px;
  padding: 14px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
}

.media-inspector-thumb-wrapper {
  width: 90px;
  height: 90px;
  min-width: 90px;
  border-radius: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.media-inspector-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-inspector-quick-details {
  flex: 1;
  min-width: 0;
}

.inspector-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease;
  position: relative;
}

.inspector-color-swatch:hover {
  transform: scale(1.15);
}

.media-inspector-section {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.media-inspector-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.media-inspector-section-title i, .media-inspector-section-title svg {
  width: 14px;
  height: 14px;
}

.media-inspector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 12px;
}

.inspector-grid-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inspector-grid-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.inspector-grid-value {
  font-size: 12px;
  color: var(--text-main);
  font-family: var(--font-mono);
  word-break: break-all;
}

.media-inspector-gps-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.media-inspector-gps-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------------- TWO-WAY VISUAL DIRECTORY SYNCHRONIZER ---------------- */
.sync-modal-box {
  width: 900px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.sync-top-bar {
  padding: 12px 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sync-path-selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-path-input-group {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.sync-pane-badge {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
}

.sync-path-input-group input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-main);
  outline: none;
}

.sync-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.sync-mode-selector {
  display: flex;
  gap: 12px;
  font-size: 11.5px;
}

.sync-mode-radio {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.sync-filter-toggles {
  display: flex;
  gap: 4px;
}

.sync-filter-btn {
  font-size: 10.5px;
  padding: 3px 8px;
  opacity: 0.75;
}

.sync-filter-btn.active {
  opacity: 1;
  background: var(--accent) !important;
  color: #121214 !important;
  font-weight: 700;
}

.sync-grid-container {
  flex: 1;
  overflow-y: auto;
  min-height: 280px;
  max-height: 480px;
  background: var(--bg-dark);
}

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

.sync-diff-table th {
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  color: var(--text-muted);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  z-index: 10;
  text-transform: uppercase;
  font-size: 10px;
}

.sync-diff-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.sync-diff-table tr:hover td {
  background: var(--bg-hover);
}

.sync-action-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease;
}

.sync-action-badge:hover {
  transform: scale(1.2);
}

.sync-action-badge.action-copy-right {
  background: rgba(56, 189, 248, 0.2);
  color: var(--info);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.sync-action-badge.action-copy-left {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.sync-action-badge.action-identical {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.sync-action-badge.action-delete-right {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.sync-action-badge.action-skip {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ---------------- VISUAL DISK USAGE TREEMAP & BAR ANALYZER ---------------- */
.disk-usage-box {
  width: 850px;
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.du-top-bar {
  padding: 12px 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.du-stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.du-stat-card {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.du-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
}

.du-stat-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-mono);
}

.du-content-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.du-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.du-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.du-item-row:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.du-item-name-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.du-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.du-item-sub {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.du-item-bar-wrapper {
  width: 140px;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.du-item-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.du-item-size-col {
  width: 80px;
  text-align: right;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.du-item-pct-col {
  width: 50px;
  text-align: right;
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* Selected row icon checkmark styling strictly for mobile / narrow touch screens */
@media (max-width: 768px) {
  .row-icon-wrapper.selected {
    background: var(--accent);
    color: #121214 !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    transform: scale(1.05);
  }

  .row-icon-wrapper.selected .file-icon,
  .row-icon-wrapper.selected svg {
    color: #121214 !important;
    stroke: #121214 !important;
    stroke-width: 3.5 !important;
  }
}

/* Mobile Task Drawer Peek Pull-Bar */
.mobile-task-peek-bar {
  display: none;
  width: 100%;
  height: 16px;
  background: transparent;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  position: relative;
  z-index: 110;
  margin-top: -16px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .mobile-task-peek-bar {
    display: flex !important;
  }
}

.mobile-peek-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(26, 28, 34, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 3px 18px 2px 18px;
  box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.18s ease;
  backdrop-filter: blur(4px);
}

.mobile-peek-pill:hover,
.mobile-peek-pill:active {
  background: rgba(38, 41, 50, 1);
  border-color: var(--accent);
}

.mobile-peek-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 2px;
}

.mobile-peek-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* Static Mobile Bottom Command Bar (Total Commander Style) */
.mobile-bottom-bar {
  display: none;
  min-height: 48px;
  height: calc(48px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  padding-left: 4px;
  padding-right: 4px;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  z-index: 100;
}

.mob-cmd-btn {
  flex: 1;
  max-width: 75px;
  height: 42px;
  background: transparent;
  border: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.mob-cmd-btn i, .mob-cmd-btn svg {
  width: 16px;
  height: 16px;
}

.mob-cmd-btn:active {
  background: var(--bg-hover);
  color: var(--accent);
  transform: scale(0.95);
}

.mob-cmd-btn.mob-cmd-accent {
  color: var(--accent);
}

.mob-cmd-btn.has-selection {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.mob-cmd-btn.active {
  background: var(--accent) !important;
  color: #121214 !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
  font-weight: 700;
}

.mob-cmd-btn.active i,
.mob-cmd-btn.active svg {
  stroke: #121214 !important;
}

/* Mobile & Touch Optimizations */
@media (max-width: 900px) {
  .header, .app-header {
    height: auto !important;
    min-height: 44px;
    padding: 6px 10px !important;
    gap: 6px !important;
  }
  .modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
  }
  .image-viewer-box {
    width: 98vw !important;
    height: 94vh !important;
  }
  .bulk-renamer-box {
    width: 95vw !important;
  }

  /* Spotlight on mobile touch screens */
  #spotlight-modal {
    padding-top: 8px !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
  .spotlight-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85vh !important;
    border-radius: 8px !important;
  }
  .spotlight-input-wrapper {
    padding: 10px 12px !important;
    gap: 8px !important;
  }
  .spotlight-input {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
  }
  .spotlight-item {
    padding: 10px 12px !important;
    min-height: 48px !important; /* Standard touch target height */
  }
  .spotlight-footer {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .header-actions {
    gap: 6px !important;
    margin-left: auto;
  }

  .profile-btn {
    padding: 2px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
  }

  .profile-avatar-thumb {
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    border-radius: 50% !important;
    border: 1.5px solid var(--accent) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
  }

  .app-header {
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .app-header .logo-area {
    font-size: 14px !important;
    font-weight: 700 !important;
    gap: 6px;
    margin-right: auto;
  }

  .app-header .logo-area span {
    display: inline-block !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px !important;
    white-space: nowrap !important;
  }

  /* ---------------- NARROW MOBILE SCREENS (<= 600px, e.g. Folded Outer Phone Screen) ---------------- */
  @media (max-width: 600px) {
    .mobile-pane-switcher-bar {
      display: flex !important;
    }

    /* Panes Container: Force 1 active pane on narrow mobile */
    .panes-container,
    .panes-container.layout-single,
    .panes-container.layout-dual-vertical,
    .panes-container.layout-dual-horizontal,
    .panes-container.layout-triple,
    .panes-container.layout-quad {
      display: flex !important;
      flex-direction: column !important;
      width: 100% !important;
      height: 100% !important;
      padding: 0 !important;
      gap: 0 !important;
    }

    .panes-container .pane:not(.active) {
      display: none !important;
    }

    .panes-container .pane.active {
      display: flex !important;
      flex-direction: column !important;
      width: 100% !important;
      height: 100% !important;
      flex: 1 1 auto !important;
      border-radius: 0 !important;
      border: none !important;
    }
  }

  /* ---------------- FOLDABLE PHONES (UNFOLDED) & TABLETS (601px to 1024px) ---------------- */
  @media (min-width: 601px) and (max-width: 1024px) {
    /* Hide single-pane tabs since dual panes are displayed side-by-side */
    .mobile-pane-switcher-bar {
      display: none !important;
    }

    /* Dual Vertical Layout Active by default on Foldable Unfolded Screens */
    .panes-container,
    .panes-container.layout-dual-vertical,
    .panes-container.layout-triple,
    .panes-container.layout-quad {
      display: grid !important;
      grid-template-columns: 1fr 1fr !important;
      grid-template-rows: 1fr !important;
      gap: 6px !important;
      padding: 4px !important;
      height: 100% !important;
      overflow: hidden !important;
    }

    .panes-container.layout-single {
      display: grid !important;
      grid-template-columns: 1fr !important;
      grid-template-rows: 1fr !important;
      gap: 0 !important;
    }

    .panes-container.layout-dual-horizontal {
      display: grid !important;
      grid-template-columns: 1fr !important;
      grid-template-rows: 1fr 1fr !important;
      gap: 4px !important;
    }

    /* In dual layout, show both Pane 0 and Pane 1 side-by-side */
    .panes-container .pane {
      display: flex !important;
      flex-direction: column !important;
      min-width: 0 !important;
      overflow: hidden !important;
      border-radius: 6px !important;
    }

    /* Hide panes beyond visible 2 on foldable dual screens */
    .panes-container:not(.layout-single):not(.layout-triple):not(.layout-quad) .pane:nth-child(n+3) {
      display: none !important;
    }
  }

  /* ---------------- DUAL-SCREEN / FOLDABLE VIEWPORT SEGMENTS & HINGE AWARENESS ---------------- */
  @media (horizontal-viewport-segments: 2) {
    .panes-container,
    .panes-container.layout-dual-vertical {
      display: grid !important;
      grid-template-columns: env(viewport-segment-width 0 0, 1fr) env(viewport-segment-width 1 0, 1fr) !important;
      gap: max(8px, calc(env(viewport-segment-left 1 0, 50vw) - env(viewport-segment-width 0 0, 50vw))) !important;
      padding: 4px env(viewport-segment-left 0 0, 4px) !important;
    }
  }

  @media (screen-spanning: single-fold-vertical) {
    .panes-container,
    .panes-container.layout-dual-vertical {
      display: grid !important;
      grid-template-columns: env(fold-left, 1fr) calc(100vw - env(fold-left, 50vw) - env(fold-width, 0px)) !important;
      gap: max(8px, env(fold-width, 8px)) !important;
    }
  }

  /* Pane Header wrap */
  .pane-header {
    flex-wrap: wrap !important;
    height: auto !important;
    padding: 4px 6px !important;
    gap: 4px !important;
  }

  .pane-nav-btns {
    display: flex;
    gap: 2px;
  }

  .pane-nav-btns button {
    padding: 4px 6px !important;
  }

  .pane-path-bar {
    flex: 1 1 110px !important;
    min-width: 70px !important;
    height: 28px !important;
    font-size: 11px !important;
  }

  .pane-quick-filter {
    width: 100% !important;
    height: 28px !important;
    font-size: 11px !important;
    margin-top: 2px;
  }

  /* Quick Cross-Pane Transfer Button */
  .pane-quick-transfer-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 4px 6px !important;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--accent);
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .pane-quick-transfer-btn:active {
    background: var(--accent-subtle);
    border-color: var(--accent);
  }

  /* Table styling */
  .file-table {
    table-layout: fixed;
    width: 100%;
  }

  .file-table th, .file-table td {
    padding: 7px 5px;
    font-size: 11.5px;
  }

  .file-table th:nth-child(1), .file-table td:nth-child(1) {
    width: 26px !important;
    min-width: 26px !important;
    max-width: 26px !important;
    padding: 0 3px !important;
  }

  .file-table th:nth-child(2), .file-table td:nth-child(2) {
    width: auto !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .file-table th:nth-child(3), .file-table td:nth-child(3) {
    width: 52px !important;
    text-align: right !important;
    font-size: 10.5px !important;
  }

  /* Hide Mode and Owner on all touch/narrow displays */
  .file-table th:nth-child(5), .file-table td:nth-child(5),
  .file-table th:nth-child(6), .file-table td:nth-child(6) {
    display: none !important;
  }

  .file-row {
    height: 42px !important;
    min-height: 42px;
    cursor: pointer;
  }

  .file-row:active {
    background-color: var(--bg-hover) !important;
  }

  /* On mobile: Hide Desktop F-keys and Show Mobile Bottom Bar */
  .bottom-fkey-bar {
    display: none !important;
  }

  .mobile-bottom-bar {
    display: flex !important;
  }

  .terminal-drawer {
    height: 70vh !important;
  }

  /* Modals */
  .modal-box {
    width: 96vw !important;
    max-width: 96vw !important;
    margin: 6px auto !important;
    max-height: 90vh !important;
    padding: 10px !important;
    border-radius: 8px !important;
  }

  .modal-header {
    padding: 8px 10px !important;
  }

  .modal-body {
    padding: 8px 10px !important;
  }

  .modal-footer {
    padding: 8px 10px !important;
  }
}

/* Ultra-Narrow Mobile Screens (e.g. Galaxy Z Fold Outer Screen <= 420px) */
@media (max-width: 480px) {
  /* Hide Modified timestamp column completely on ultra-narrow screens */
  .file-table th:nth-child(4), .file-table td:nth-child(4) {
    display: none !important;
  }

  .header .logo-area span:not(.dog-badge),
  .app-header .logo-area span:not(.dog-badge) {
    font-size: 13px;
  }

  .mobile-pane-tab {
    font-size: 10px;
    padding: 4px 8px;
    min-width: 70px;
  }

  .fkey-btn .fkey-num {
    font-size: 9px;
  }

  .tasks-pill {
    bottom: 46px;
    right: 8px;
    padding: 4px 8px;
    font-size: 10px;
  }
}

/* ---------------- HEADER DROPDOWNS & PROFILE MENU ---------------- */
.tools-dropdown-wrapper, .profile-dropdown-wrapper, .pane-favorites-wrapper, .pane-color-wrapper {
  position: relative;
  display: inline-flex;
}

.tools-dropdown-menu, .profile-dropdown-menu, .pane-favorites-dropdown, .pane-color-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  background: var(--bg-header);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  z-index: 1200;
  display: none;
  min-width: 210px;
  overflow: hidden;
}

.tools-dropdown-menu {
  right: 0;
  left: auto;
  min-width: 250px;
  max-width: calc(100vw - 20px);
}

.profile-dropdown-menu {
  right: 0;
  min-width: 240px;
}

.pane-favorites-dropdown, .pane-color-dropdown {
  right: 0;
  left: auto;
  min-width: 280px;
  max-height: 380px;
  overflow-y: auto;
}

.tools-dropdown-menu.active, .profile-dropdown-menu.active, .pane-favorites-dropdown.active, .pane-color-dropdown.active {
  display: block;
}

.color-swatch-btn {
  transition: all 0.15s ease;
}

.color-swatch-btn:hover {
  background: var(--bg-hover) !important;
  border-color: var(--accent) !important;
}

.color-swatch-btn.active {
  border-color: var(--accent) !important;
  background: rgba(245, 158, 11, 0.12) !important;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.dropdown-item i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
}

.profile-avatar-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar-thumb img,
.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-subtle);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar-clickable {
  cursor: pointer;
  position: relative;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.profile-avatar-clickable:hover {
  transform: scale(1.06);
  border-color: var(--accent-hover);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
}

.profile-dropdown-header {
  padding: 12px;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.profile-header-shield-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-dim);
  opacity: 0.5;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: auto;
  flex-shrink: 0;
}

.profile-header-shield-btn i {
  width: 17px;
  height: 17px;
  transition: all 0.2s ease;
}

.profile-header-shield-btn.active {
  color: #22c55e;
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.75));
}

.profile-header-shield-btn:hover {
  transform: scale(1.15);
  opacity: 1;
  color: #22c55e;
  filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.95));
}

.user-role-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent);
  color: #121214;
  letter-spacing: 0.5px;
}

.profile-dropdown-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border);
}

.profile-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.profile-action-btn i {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.profile-action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.profile-action-btn.btn-danger-action:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
  color: #f87171;
}

.profile-action-btn.btn-danger-action:hover i {
  color: #f87171;
}

/* ---------------- EDITOR SEARCH & REPLACE TOOLBAR ---------------- */
.editor-find-bar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 12px;
}

.editor-status-bar {
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  padding: 4px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ---------------- DIFF & COMPARISON MODAL (RESPONSIVE & FOLDABLE) ---------------- */
.diff-modal-box {
  width: 950px;
  max-width: 96vw;
  height: 88vh;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.diff-modal-header {
  padding: 10px 16px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.diff-header-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.diff-header-icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.diff-header-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.diff-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.diff-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px;
  gap: 10px;
  background: var(--bg-main);
  min-height: 0;
}

.diff-paths-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--bg-header);
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.diff-path-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.diff-path-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
  max-width: 45%;
  min-width: 0;
}

.diff-path-chip code {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.diff-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.diff-filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}

.diff-filter-bar::-webkit-scrollbar {
  display: none;
}

.diff-filter-btn {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.diff-filter-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.diff-filter-btn.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.diff-table-wrapper {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-dark);
  min-height: 0;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.diff-table th {
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  color: var(--text-muted);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  z-index: 10;
  text-transform: uppercase;
  font-size: 10px;
  white-space: nowrap;
}

.diff-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.diff-table tr:hover td {
  background: var(--bg-hover);
}

/* File Diff View Styles */
.diff-file-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--bg-header);
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.diff-file-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.diff-container {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  min-height: 0;
  line-height: 1.5;
}

.diff-line {
  display: flex;
  min-width: 100%;
  width: max-content;
  padding: 1px 8px;
  white-space: pre;
}

.diff-line.insert {
  background-color: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.diff-line.delete {
  background-color: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.diff-gutter {
  width: 70px;
  min-width: 70px;
  color: var(--text-dim);
  text-align: right;
  padding-right: 12px;
  margin-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
  font-size: 10.5px;
}

/* Foldable & Mobile Media Queries */
@media (max-width: 768px) {
  .diff-modal-box {
    width: 98vw !important;
    height: 94vh !important;
    max-height: 94vh !important;
    border-radius: 8px !important;
  }

  .diff-modal-header {
    padding: 8px 12px;
  }

  .diff-header-title {
    font-size: 12px;
  }

  .diff-paths-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .diff-path-chips {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .diff-path-chip {
    max-width: 100%;
  }

  .diff-action-buttons {
    justify-content: flex-end;
  }

  .diff-file-header-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .diff-gutter {
    width: 50px;
    min-width: 50px;
    padding-right: 6px;
    margin-right: 4px;
  }
}

/* ---------------- CONVERTER MODAL ---------------- */
.converter-preview-box {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---------------- ADMIN CONTROL PANEL TABLES & ROWS ---------------- */
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  font-size: 12px;
  text-align: left;
}

.admin-table th {
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}

.admin-user-row {
  background: var(--bg-dark);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.admin-user-row:hover {
  background: var(--bg-hover);
}

.admin-user-cell {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-user-cell:first-child {
  border-left: 1px solid var(--border);
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.admin-user-cell:last-child {
  border-right: 1px solid var(--border);
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

/* ---------------- DRAG & DROP OVERLAYS & ROW TARGETS ---------------- */
.file-row.drag-over-row {
  background-color: rgba(245, 158, 11, 0.25) !important;
  outline: 2px dashed var(--accent);
}

.pane-drag-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 500;
  pointer-events: none;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  backdrop-filter: blur(4px);
}

/* ---------------- MEDIA PLAYER & IN-BROWSER READERS ---------------- */
.media-player-box {
  width: 580px;
  max-width: 95vw;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.media-player-display {
  background: #000;
  min-height: 180px;
  max-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.media-player-display video {
  width: 100%;
  max-height: 480px;
  background: #000;
}

.media-audio-visualizer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 10px;
}

.media-controls-bar {
  padding: 14px 16px;
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.media-scrubber-track {
  width: 100%;
  height: 6px;
  background: var(--bg-dark);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border);
}

.media-scrubber-progress {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.comic-reader-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0f19;
  position: relative;
  padding: 16px;
  min-height: 400px;
}

.comic-reader-img {
  max-width: 100%;
  max-height: calc(85vh - 120px);
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  transition: transform 0.15s ease;
}

/* Layout Switcher Button Group */
.layout-btn-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Header Separator */
.header-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

/* Header Tasks Button (Left of Profile) */
.header-task-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  position: relative;
  font-weight: 600;
  font-size: 11px;
  padding: 0 9px !important;
  width: auto !important;
  min-width: 52px !important;
  height: 32px !important;
  min-height: 32px !important;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.header-task-btn #header-task-icon,
.header-task-btn svg,
.header-task-btn i {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
  color: var(--text-main);
}

.header-task-btn.has-running {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--accent);
}

.header-task-btn.has-running #header-task-icon,
.header-task-btn.has-running svg,
.header-task-btn.has-running i {
  color: var(--accent) !important;
  animation: pulseDot 1.2s infinite;
}

.header-task-badge {
  background: var(--bg-dark);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0 4px;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 15px;
  text-align: center;
  line-height: 14px;
  display: inline-block;
}

.header-task-btn.has-running .header-task-badge {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.header-task-speed {
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  margin-left: 2px;
}

/* ========================================================
   TERACOPY-STYLE TASK MANAGER & MOBILE PULL-UP DRAWER
   ======================================================== */
.task-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1490;
}

.task-drawer-backdrop.active {
  display: block;
}

.floating-task-window {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 520px;
  min-width: 360px;
  max-width: min(880px, calc(100vw - 32px));
  min-height: 220px;
  max-height: min(780px, calc(100vh - 48px));
  background: #16181d;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(0, 0, 0, 0.4);
  z-index: 1500;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--text-main);
  animation: taskSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2D Resize Handles for Desktop */
.task-win-resize-handle {
  width: 100%;
  height: 8px;
  background: #1e2128;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
  touch-action: none;
  transition: background 0.15s ease;
}

.task-win-resize-handle:hover,
.task-win-resize-handle.dragging {
  background: var(--accent);
}

.resize-handle-bar {
  width: 36px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.task-win-resize-left {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 12;
  user-select: none;
  touch-action: none;
}

.task-win-resize-left:hover,
.task-win-resize-left.dragging {
  background: var(--accent);
}

.task-win-resize-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}

.task-win-resize-corner:hover,
.task-win-resize-corner.dragging {
  background: var(--accent);
  border-radius: 2px;
}

.drawer-pull-bar {
  display: none;
}

.floating-task-window.active {
  display: flex;
}

.floating-task-window.minimized {
  display: none;
}

.floating-task-window.maximized {
  width: 720px !important;
  max-height: 85vh !important;
}

@keyframes taskSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.task-win-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #20232a;
  border-bottom: 1px solid var(--border);
  user-select: none;
  gap: 8px;
}

.task-win-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.task-status-indicator.active {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulseDot 1.5s infinite;
}

.task-speed-badge {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.task-win-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-task-control {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.btn-task-control i {
  width: 14px;
  height: 14px;
}

.btn-task-control:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-task-control.btn-task-close {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  width: 28px;
  height: 28px;
}

.btn-task-control.btn-task-close:hover {
  background: #ef4444;
  color: #fff;
}

/* Mobile & Touch Interface Drawer Overlay */
@media (max-width: 768px) {
  .task-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2490;
    transition: opacity 0.22s ease;
  }

  .task-drawer-backdrop.active {
    display: block;
  }

  .floating-task-window {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    height: clamp(520px, 80vh, calc(var(--viewport-height, 100vh) - 24px)) !important;
    max-height: calc(var(--viewport-height, 100vh) - 24px) !important;
    border-radius: 20px 20px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.95) !important;
    z-index: 2500 !important;
    overflow: hidden !important;
    touch-action: none;
    transform: translateY(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.26s;
  }

  .floating-task-window.active {
    transform: translateY(0);
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .floating-task-window.drawer-dragging {
    visibility: visible !important;
    pointer-events: auto !important;
    transition: none !important;
  }

  .drawer-pull-bar {
    width: 100%;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #20232a;
    cursor: grab;
    touch-action: none;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
  }

  .drawer-pull-bar:active {
    cursor: grabbing;
  }

  .drawer-pull-handle {
    width: 48px;
    height: 5px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 3px;
  }

  .task-win-resize-handle,
  .task-win-resize-left,
  .task-win-resize-corner {
    display: none !important;
  }

  .task-win-header {
    padding: 10px 14px !important;
    cursor: grab;
    touch-action: none;
    flex-shrink: 0;
  }

  .task-batch-summary,
  .task-active-file-card {
    flex-shrink: 0;
  }

  .task-queue-container {
    flex: 1 1 auto !important;
    min-height: 200px !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
  }

  .task-log-container {
    flex: 1 1 auto !important;
    min-height: 200px !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
  }

  .task-log-console {
    max-height: none !important;
    height: auto !important;
    min-height: 100% !important;
    touch-action: pan-y !important;
  }

  .task-win-footer {
    padding: 10px 12px max(24px, calc(env(safe-area-inset-bottom, 0px) + 14px)) 12px !important;
    background: #181a20 !important;
    border-top: 1px solid var(--border) !important;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    flex-shrink: 0;
  }

  .task-footer-left,
  .task-footer-right {
    display: contents !important;
  }

  .task-win-footer .btn {
    width: 100% !important;
    padding: 8px 4px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
  }

  .btn-task-control.btn-task-close {
    width: 32px !important;
    height: 32px !important;
  }
}

.task-batch-summary {
  padding: 10px 14px 8px 14px;
  background: #1a1c22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.task-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.task-progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.task-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  width: 0%;
  border-radius: 4px;
  transition: width 0.25s ease;
}

.task-active-file-card {
  padding: 10px 14px;
  background: #14161a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.task-file-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  margin-bottom: 4px;
}

.task-cur-filename {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.task-cur-speed {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
}

.task-file-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.05);
}

.task-file-fill {
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.task-file-stats {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-mono);
}

.task-queue-container {
  max-height: 180px;
  overflow-y: auto;
  background: #121418;
}

.task-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
  gap: 8px;
  user-select: text;
  -webkit-user-select: text;
}

.task-queue-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.task-queue-details {
  flex: 1;
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
}

.task-queue-error-box {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  font-size: 10px;
  color: #fca5a5;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  user-select: text;
  -webkit-user-select: text;
  cursor: pointer;
  transition: background 0.15s;
}

.task-queue-error-box:hover {
  background: rgba(239, 68, 68, 0.2);
}

.task-queue-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-queue-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-queue-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.task-badge-running { background: rgba(245, 158, 11, 0.2); color: var(--accent); }
.task-badge-completed { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.task-badge-failed { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.task-badge-paused { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.task-badge-cancelled { background: rgba(100, 116, 139, 0.2); color: #64748b; }

.task-log-container {
  max-height: 180px;
  overflow-y: auto;
  background: #0d0f12;
  padding: 8px 12px;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.task-log-console {
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', var(--font-mono);
  font-size: 10.5px;
  color: #a3e635;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.45;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.task-win-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #1c1f26;
  border-top: 1px solid var(--border);
}

.task-footer-left {
  display: flex;
  gap: 4px;
}

.tasks-pill-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.2s infinite;
}

.tasks-pill-speed {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  background: rgba(245, 158, 11, 0.25);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ==========================================================================
   SESSION LOCK SCREEN & CREDENTIAL MODAL
   ========================================================================== */
.session-lock-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(10, 12, 16, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.session-lock-screen.active {
  display: flex !important;
}

.lock-screen-card {
  width: 100%;
  max-width: 380px;
  background: #181b22;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: lockCardPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lockCardPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.lock-screen-brand {
  text-align: center;
  margin-bottom: 20px;
}

.lock-avatar-thumb {
  width: 68px;
  height: 68px;
  min-width: 68px;
  min-height: 68px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
  margin: 0 auto 14px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  user-select: none;
  flex-shrink: 0;
}

.lock-avatar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lock-brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.lock-user-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 2px;
}

.lock-sub-text {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.lock-input-group {
  position: relative;
  margin-bottom: 12px;
}

.lock-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

.lock-password-input {
  width: 100%;
  padding: 10px 12px 10px 36px !important;
  font-size: 13px;
  background: #12141a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
}

.lock-password-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.lock-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  text-align: center;
}

/* ========================================================
   UNIVERSAL CUSTOM DIALOG & TOAST NOTIFICATION SYSTEM
   ======================================================== */
.dialog-box {
  background: #181a20;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.5);
  animation: dialogScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes dialogScaleIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #20232c;
  border-bottom: 1px solid var(--border);
}

.dialog-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
}

.dialog-icon-wrapper.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.dialog-icon-wrapper.success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.dialog-icon-wrapper.info {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.dialog-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.dialog-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.dialog-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
}

.dialog-message {
  margin-bottom: 10px;
  word-break: break-word;
}

.dialog-items-preview {
  max-height: 140px;
  overflow-y: auto;
  background: #111317;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: #1d2028;
  border-top: 1px solid var(--border);
}

/* Toast Notifications (Top Center) */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1e2129;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  min-width: 240px;
  max-width: 400px;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0s, var(--toast-duration, 3.2s);
}

.toast.toast-success {
  border-left: 3px solid #22c55e;
}

.toast.toast-error {
  border-left: 3px solid #ef4444;
}

.toast.toast-info {
  border-left: 3px solid #38bdf8;
}

.toast.toast-warning {
  border-left: 3px solid var(--accent);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
}

/* ==========================================================================
   MOBILE & FOLDABLE CONSOLIDATED LAYOUT TWEAKS FOR EDITOR & VIEWERS
   ========================================================================== */
.image-viewer-toolbar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.image-viewer-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 40%;
}

.image-viewer-nav-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
  flex-shrink: 0;
}

.image-viewer-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  /* 1. Floating Power Editor Fullscreen on Mobile / Foldables */
  .floating-editor-window {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  .floating-editor-window .win-resize-handle {
    display: none !important;
  }

  .editor-header {
    padding: 6px 10px;
    height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .editor-header-right button {
    min-height: 32px;
    padding: 4px 8px;
  }

  .editor-touch-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100vw !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85) !important;
    border: 1px solid var(--border) !important;
    border-bottom: none !important;
    padding: 12px 12px 28px 12px !important;
    background: #14171f !important;
    z-index: 2900 !important;
  }

  .editor-touch-menu .dropdown-item {
    padding: 12px 14px !important;
    font-size: 13.5px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    border-radius: 8px !important;
  }

  .editor-touch-menu .dropdown-item:active {
    background: rgba(245, 158, 11, 0.2) !important;
  }

  .editor-tab-strip {
    height: 38px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .editor-tab {
    padding: 0 12px;
    font-size: 11px;
    max-width: 160px;
    min-height: 30px;
  }

  .editor-find-bar {
    padding: 8px 10px;
  }

  .editor-find-bar input {
    width: 130px !important;
  }

  .editor-grid.dual-vertical {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr 1fr !important;
  }

  .editor-gutter {
    width: 38px !important;
    min-width: 38px !important;
    font-size: 10.5px !important;
    padding-right: 6px !important;
  }

  .editor-textarea {
    font-size: 12px !important;
    padding: 8px !important;
  }

  /* 2. Image Viewer Modal on Mobile */
  .image-viewer-box {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .image-viewer-toolbar {
    padding: 6px 10px;
    height: 42px;
  }

  .image-viewer-title-group {
    max-width: 30%;
  }

  .image-viewer-nav-pill {
    padding: 1px 2px;
  }

  /* 3. Document & PDF Viewer Modal on Mobile */
  .doc-viewer-box {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .doc-viewer-header {
    padding: 6px 10px;
    height: 42px;
  }

  .doc-viewer-title-group {
    max-width: 45%;
  }

  .doc-view-panel.markdown-preview-pane {
    padding: 14px 16px !important;
  }

  /* 4. Media Player on Mobile */
  .media-player-box {
    width: 96vw !important;
    max-width: 96vw !important;
    margin: auto;
  }

  /* 5. Comic & EPUB Book Reader on Mobile */
  .modal-box[style*="book-reader-modal"] {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
  }
}

/* ==========================================================================
   COLOR LABELS, CUSTOM TAGS & BRANCH / VIRTUAL PANE STYLING
   ========================================================================== */
.color-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  font-size: 8.5px;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.color-dot:hover {
  transform: scale(1.3);
}

.context-color-palette {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 3px 6px;
  background: var(--bg-dark);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.color-red { background-color: #ef4444 !important; }
.color-orange { background-color: #f97316 !important; }
.color-yellow { background-color: #eab308 !important; }
.color-green { background-color: #22c55e !important; }
.color-blue { background-color: #3b82f6 !important; }
.color-purple { background-color: #a855f7 !important; }
.color-none { background-color: transparent !important; border: 1px dashed var(--text-dim); color: var(--text-dim); }

.tags-color-picker {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tag-color-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}

.tag-color-btn.active {
  border-color: #fff !important;
  transform: scale(1.18);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.file-tag-badge {
  font-size: 9.5px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.file-row-color-red { border-left: 3px solid #ef4444 !important; background: rgba(239, 68, 68, 0.05); }
.file-row-color-orange { border-left: 3px solid #f97316 !important; background: rgba(249, 115, 22, 0.05); }
.file-row-color-yellow { border-left: 3px solid #eab308 !important; background: rgba(234, 179, 8, 0.05); }
.file-row-color-green { border-left: 3px solid #22c55e !important; background: rgba(34, 197, 94, 0.05); }
.file-row-color-blue { border-left: 3px solid #3b82f6 !important; background: rgba(59, 130, 246, 0.05); }
.file-row-color-purple { border-left: 3px solid #a855f7 !important; background: rgba(168, 85, 247, 0.05); }

.branch-view-banner,
.virtual-pane-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.branch-view-badge,
.virtual-pane-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   FLOATING CALCULATOR & UNIT CONVERTER
   ========================================================================== */
.floating-calculator-window {
  position: fixed;
  width: 330px;
  background-color: var(--bg-header);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 1750;
  overflow: hidden;
  user-select: none;
  font-family: var(--font-main);
}

.calc-header {
  padding: 8px 12px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
}

.calc-header:active {
  cursor: grabbing;
}

.calc-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0d0f14;
}

.calc-display-panel {
  background: #050608;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.calc-expression-line {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  min-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-result-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-result-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  text-align: right;
  outline: none;
  width: 100%;
}

.calc-converters-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.calc-conv-item {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-conv-lbl {
  color: var(--accent);
  font-weight: 700;
  font-size: 9.5px;
}

.calc-conv-val {
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
}

.calc-units-row {
  display: flex;
  gap: 4px;
  justify-content: space-between;
}

.calc-unit-btn {
  flex: 1;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 4px 0;
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 4px;
  cursor: pointer;
}

.calc-unit-btn:hover {
  background: rgba(245, 158, 11, 0.25);
}

.calc-keypad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.calc-btn {
  height: 34px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: all 0.1s ease;
  cursor: pointer;
}

.calc-btn-num {
  background: #14171f;
  color: #fff;
}
.calc-btn-num:hover {
  background: #1e232f;
  border-color: rgba(255,255,255,0.2);
}

.calc-btn-fn {
  background: #0f1218;
  color: var(--text-dim);
}
.calc-btn-fn:hover {
  background: #181d26;
  color: #fff;
}

.calc-btn-op {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.2);
  font-size: 15px;
}
.calc-btn-op:hover {
  background: rgba(56, 189, 248, 0.22);
}

.calc-btn-equals {
  background: var(--accent);
  color: #000;
  font-weight: 800;
  font-size: 16px;
  border-color: var(--accent);
}
.calc-btn-equals:hover {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.calc-history-panel {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
  max-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.calc-history-list {
  overflow-y: auto;
  max-height: 105px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 6px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  cursor: pointer;
}
.calc-history-item:hover {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent);
}

.calc-pill {
  position: fixed;
  bottom: 12px;
  right: 170px;
  background: var(--bg-header);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  cursor: pointer;
  z-index: 1550;
  transition: transform 0.15s ease;
}
.calc-pill:hover {
  transform: translateY(-2px);
  background: var(--bg-hover);
}

@media (max-width: 768px) {
  .floating-calculator-window {
    width: calc(100vw - 20px) !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 56px !important;
    top: auto !important;
  }
  .calc-pill {
    bottom: 56px;
    right: 10px;
  }
}

/* --- In-Pane Docked Tool Containers --- */
.pane-docked-tool-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg-panel);
  overflow: hidden;
  position: relative;
}

.pane-docked-header {
  padding: 6px 10px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

/* --- Git Badges & Manager UI --- */
.pane-git-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease;
}

.pane-git-badge:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent);
}

.git-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 11.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.1s ease;
}

.git-file-row:hover {
  background: var(--bg-hover);
}

.git-file-row.active {
  background: rgba(245, 158, 11, 0.15);
  border-left: 3px solid var(--accent);
}

.git-status-char {
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 11px;
  width: 16px;
  text-align: center;
  display: inline-block;
}
.git-status-char.staged { color: #22c55e; }
.git-status-char.modified { color: #f59e0b; }
.git-status-char.untracked { color: #38bdf8; }
.git-status-char.deleted { color: #ef4444; }

.diff-line-add {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  display: block;
}
.diff-line-del {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  display: block;
}
.diff-line-hdr {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-weight: 700;
  display: block;
}

/* --- Theme Swatches & Visual Cards --- */
.theme-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.theme-swatch-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.18s ease;
  user-select: none;
}

.theme-swatch-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.theme-swatch-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--bg-active);
}

.theme-swatch-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-swatch-preview {
  display: flex;
  gap: 4px;
  align-items: center;
}

.theme-swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}
