*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #21262d;
  --bg-card-hover: #292e36;
  --border-color: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-glow: rgba(88, 166, 255, 0.3);
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
  --sidebar-width: 260px;
  --body-bg: #0d1117;
  --bg-blur: rgba(0,0,0,0.35);
  --window-text: #e6edf3;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f2f2f2;
  --bg-card: #e0e0e0;
  --bg-card-hover: #d4d4d4;
  --border-color: #c0c0c0;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --accent: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.3);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  --body-bg: #f5f5f5;
  --bg-blur: rgba(255,255,255,0.55);
  --window-text: #1a1a1a;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--body-bg);
  background-size: cover;
  background-position: center;
  color: var(--text-primary);
  height: 100%;
  line-height: 1.5;
}

.app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(13, 17, 23, 0.85);
  position: relative;
  border-right: none;
  overflow: hidden;
}

.sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--sidebar-wallpaper, none) left center / cover fixed;
  filter: blur(var(--sidebar-blur, 10px));
  opacity: var(--sidebar-opacity, 0.5);
  pointer-events: none;
}

.sidebar-header {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px 12px;
  position: relative;
  z-index: 1;
}

.logo {
  height: 40px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

/* Sidebar system status */
.sidebar-status {
  flex-shrink: 0;
  padding: 0 12px 8px;
  position: relative;
  z-index: 1;
}

.status-clock {
  text-align: center;
  padding: 8px 0;
  line-height: 1.2;
}
.status-date {
  font-size: 13px;
  color: var(--text-secondary);
  display: block;
}
.status-time {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  letter-spacing: 0.5px;
}

.status-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-status .status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}

.sidebar-status .si-label {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
}

.sidebar-status .sv {
  font-size: 13px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
}

.sidebar-search {
  flex-shrink: 0;
  padding: 0 12px 12px;
  position: relative;
  z-index: 1;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 9px 32px 9px 12px;
  background: rgba(33, 38, 45, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  user-select: none;
}

.search-clear:hover {
  color: var(--text-primary);
}

.sidebar-nav-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 12px;
  position: relative;
  z-index: 1;
}

.sidebar-nav-wrap::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav-wrap::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.nav-groups {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group {
  border-radius: var(--radius);
  overflow: hidden;
}

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

.group-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.collapse-icon {
  font-size: 10px;
  color: var(--text-secondary);
  transition: transform 0.2s;
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}

.group.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.group-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.group-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 4px;
}

.group.collapsed .group-items {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: rgba(88, 166, 255, 0.12);
  border-color: rgba(88, 166, 255, 0.25);
  color: var(--accent);
}

