* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Consolas', 'Microsoft YaHei', 'Monaco', monospace;
}
body {
  background: linear-gradient(135deg, #1e1e1e 0%, #252526 100%);
  color: #d4d4d4;
  min-height: 100vh;
  overflow-x: hidden;
}
.container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  padding: 10px;
  gap: 10px;
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(37, 37, 38, 0.9);
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo i {
  color: #80c4f1;
  font-size: 28px;
}
.logo h1 {
  font-size: 24px;
  font-weight: 700;
  background: #80c4f1;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}
.group-input-container {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(30, 30, 30, 0.8);
  padding: 10px 20px;
  border-radius: 8px;
}
.terminal-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

#logout-btn {
  transition: color 0.2s;
}

#logout-btn:hover {
  color: #f44747 !important;
}

.group-input-container label {
  font-weight: 600;
  color: #808080;
}
.group-input {
  background: rgba(60, 60, 60, 0.7);
  border: 1px solid #475569;
  color: #f1f5f9;
  padding: 10px 15px;
  border-radius: 6px;
  width: 250px;
  font-size: 14px;
  transition: all 0.3s;
}
.group-input:focus {
  outline: none;
  border-color: #80c4f1;
  box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
}
.btn {
  background: #007acc;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  align-items: center;
  gap: 8px;
}
.btn:hover {
  background: #0098ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}
.btn:active {
  transform: translateY(0);
}
.main-content {
  display: flex;
  flex: 1;
  min-height: 0;
}
.left-panel {
  display: flex;
  flex-direction: column;
  width: 450px;
  max-width: 600px;
  background: rgba(37, 37, 38, 0.9);
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  flex-shrink: 0;
}

/* 侧边栏拖动条样式 */
.resize-handle,
.resize-handle-right {
  width: 8px;
  flex-shrink: 0;
  cursor: ew-resize;
  background: rgba(100, 116, 139, 0.3);
  border-radius: 2px;
  margin: 0 2px;
  position: relative;
  transition: background-color 0.2s;
}

.resize-handle:hover,
.resize-handle-right:hover {
  background: rgba(0, 122, 204, 0.8);
}

.resize-handle::after,
.resize-handle-right::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 40px;
  background: rgba(148, 163, 184, 0.6);
  border-radius: 1px;
}

.resize-handle:hover::after,
.resize-handle-right:hover::after {
  background: rgba(0, 122, 204, 1);
}
/* 侧边栏面板头部 */
.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  padding-right: 14px;
  font-weight: 600;
  font-size: 15px;
  color: #80c4f1;
  background: rgba(30, 30, 30, 0.9);
  border-bottom: 1px solid rgba(80, 80, 80, 0.3);
  user-select: none;
  position: relative;
}