.nav-item.hidden {
  display: none;
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-item-fallback {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.nav-item-name {
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-results {
  display: none;
  text-align: center;
  padding: 20px 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.no-results.show {
  display: block;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: none;
  position: relative;
  z-index: 1;
}

.footer-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.footer-actions button {
  flex: 1;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.main-area::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: inherit;
  filter: blur(var(--main-blur, 0px));
  pointer-events: none;
}

.iframe-view {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  background: rgba(13, 17, 23, 0.85);
  color: var(--window-text);
}

.iframe-view::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--sidebar-wallpaper, none) left center / cover fixed;
  filter: blur(var(--sidebar-blur, 10px));
  opacity: var(--sidebar-opacity, 0.5);
  pointer-events: none;
}

.iframe-view.on-top {
  z-index: 20;
}

.tabs-bar {
  display: flex;
  align-items: center;
  height: 36px;
  background: rgba(13, 17, 23, 0.5);
  backdrop-filter: blur(var(--sidebar-blur, 10px));
  -webkit-backdrop-filter: blur(var(--sidebar-blur, 10px));
  border-bottom: none;
  flex-shrink: 0;
}

.tabs-list {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  display: flex;
  scrollbar-width: none;
}

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

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-right: 1px solid rgba(48, 54, 61, 0.3);
  cursor: pointer;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: 0.15s;
  flex-shrink: 0;
}

.tab-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tab-btn .tab-icon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
  object-fit: contain;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

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

.tab-btn .tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-btn .tab-close {
  font-size: 14px;
  line-height: 1;
  opacity: 0.5;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab-btn .tab-close svg { display: block; }

.tab-btn .tab-close:hover {
  opacity: 1;
  background: rgba(248, 81, 73, 0.2);
  color: #f85149;
}

.tab-contents {
  flex: 1;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.tab-content {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

.tab-content iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
}

.tab-type-browser {
  border-bottom: 2px solid #3fb950;
}
.tab-type-browser:nth-child(5n+1) { border-bottom-color: #58a6ff; }
.tab-type-browser:nth-child(5n+2) { border-bottom-color: #3fb950; }
.tab-type-browser:nth-child(5n+3) { border-bottom-color: #d2a8ff; }
.tab-type-browser:nth-child(5n+4) { border-bottom-color: #f0c040; }
.tab-type-browser:nth-child(5n+5) { border-bottom-color: #f778ba; }
.tab-type-file {
  border-bottom: 2px solid #f778ba;
}

.iframe-close-all-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
  margin-left: 4px;
  transition: var(--transition);
}

.iframe-close-all-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.iframe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
  background: rgba(13, 17, 23, 0.7);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.context-menu {
  position: fixed;
  z-index: 999999;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 140px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

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

.context-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.context-menu-item.danger {
  color: #f85149;
}

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

.group.hidden {
  display: none;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-overlay .page-footer {
  position: static;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  z-index: auto;
  width: auto;
  padding: 4px 0;
  flex-shrink: 0;
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  background: rgba(22, 27, 34, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 50px 60px;
  border: 1px solid rgba(48, 54, 61, 0.4);
  box-shadow: var(--shadow);
}

.login-logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

.login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.login-input {
  width: 280px;
  padding: 10px 16px;
  background: rgba(33, 38, 45, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.login-error {
  font-size: 13px;
  color: #f85149;
}

.login-btn {
  width: 280px;
  padding: 10px 0;
  background: var(--accent);
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 2px;
}

.login-btn:hover {
  box-shadow: 0 0 16px var(--accent-glow);
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.remember-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.logout-btn {
  padding: 6px 0;
  background: transparent;
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-radius: 8px;
  color: #f85149;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn:hover {
  background: rgba(248, 81, 73, 0.1);
  border-color: #f85149;
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.page-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  padding: 5px 0;
  text-align: center;
  font-size: 11px;
  background: rgba(13, 17, 23, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(48, 54, 61, 0.3);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  flex-wrap: wrap;
  user-select: none;
}

.page-footer .sep {
  color: rgba(139, 148, 158, 0.25);
  font-size: 10px;
}

.page-footer a {
  color: rgba(139, 148, 158, 0.5);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

.page-footer a:hover {
  color: rgba(139, 148, 158, 0.85);
}

.page-footer img {
  vertical-align: middle;
  width: 14px;
  height: 16px;
  opacity: 0.4;
  margin-right: 2px;
}

/* Settings Modal */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.settings-panel {
  position: relative;
  width: 560px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.settings-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
}

.settings-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.settings-section {
  margin-bottom: 20px;
}

.settings-section h4 {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.settings-row label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 70px;
  flex-shrink: 0;
}

.settings-row input,
.settings-row select {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.settings-row input:focus,
.settings-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.group-edit-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.group-edit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.group-edit-header input {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--text-primary);
  outline: none;
}

.group-edit-header input:focus {
  border-color: var(--border-color);
  background: var(--bg-card);
}

.item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  padding: 4px 0;
}

.item-move-btns {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}
.item-move-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 9px;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.item-move-btn svg { display: block; }
.item-move-btn:hover {
  border-color: var(--border-color);
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}
.group-move-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  padding: 3px 2px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.group-move-btn svg { display: block; }
.group-move-btn:hover {
  border-color: var(--border-color);
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.item-row input {
  flex: 1;
  font-size: 11px;
  min-width: 0;
  background: rgba(0,0,0,0.2);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 6px;
  color: var(--text-primary);
  outline: none;
}

.item-row input:focus {
  border-color: var(--border-color);
}

.item-row select {
  width: 80px;
  flex-shrink: 0;
  font-size: 11px;
  background: rgba(0,0,0,0.2);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 4px;
  color: var(--text-primary);
  outline: none;
}

.item-row select:focus {
  border-color: var(--border-color);
}

.item-delete-btn,
.group-delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.item-delete-btn:hover,
.group-delete-btn:hover {
  color: #f85149;
  background: rgba(248,81,73,0.1);
}

.add-item-btn {
  background: none;
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  margin-top: 4px;
}

.add-item-btn:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
}

.add-group-btn {
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  font-size: 12px;
}

.add-group-btn:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  gap: 8px;
}

.settings-save-btn {
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
}

.settings-save-btn:hover {
  opacity: 0.9;
}

.settings-reset-btn {
  padding: 10px 24px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
}

.settings-reset-btn:hover {
  opacity: 0.9;
  background: rgba(255,255,255,0.03);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 99999;
  animation: toastIn 0.3s;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== 桌面系统（v9：窗口 + 任务栏 + 桌面图标） ===== */
.desktop {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.desktop::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--sidebar-wallpaper, none) center / cover;
  filter: blur(var(--main-blur, 0px));
  pointer-events: none;
}

.desktop-icons {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 0;
  bottom: 0;
  overflow: visible;
  z-index: 1;
}

.desktop-icon {
  position: absolute;
  width: 108px;
  height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--text-primary);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  transition: var(--transition);
  box-sizing: border-box;
}
.desktop-icon:hover { background: rgba(255, 255, 255, 0.1); }
.desktop-icon:active { background: rgba(88, 166, 255, 0.2); }
.desktop-icon.dragging { opacity: 0.35; }
.desktop-icon.drag-hover { background: rgba(88, 166, 255, 0.25); }
.desktop-icon.selected { background: rgba(88, 166, 255, 0.2); box-shadow: 0 0 0 1px var(--accent) inset; }
.desktop-icon.home-icon:hover { background: rgba(88, 166, 255, 0.15); }
.desktop-icon .di-icon { font-size: 48px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); pointer-events: none; display: flex; align-items: center; justify-content: center; }
.desktop-icon .di-icon svg { display: block; }
.desktop-icon .di-name {
  font-size: 11px;
  text-align: center;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.desktop-icon-clone {
  position: fixed;
  z-index: 999999;
  pointer-events: none;
  opacity: 0.85;
  width: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.9);
  border: 1px solid rgba(88, 166, 255, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
}
.desktop-icon-clone .di-icon { font-size: 48px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.desktop-icon-clone .di-icon svg { display: block; }
.desktop-icon-clone .di-name {
  font-size: 11px;
  text-align: center;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 窗口层 */
.windows-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 10;
}
.windows-layer > .win { pointer-events: auto; }

/* 窗口 */
.win {
  position: absolute;
  min-width: 320px;
  min-height: 200px;
  background: rgba(22, 27, 34, 0.94);
  border: 1px solid rgba(48, 54, 61, 0.8);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.win.focused {
  border-color: rgba(88, 166, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(88, 166, 255, 0.15);
}
.win.maximized {
  border-radius: 0;
  border: none;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
.win.minimized { display: none; }

.win-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 6px 0 12px;
  background: rgba(13, 17, 23, 0.85);
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
}
.win-titlebar:active { cursor: grabbing; }
.win-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.win-title img {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  object-fit: contain;
  flex-shrink: 0;
}

.win-controls { display: flex; gap: 2px; flex-shrink: 0; }
.win-btn {
  width: 32px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
}
.win-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); }
.win-btn.win-close:hover { background: #f85149; color: #fff; }

.win-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 窗口调整大小手柄 */
.win-resize {
  position: absolute;
  z-index: 60;
}
.win-resize-n { top: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.win-resize-s { bottom: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.win-resize-e { right: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.win-resize-w { left: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.win-resize-ne { top: -4px; right: -4px; width: 12px; height: 12px; cursor: nesw-resize; }
.win-resize-nw { top: -4px; left: -4px; width: 12px; height: 12px; cursor: nwse-resize; }
.win-resize-se { bottom: -4px; right: -4px; width: 12px; height: 12px; cursor: nwse-resize; }
.win-resize-sw { bottom: -4px; left: -4px; width: 12px; height: 12px; cursor: nesw-resize; }

/* 任务栏 */
.taskbar {
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(48, 54, 61, 0.4);
  position: relative;
  z-index: 100;
}
.taskbar-btns {
  display: flex;
  gap: 4px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.taskbar-btns::-webkit-scrollbar { display: none; }
.taskbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
  position: relative;
}
.taskbar-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.taskbar-btn.active { background: rgba(88, 166, 255, 0.15); color: var(--text-primary); }
.taskbar-btn.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.taskbar-btn img {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  object-fit: contain;
  flex-shrink: 0;
}
.taskbar-clock {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  padding: 0 6px;
}

/* 文件夹应用 */
.folder-view { display: flex; flex-direction: column; height: 100%; }
.folder-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
  background: rgba(13, 17, 23, 0.5);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.folder-path {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: text;
  min-width: 80px;
}
.folder-path:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.folder-path.editing {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  outline: none;
  cursor: text;
  white-space: nowrap;
  overflow-x: auto;
}
.folder-search {
  flex: 1;
  min-width: 100px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(48, 54, 61, 0.6);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 4px 8px;
  outline: none;
}
.folder-search:focus { border-color: var(--accent); }
.folder-search::placeholder { color: var(--text-secondary); }
.folder-toolbar-row2 {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.folder-btn {
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.folder-btn svg { display: block; }
.folder-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); }
.folder-btn:disabled { opacity: 0.35; cursor: default; }

.folder-grid {
  position: relative; /* rubber-band 定位基准 */
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 4px;
  align-content: start;
}
.folder-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: var(--transition);
}
.folder-item:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(48, 54, 61, 0.6); }
.folder-item.selected {
  background: rgba(88, 166, 255, 0.18);
  border-color: var(--accent);
}
.folder-item .fi-icon { font-size: 32px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.folder-item .fi-icon svg { display: block; }
.folder-item .fi-name {
  font-size: 11px;
  text-align: center;
  color: var(--text-primary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 40px 0;
}
.folder-dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
  background: rgba(88, 166, 255, 0.06);
}

/* 列表视图 */
.folder-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 8px;
}
.folder-item-list {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  border-bottom: 1px solid rgba(48, 54, 61, 0.25);
}
.folder-item-list:last-child { border-bottom: none; }
.folder-item-list .fi-icon { font-size: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.folder-item-list .fi-icon svg { display: block; }
.folder-item-list .fi-name {
  flex: 1;
  text-align: left;
  font-size: 12px;
  max-width: none;
}
.folder-item-list .fi-type {
  font-size: 10px;
  color: var(--text-secondary);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 8px;
  border-radius: 8px;
}

/* 拖拽框选 */
.rubber-band {
  position: absolute;
  z-index: 999;
  background: rgba(88, 166, 255, 0.12);
  border: 1px solid var(--accent);
  border-radius: 2px;
  pointer-events: none;
}

/* 记事本 */
.notepad-view { display: flex; flex-direction: column; height: 100%; }
.notepad-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
  background: rgba(13, 17, 23, 0.5);
  flex-shrink: 0;
}
.notepad-toolbar .np-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-secondary);
}
.np-font-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-right: 4px;
}
.np-font-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}
.np-font-btn:hover {
  border-color: var(--border-color);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}
.np-font-val {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.notepad-save {
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.notepad-save:hover { opacity: 0.9; }
.notepad-save:disabled { opacity: 0.45; cursor: default; }
.notepad-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-primary);
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
}
.notepad-preview {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  display: none;
}
.notepad-preview.show { display: block; }
.notepad-preview h1, .notepad-preview h2, .notepad-preview h3 {
  margin: 12px 0 8px;
  line-height: 1.3;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}
.notepad-preview h1 { font-size: 20px; }
.notepad-preview h2 { font-size: 17px; }
.notepad-preview h3 { font-size: 15px; }
.notepad-preview p { margin: 6px 0; }
.notepad-preview code {
  background: rgba(88, 166, 255, 0.12);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
}
.notepad-preview pre {
  background: rgba(13, 17, 23, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.notepad-preview pre code { background: none; padding: 0; }
.notepad-preview ul, .notepad-preview ol { padding-left: 22px; margin: 6px 0; }
.notepad-preview blockquote {
  border-left: 3px solid var(--accent);
  margin: 8px 0;
  padding: 2px 12px;
  color: var(--text-secondary);
  background: rgba(88, 166, 255, 0.05);
}
.notepad-preview a { color: var(--accent); text-decoration: none; }
.notepad-preview table { border-collapse: collapse; margin: 8px 0; }
.notepad-preview th, .notepad-preview td {
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  font-size: 12px;
}
.notepad-preview th { background: rgba(255, 255, 255, 0.06); }
.notepad-mode-btn {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.notepad-mode-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--text-primary); }
.notepad-mode-btn.active { background: var(--accent); color: #fff; }

/* 文件夹内右键菜单子项图标 */
.context-menu-item .cm-icon {
  width: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.context-menu-item .cm-icon svg { display: block; }

/* ===== 手机端：纯侧边栏模式 ===== */
/* 仅按 UA 检测（html.ua-mobile）：手机 UA 强制手机版，无视窗口宽度；桌面 UA 始终桌面版 */
html.ua-mobile, html.ua-mobile body {

    background: #0d1117 !important;
    background-image: none !important;
  
}html.ua-mobile .app {

    display: block;
  
}html.ua-mobile /* 隐藏壁纸和右侧区域 */
  .main-area, html.ua-mobile .main-area::before, html.ua-mobile .main-area::after, html.ua-mobile .desktop, html.ua-mobile .desktop::before, html.ua-mobile .windows-layer, html.ua-mobile .taskbar, html.ua-mobile .iframe-view, html.ua-mobile .browser-view, html.ua-mobile .file-view {

    display: none !important;
  
}html.ua-mobile /* sidebar 全屏铺满（用 bottom:0 而非 100vh，避开手机浏览器地址栏问题） */
  .sidebar {

    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0d1117;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-right: none;
  
}html.ua-mobile /* 去掉 sidebar 的壁纸伪元素（没壁纸了，保留纯色背景） */
  .sidebar::after {

    display: none;
  
}html.ua-mobile /* 页脚现在属于全屏 sidebar，居中显示 */
  .page-footer {

    position: static;
    left: auto;
    right: auto;
    width: 100%;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
    z-index: 1;
    padding: 6px 0;
  
}html.ua-mobile /* 导航区域撑满剩余空间 */
  .sidebar-nav-wrap {

    max-height: none;
  
}html.ua-mobile /* logo 稍大一点 */
  .logo {

    height: 36px;
  
}html.ua-mobile .sidebar-header {

    padding: 24px 16px 12px;
  
}html.ua-mobile /* 导航项触控区域加大 */
  .nav-item {

    padding: 10px 12px;
  
}html.ua-mobile .group-header {

    padding: 10px 12px;
  
}html.ua-mobile /* 登录界面手机适配 */
  .login-card {

    padding: 36px 32px;
    border-radius: 20px;
  
}html.ua-mobile .login-input {

    width: 240px;
  
}html.ua-mobile .login-btn {

    width: 240px;
  
}html.ua-mobile /* 手机端：隐藏日期时间和设置，只留退出登录 */
  .status-clock, html.ua-mobile .sidebar-clock {

    display: none !important;
  
}html.ua-mobile /* 极度压缩 header 间距 */
  .sidebar-header {

    padding: 10px 16px 6px !important;
  
}html.ua-mobile .logo {

    height: 28px !important;
  
}html.ua-mobile /* 压缩系统状态区 */
  .sidebar-status {

    padding: 0 12px 4px !important;
  
}html.ua-mobile .status-grid {

    gap: 1px !important;
  
}html.ua-mobile .sidebar-status .status-item {

    font-size: 11px !important;
  
}html.ua-mobile .sidebar-status .si-label, html.ua-mobile .sidebar-status .sv {

    font-size: 11px !important;
  
}html.ua-mobile /* 压缩搜索区 */
  .sidebar-search {

    padding: 0 12px 6px !important;
  
}html.ua-mobile .search-box input {

    padding: 6px 32px 6px 10px !important;
    font-size: 12px !important;
  
}html.ua-mobile /* 导航区：限制最小高度，也能滚动 */
  .sidebar-nav-wrap {

    flex: 1 1 auto !important;
    min-height: 60px !important;
    max-height: none !important;
  
}html.ua-mobile .nav-item {

    padding: 8px 12px !important;
  
}html.ua-mobile .group-header {

    padding: 7px 10px !important;
  
}html.ua-mobile /* footer 固定最小高度，退出登录按钮醒目 */
  .sidebar-footer {

    flex-shrink: 0 !important;
    padding: 4px 12px 8px !important;
  
}html.ua-mobile .footer-actions {

    margin-bottom: 0 !important;
  
}html.ua-mobile .logout-btn {

    display: block !important;
    padding: 8px 0 !important;
    text-align: center;
    width: 100%;
    border-radius: 6px;
  
}html.ua-mobile .settings-btn {

    display: none !important;
  
}html.ua-mobile /* 备案 footer 缩小 */
  .sidebar-footer + .page-footer, html.ua-mobile .app .page-footer {

    padding: 4px 0 !important;
    font-size: 10px !important;
  
}html.ua-mobile /* 设置面板手机适配 */
  .settings-panel {

    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  
}