.panel-header-title {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.right-panel .panel-header {
  padding: 14px 18px;
  gap: 10px;
}

.right-panel .panel-header .panel-header-title {
  flex: 1;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-header i {
  font-size: 16px;
}

.left-panel .panel-header-actions {
  position: absolute;
  right: 14px;
}

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

/* 面板操作按钮 */
.btn-panel-refresh,
.btn-panel-action {
  background: none;
  border: none;
  color: #569cd6;
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-panel-refresh:hover,
.btn-panel-action:hover {
  color: #80c4f1;
  background: rgba(0, 122, 204, 0.15);
}

.btn-panel-action {
  width: 24px;
  height: 24px;
  font-size: 12px;
}
.panel-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* 统一设备树面板样式 */
.device-tree {
  list-style: none;
}

/* 设备节点（折叠组） */
.device-node {
  margin-bottom: 6px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(80, 80, 80, 0.4);
  transition: all 0.2s;
}

.device-node:hover {
  border-color: rgba(80, 80, 80, 0.7);
}

.device-node.device-offline {
  opacity: 0.5;
}

.device-node.device-offline:hover {
  border-color: rgba(244, 71, 71, 0.3);
}

/* 设备头部（点击展开/折叠） */
.device-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 10px 12px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
  min-height: 50px;
  gap: 4px;
}

.device-node-header .device-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.device-node-header:hover .device-header-actions {
  opacity: 1;
}

.device-node-header:hover {
  background: rgba(60, 60, 60, 0.4);
}

.device-node-header .device-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.device-node-header .device-toggle {
  color: #808080;
  font-size: 11px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.device-node.open .device-toggle {
  transform: rotate(90deg);
}

.device-node-header .device-id {
  font-weight: 600;
  font-size: 14px;
  color: #d4d4d4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-node-header .device-name {
  font-weight: 600;
  font-size: 14px;
  color: #d4d4d4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.device-node-header .device-status-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.device-node-header .device-status-icon.online {
  color: #80c4f1;
}

.device-node-header .device-status-icon.offline {
  color: #f44747;
}

.device-occupied {
  color: #dcdcaa !important;
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(220, 220, 170, 0.1);
  border-radius: 3px;
  flex-shrink: 0;
  font-family: system-ui, sans-serif;
}

/* 设备展开内容区域 */
.device-node-body {
  display: none;
  border-top: 1px solid rgba(80, 80, 80, 0.3);
  background: rgba(37, 37, 38, 0.4);
}

.device-node.open .device-node-body {
  display: block;
}

.device-uart-list {
  padding-top: 4px;
}

.device-uart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 36px;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 38px;
}

.device-uart-item:hover {
  background: rgba(60, 60, 60, 0.3);
}

.device-node.device-offline .device-uart-item {
  cursor: not-allowed;
}

.device-uart-item .uart-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 11px;
}

.uart-status {
  margin-left: 2px;
  margin-right: 3px;
}
.device-uart-item .uart-label .uart-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.device-uart-item .uart-label .uart-status.online {
  background-color: #0098ff;
  box-shadow: 0 0 6px #80c4f1;
}

.device-uart-item .uart-label .uart-status.offline {
  background-color: #f44747;
}

.device-uart-item .uart-label span {
  font-size: 13px;
  color: #c2c2c2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-uart-item .uart-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.uart-btn-group {
  padding: 2px 2px;
}

/* 子树按钮统一 20x20 容器 */
.uart-btn-group .conn-status,
.uart-btn-group .telnet-preset-remove,
.uart-btn-group .btn-file-refresh,
.uart-btn-group .btn-server-log-refresh,
.uart-btn-group .btn-file-view,
.uart-btn-group .btn-file-download,
.uart-btn-group .btn-row-close {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* 行内关闭标签页按钮 */
.uart-btn-group .btn-row-close {
  background: transparent;
  border: none;
  color: #80c4f1;
  font-size: 10px;
  flex-shrink: 0;
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.uart-btn-group .btn-row-close:hover {
  color: #f44747;
  background: #2a2d3e;
}

/* 统一连接状态图标（UART / Telnet 共用） */
.uart-btn-group .conn-status {
  background: transparent;
  border: none;
  color: #4ec9b0;
  font-size: 11px;
  flex-shrink: 0;
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.uart-btn-group .conn-status:hover {
  color: #569cd6;
  background: #2a2d3e;
}

.uart-btn-group .conn-status.offline {
  color: #666;
}

/* Telnet 删除按钮 / 文件操作按钮（共用） */
.telnet-preset-remove,
.btn-file-refresh,
.btn-server-log-refresh,
.btn-file-view,
.btn-file-download {
  background: transparent;
  border: none;
  color: #808080;
  font-size: 11px;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  transition:
    color 0.2s,
    background 0.2s;
}

.telnet-preset-remove:hover,
.btn-file-refresh:hover,
.btn-server-log-refresh:hover,
.btn-file-view:hover,
.btn-file-download:hover {
  color: #569cd6;
  background: rgba(86, 156, 214, 0.1);
}

/* Telnet 连接中 */
.device-telnet-item.telnet-connecting .conn-status {
  color: #cca700;
  animation: telnet-pulse 1s infinite;
}

@keyframes telnet-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* 设备信息对话框 */
.device-info-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.device-info-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

.device-info-dialog {
  position: relative;
  z-index: 1;
  background: #1e1e1e;
  border: 1px solid rgba(80, 80, 80, 0.3);
  border-radius: 8px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.device-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(80, 80, 80, 0.3);
}

.device-info-header h2 {
  margin: 0;
  font-size: 15px;
  color: #80c4f1;
}

.device-info-header i {
  margin-right: 8px;
}

.device-info-close {
  background: transparent;
  border: none;
  color: #808080;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.device-info-close:hover {
  color: #d4d4d4;
}

.device-info-error {
  padding: 10px 18px;
  color: #f44747;
  font-size: 13px;
  background: rgba(244, 71, 71, 0.08);
}

.device-info-body {
  padding: 14px 18px;
  max-height: 60vh;
  overflow-y: auto;
}

.device-info-loading {
  text-align: center;
  color: #808080;
  padding: 20px;
  font-size: 13px;
}

.device-info-loading i {
  margin-right: 6px;
}

.device-info-table {
  width: 100%;
  border-collapse: collapse;
}

.device-info-table td {
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(80, 80, 80, 0.15);
  vertical-align: middle;
}

.device-info-table .info-label {
  color: #808080;
  width: 130px;
  white-space: nowrap;
}

.rssi-value {
  font-weight: 600;
}
.rssi-good {
  color: #4ec9b0;
}
.rssi-fair {
  color: #cca700;
}
.rssi-weak {
  color: #f44747;
}

.status-online {
  color: #4ec9b0;
}
.status-offline {
  color: #f44747;
}

.btn-device-info {
  background: transparent;
  border: none;
  color: #808080;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-device-info:hover {
  color: #569cd6;
  background: rgba(86, 156, 214, 0.1);
}

.device-server-log-section {
  padding-bottom: 8px;
}

/* 文件分类（可折叠） */
.file-category-group {
  margin-bottom: 2px;
}

.file-category-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  min-height: 36px;
  user-select: none;
  font-size: 13px;
  font-weight: 300;
  color: #808080;
  cursor: pointer;
  transition: background 0.15s;
}

.file-category-tag:hover {
  background: rgba(60, 60, 60, 0.3);
}

.file-cat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 9px;
  color: #808080;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.file-category-group.open .file-cat-toggle {
}

.file-category-tag i:not(.file-cat-toggle i) {
  font-size: 11px;
  color: #5a5a5a;
}

.file-cat-name {
  letter-spacing: 0.3px;
  color: #c2c2c2;
}

.file-count {
  font-weight: 400;
  color: #5a5a5a;
  margin-left: 2px;
}

.file-size {
  color: #888;
  font-size: 12px;
  margin-right: 8px;
  margin-left: auto;
}

.fa-file-alt {
  color: #80c4f1;
}

.file-category-group:not(.open) .file-cat-items {
  display: none;
}

.terminal-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(37, 37, 38, 0.9);
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  min-width: 0;
}
.terminal-tabs {
  display: flex;
  background: rgba(30, 30, 30, 0.9);
  padding: 0 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.terminal-tabs::-webkit-scrollbar {
  display: none;
}
.terminal-tab {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: #c2c2c2;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
  white-space: nowrap;
  position: relative;
}
.terminal-tab.active {
  color: #80c4f1;
  border-bottom: 3px solid #80c4f1;
  background: rgba(37, 37, 38, 0.9);
}
.terminal-tab.loading {
  border-bottom-color: transparent;
  border-image: linear-gradient(to right, #80c4f1 var(--progress, 0%), transparent var(--progress, 0%)) 1;
}
.terminal-tab:hover:not(.active) {
  color: #d4d4d4;
  background: rgba(37, 37, 38, 0.5);
}
.tab-close {
  margin-left: 10px;
  color: #808080;
  font-size: 14px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}
.tab-close:hover {
  background: rgba(244, 71, 71, 0.2);
  color: #f44747;
}
.terminal-wrapper {
  flex: 1;
  padding: 15px;
  overflow: hidden;
  position: relative;
  overscroll-behavior: none;
  touch-action: pan-y;
}
.terminal {
  width: 100%;
  height: 100%;
  padding-bottom: 20px;
  box-sizing: border-box;
  border-radius: 6px;
  overflow: hidden;
}

.status-bar {
  background: rgba(37, 37, 38, 0.9);
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 14px;
  color: #808080;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.status-bar-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 15px;
}
.status-bar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

/* 移动端样式已移至 @media (max-width: 1200px) 浮动侧边栏方案 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(37, 37, 38, 0.5);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #5a5a5a;
}
.xterm {
  font-family: 'Consolas', 'Microsoft YaHei', 'PingFang SC', 'Monaco', 'monospace';
  font-size: 14px;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .xterm {
    font-family: 'Roboto Mono', 'Droid Sans Mono', 'Microsoft YaHei', 'PingFang SC', 'monospace';
    font-size: 13px;
  }
}

/* 离线设备样式（保留供内部使用） */

/* 设备操作小按钮（配置/OTA/上传/编辑名称） */
.btn-edit-config,
.btn-edit-name,
.btn-ota-upgrade,
.btn-ota-local,
.btn-telnet {
  background: none;
  border: none;
  color: #808080;
  cursor: pointer;
  padding: 4px;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-edit-config:hover,
.btn-ota-local:hover {
  background: rgba(0, 122, 204, 0.15);
  color: #80c4f1;
}

.btn-edit-name:hover {
  background: transparent;
  color: #569cd6;
}

.device-info .btn-edit-name {
  width: auto;
  height: auto;
  padding: 0 4px;
  font-size: 11px;
  margin-left: 2px;
}

.btn-ota-upgrade:hover {
  background: rgba(197, 134, 192, 0.15);
  color: #c586c0;
}

.btn-ota-upgrade.has-update {
  color: #4ec9b0 !important;
  animation: pulse-update 2s ease-in-out infinite;
}

@keyframes pulse-update {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.btn-telnet:hover {
  color: #569cd6;
  background: rgba(86, 156, 214, 0.15);
}

.file-list {
  background: rgba(30, 30, 30, 0.7);
}

/* 文件行/文件夹缩进 */
.device-file-item,
.file-category-tag {
  padding-left: 42px;
}

/* 文件行紧凑 */
.device-file-item {
  min-height: 32px;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 60px;
}

.no-files,
.file-list-loading {
  text-align: center;
  padding: 30px 20px;
  color: #c2c2c2;
  font-size: 14px;
}

/* 配置终端标签样式 */
.terminal-tab.config-tab {
  color: #c586c0;
}

.terminal-tab.config-tab.active {
  color: #c586c0;
  border-bottom-color: #c586c0;
}
.terminal-tab.config-tab.loading {
  border-image: linear-gradient(to right, #c586c0 var(--progress, 0%), transparent var(--progress, 0%)) 1;
}

/* 配置终端容器 */
.config-terminal .xterm {
  background-color: #1e1e1e;
}

.no-devices {
  text-align: center;
  padding: 40px 20px;
  color: #5a5a5a;
  font-size: 14px;
}

/* 配置编辑器样式 */
.config-editor {
  height: 100%;
  padding: 20px;
}

.config-editor h3 {
  color: #d4d4d4;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  height: calc(100% - 60px);
}

.config-textarea {
  flex: 1;
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(80, 80, 80, 0.5);
  border-radius: 6px;
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  padding: 12px;
  resize: vertical;
  min-height: 300px;
}

.config-textarea:focus {
  outline: none;
  border-color: #80c4f1;
  box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.config-actions {
  display: flex;
  gap: 10px;
  float: right;
}

.btn-send-config {
  padding: 8px 16px;
  background: #007acc;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-send-config:hover {
  background: #0098ff;
}

.btn-validate-config {
  padding: 8px 16px;
  background: #388888;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-validate-config:hover {
  background: #5dd4b5;
}

.btn-validate-config.canceling {
  background: #723939 !important;
}

.btn-validate-config.canceling:hover {
  background: #8c5358 !important;
}

.config-status {
  padding: 10px;
  border-radius: 4px;
  font-size: 14px;
  margin-top: 10px;
}

.config-status.success {
  background: rgba(16, 185, 129, 0.1);
  color: #4ec9b0;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.config-status.error {
  background: rgba(244, 71, 71, 0.1);
  color: #f44747;
  border: 1px solid rgba(244, 71, 71, 0.3);
}

/* ==================== 下载进度条样式 ==================== */
.download-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 30, 30, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}

.download-progress-card {
  background: linear-gradient(135deg, #252526 0%, #334155 100%);
  border-radius: 12px;
  padding: 24px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.download-progress-card.complete {
  border-color: #4ec9b0;
  background: linear-gradient(135deg, #252526 0%, #064e3b 100%);
}

.download-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.download-progress-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #d4d4d4;
  margin: 0;
}

.close-progress-btn {
  background: none;
  border: none;
  color: #808080;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-progress-btn:hover {
  background: rgba(244, 71, 71, 0.2);
  color: #f44747;
}

.download-progress-info {
  margin-bottom: 20px;
  font-size: 14px;
  color: #d4d4d4;
}

.download-progress-info div {
  margin-bottom: 6px;
}

.download-progress-info div:last-child {
  margin-bottom: 0;
}

.download-progress-bar-container {
  background: rgba(37, 37, 38, 0.8);
  border-radius: 8px;
  height: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.download-progress-bar {
  background: linear-gradient(90deg, #80c4f1 0%, #c586c0 100%);
  height: 100%;
  width: 0%;
  border-radius: 8px;
  transition: width 0.3s ease;
}

.download-progress-text {
  text-align: center;
  font-size: 14px;
  color: #808080;
  margin-bottom: 8px;
}

/* ==================== 登录对话框样式 ==================== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 30, 30, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(8px);
}

.login-dialog {
  background: linear-gradient(135deg, #252526 0%, #334155 100%);
  border-radius: 16px;
  padding: 36px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

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

.dialog-header h2 {
  margin: 0;
  color: #d4d4d4;
  font-size: 22px;
  font-weight: 600;
}

.dialog-header h2 i {
  color: #80c4f1;
  margin-right: 10px;
}

.dialog-close {
  background: none;
  border: none;
  color: #808080;
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.dialog-close:hover {
  color: #d4d4d4;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  color: #808080;
  font-weight: 600;
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  line-height: 1;
}

.password-toggle:hover {
  color: #d4d4d4;
}

.login-field input {
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(80, 80, 80, 0.5);
  border-radius: 8px;
  color: #d4d4d4;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s;
}

.login-field input:focus {
  outline: none;
  border-color: #80c4f1;
  box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.2);
}

.login-field input::placeholder {
  color: #5a5a5a;
}

.login-error {
  background: rgba(244, 71, 71, 0.1);
  color: #f44747;
  border: 1px solid rgba(244, 71, 71, 0.3);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: #007acc;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-login:hover {
  background: #0098ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.4);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-primary {
  background: #007acc;
}

.login-actions {
  display: flex;
  gap: 10px;
}

.login-actions .btn-login {
  flex: 1;
}

.login-actions .btn-login:not(.btn-primary) {
  background: #475569;
}

.login-actions .btn-login:not(.btn-primary):hover {
  background: #5a6a7e;
}

/* ==================== Telnet 样式 ==================== */

.terminal-tab.telnet-tab.active {
  color: #569cd6;
  border-bottom-color: #569cd6;
}

.terminal-tab.telnet-tab:hover:not(.active) {
  color: #569cd6;
}

/* Telnet/UART 断开连接状态 */
.terminal-tab.disconnected {
  opacity: 0.5;
  border-left-color: #6a3a3a !important;
}

.terminal-tab.disconnected.active {
  color: #e06060;
  border-bottom-color: #e06060;
}

.terminal-tab.disconnected:hover:not(.active) {
  color: #e06060;
}

.terminal-wrapper .terminal.disconnected-terminal {
  position: relative;
}

.terminal-wrapper .terminal.disconnected-terminal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(30, 20, 20, 0.15);
  pointer-events: none;
  z-index: 1;
}

/* 组标题（全部设备视图） */
.device-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  margin: 4px 0;
  transition: background 0.2s;
  background: rgba(37, 37, 38, 0.6);
  border: 1px solid rgba(80, 80, 80, 0.4);
  min-height: 48px;
}

.device-group-header:hover {
  background: rgba(60, 60, 60, 0.5);
}

.device-group-header .group-toggle {
  color: #808080;
  font-size: 11px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.device-group-header.open .group-toggle {
  transform: rotate(90deg);
}

.device-group-header .group-icon {
  color: #80c4f1;
  font-size: 13px;
  flex-shrink: 0;
}

.device-group-header .group-name {
  font-weight: 600;
  font-size: 14px;
  color: #d4d4d4;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-group-header .group-count {
  font-size: 11px;
  color: #858585;
  flex-shrink: 0;
  padding: 1px 6px;
  background: rgba(100, 100, 100, 0.2);
  border-radius: 3px;
}

.device-group-body {
  padding-left: 8px;
}

/* ==================== 右侧快捷命令面板样式 ==================== */
.right-panel {
  display: flex;
  flex-direction: column;
  width: 250px;
  max-width: 400px;
  background: rgba(37, 37, 38, 0.9);
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  flex-shrink: 0;
}

/* 快捷命令树样式 */
#qc-tree-container {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

.qc-tree {
  list-style: none;
}

/* 快捷命令按钮样式 */
.qc-hidden {
  display: none !important;
}

.qc-btn-send {
  background: transparent;
  border: none;
  color: #80c4f1;
  cursor: pointer;
  font-size: 11px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: background 0.2s;
  margin-left: auto;
  flex-shrink: 0;
}

.qc-btn-send:hover {
  color: #0098ff;
}

.qc-btn-delete {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qc-btn-delete:hover {
  color: #f44747;
  background: rgba(244, 71, 71, 0.1);
}

.qc-btn-edit {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qc-btn-edit:hover {
  color: #80c4f1;
  background: rgba(128, 196, 241, 0.1);
}

.qc-btn-send {
  user-select: none;
}

.qc-btn-add {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qc-btn-add:hover {
  color: #80c4f1;
  background: rgba(0, 122, 204, 0.15);
}

/* 命令行编辑框 */
.qc-cmd-editor {
  display: none;
  padding: 8px;
}

.qc-cmd.open .qc-cmd-editor {
  display: block;
}

.qc-cmd-editor textarea {
  width: 100%;
  min-height: 60px;
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(80, 80, 80, 0.5);
  border-radius: 4px;
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  padding: 8px;
  resize: vertical;
}

.qc-cmd-editor textarea:focus {
  outline: none;
  border-color: #80c4f1;
}

/* 名称编辑框 */
.qc-group-name-input,
.qc-cmd-name-input {
  background: rgba(30, 30, 30, 0.9);
  border: 1px solid #5b798c;
  border-radius: 3px;
  color: #d4d4d4;
  font-size: 12px;
  padding: 2px 6px;
  flex: 1;
  min-width: 0;
}

/* 分组样式 */
.qc-group {
  margin-bottom: 2px;
}

.qc-group-header {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
  gap: 6px;
  user-select: none;
}

.qc-group-header:hover {
  background: rgba(60, 60, 60, 0.4);
}

.qc-group-toggle {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #808080;
  font-size: 10px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.qc-group.open .qc-group-toggle {
  transform: rotate(90deg);
}

.qc-group-name {
  font-size: 13px;
  color: #c2c2c2;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.qc-group-actions {
  display: flex;
  gap: 4px;
}

.qc-group-body {
  padding-left: 16px;
}

.qc-group.open > .qc-group-body {
  display: block;
}

.qc-group:not(.open) > .qc-group-body {
  display: none;
}

/* 命令样式 */
.qc-cmd {
  margin-bottom: 2px;
}

.qc-cmd-row {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
  gap: 6px;
}

.qc-cmd-row:hover {
  background: rgba(60, 60, 60, 0.4);
}

.qc-cmd-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #80c4f1;
  font-size: 10px;
  flex-shrink: 0;
}

.qc-cmd-name {
  font-size: 12px;
  color: #a0a0a0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.qc-cmd-actions {
  display: flex;
  gap: 4px;
}

.qc-group-name-input:focus,
.qc-cmd-name-input:focus {
  outline: none;
}

/* ========== 移动端浮动侧边栏优化 (≤1200px) ========== */
@media (max-width: 1200px) {
  /* 汉堡菜单按钮 */
  .mobile-menu-btn {
    display: flex !important;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(80, 80, 80, 0.5);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  }
  .mobile-menu-btn:active {
    transform: scale(0.92);
    background: rgba(50, 50, 50, 0.95);
  }

  /* 命令按钮 */
  .mobile-cmd-btn {
    display: flex !important;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(80, 80, 80, 0.5);
    border-radius: 10px;
    color: #80c4f1;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  }
  .mobile-cmd-btn:active {
    transform: scale(0.92);
    background: rgba(50, 50, 50, 0.95);
  }

  /* 遮罩层 */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: opacity 0.3s;
  }
  .sidebar-overlay.active {
    display: block;
  }

  /* 左侧浮动面板（设备列表） */
  .left-panel {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 300px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 !important;
    background: #1e1e1e !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
  }
  .left-panel.active {
    transform: translateX(0);
  }
  .left-panel .panel-header {
    padding: 16px;
    border-bottom: 1px solid rgba(80, 80, 80, 0.3);
  }
  .left-panel .panel-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* 右侧浮动面板（快捷命令） */
  .right-panel {
    position: fixed !important;
    top: 0;
    right: 0;
    width: 280px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 !important;
    background: #1e1e1e !important;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
  }
  .right-panel.active {
    transform: translateX(0);
  }

  /* 右侧面板打开时隐藏命令按钮 */
  .cmd-btn-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.8) !important;
  }

  .right-panel .panel-header {
    padding: 16px;
    border-bottom: 1px solid rgba(80, 80, 80, 0.3);
  }
  .right-panel .panel-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* 主内容区 */
  .main-content {
    flex-direction: column;
    width: 100%;
    min-height: 0;
    gap: 0;
  }

  /* 容器占满屏幕 */
  .container {
    padding: 0;
    gap: 0;
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
  }

  /* 主内容区占满 */
  .main-content {
    flex: 1;
    min-height: 0;
  }

  /* 终端容器占满 */
  .terminal-container {
    width: 100% !important;
    flex: 1;
    min-height: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    padding: 0 8px;
  }

  /* 终端wrapper占满 */
  .terminal-wrapper {
    flex: 1;
    min-height: 0;
    padding: 4px 0;
  }

  /* 终端占满 */
  .terminal {
    border-radius: 0;
    height: 100%;
  }

  /* 隐藏拖拽手柄 */
  .resize-handle,
  .resize-handle-right {
    display: none !important;
  }

  /* Header 调整：为汉堡菜单留出空间 */
  .header {
    padding-left: 60px;
    padding-right: 60px;
    justify-content: center;
  }

  /* 隐藏header文字和logo，仅保留图标按钮 */
  .logo {
    display: none;
  }
  .header-controls {
    margin: 0 auto;
  }
  .btn-header {
    font-size: 0;
    padding: 8px 12px;
  }
  .btn-header i {
    font-size: 14px;
    margin: 0;
  }

  /* 终端标签栏优化 */
  .terminal-tabs {
    padding: 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .terminal-tabs::-webkit-scrollbar {
    display: none;
  }
  .terminal-tab {
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ========== 滚动优化 ========== */
.terminal-wrapper {
  overscroll-behavior: none;
}

/* ========== 横屏适配 ========== */
@media (max-width: 1200px) and (orientation: landscape) {
  .mobile-menu-btn {
    top: 8px;
    left: 8px;
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .mobile-cmd-btn {
    top: 8px;
    right: 8px;
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .header {
    padding-left: 52px;
    padding-right: 52px;
  }
  .left-panel {
    width: 260px !important;
  }
  .right-panel {
    width: 240px !important;
  }
}

/* ========== 底部备案号 ========== */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 8px 0;
  background: rgba(30, 30, 30, 0.95);
  border-top: 1px solid rgba(80, 80, 80, 0.3);
  z-index: 100;
}

/* footer 可见时预留底部空间，防止终端被遮挡 */
.container.has-visible-footer {
  padding-bottom: 33px;
}

.site-footer a {
  color: #808080;
  text-decoration: none;
  font-size: 12px;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: #80c4f1;
}

/* ========== Panel toggle button (all screen sizes) ========== */
.panel-toggle {
  background: none;
  border: none;
  color: #808080;
  cursor: pointer;
  padding: 2px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.panel-toggle:hover {
  color: #d4d4d4;
  background: rgba(128, 128, 128, 0.15);
}

/* ========== Desktop collapse states (≥1201px) ========== */
@media (min-width: 1201px) {
  .left-panel.collapsed,
  .right-panel.collapsed {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    overflow: hidden;
  }

  .left-panel.collapsed .panel-content,
  .left-panel.collapsed .panel-header-title,
  .left-panel.collapsed .panel-header-actions,
  .left-panel.collapsed .panel-header > i {
    display: none;
  }

  .right-panel.collapsed .panel-content,
  .right-panel.collapsed .panel-header-title,
  .right-panel.collapsed .panel-header-actions,
  .right-panel.collapsed .panel-header > i {
    display: none;
  }

  .left-panel.collapsed .panel-header,
  .right-panel.collapsed .panel-header {
    padding: 14px 0;
    justify-content: center;
  }

  .left-panel.collapsed .panel-toggle,
  .right-panel.collapsed .panel-toggle {
    width: 100%;
    height: auto;
    padding: 8px 0;
    border-radius: 0;
  }
}
