.shell {
  display: flex;
  width: 100%;
  height: 100%;
  background: var(--shell-surface);
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
/* 自定义背景层：垫底铺满，不拦截交互 */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
/* 激活自定义背景时界面底色透出背景层 */
.shell.has-bg {
  background: var(--shell-surface);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .shell {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
  }
}

/* ---------------- 左侧边栏 ---------------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  border-right: 1px solid var(--border);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 104px;
  padding: 0 17px;
  flex-shrink: 0;
}
.brand-head {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  image-rendering: pixelated;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.26);
  box-shadow: 0 3px 12px rgba(0,0,0,.18);
}
.logo-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.logo-name {
  font-family: 'Segoe UI Variable Display', 'Segoe UI', sans-serif;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 2px;
  line-height: 1.2;
  color: var(--text);
}
.logo-version {
  align-self: flex-end;
  padding-right: 2px;
  font-size: 9px;
  color: var(--accent-2);
  opacity: 0.85;
}

.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px 12px 12px;
  overflow-y: auto;
  position: relative;
}
/* 水滴高亮块：随指针在导航项间弹性滑动并拉伸形变 */
.nav-blob {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 15%, var(--card-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 9%, transparent);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.42s cubic-bezier(0.3, 1.5, 0.4, 1),
    height 0.42s cubic-bezier(0.3, 1.5, 0.4, 1),
    opacity 0.16s ease;
  will-change: transform;
}
.nav-blob.on {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .nav-blob { transition: none; }
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 15px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.16s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.nav-item:hover {
  color: var(--text);
}
.nav-item.active {
  color: color-mix(in srgb, var(--text) 84%, var(--accent));
}
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.nav-icon svg {
  width: 19px;
  height: 19px;
  display: block;
}
.nav-label {
  font-weight: 500;
}
.nav-item.active .nav-label {
  font-weight: 600;
}

/* 资源管理子级菜单 */
.nav-parent .nav-caret {
  width: 14px;
  height: 14px;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.18s ease;
  opacity: 0.7;
}
.nav-parent .nav-caret.open {
  transform: rotate(90deg);
}
.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px;
}
.nav-sub-item {
  height: 38px;
  padding-left: 30px;
  font-size: 13.5px;
  position: relative;
}
.nav-sub-item::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  transform: translateY(-50%);
}
.nav-sub-item.active::before {
  opacity: 1;
}
.nav-sub-item .nav-icon {
  width: 17px;
  height: 17px;
}
.nav-sub-item .nav-icon svg {
  width: 16px;
  height: 16px;
}

.sidebar-health {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  margin: 12px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 48%, transparent);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  -webkit-app-region: no-drag;
}
.sidebar-health:hover {
  background: var(--card-2);
  color: var(--text);
}
.sidebar-health i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}
.sidebar-health.is-busy i {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.sidebar-health.is-error i {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.sidebar-health span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-health svg {
  width: 14px;
  height: 14px;
}

/* ---------------- 右侧区域 ---------------- */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 顶部栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 78px;
  flex-shrink: 0;
  padding: 0 14px 0 22px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 78%, transparent);
  -webkit-app-region: drag;
}

.top-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 8px;
  background: var(--card-2);
  color: var(--text-dim);
  cursor: pointer;
  -webkit-app-region: no-drag;
}
.top-back:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
}
.top-back:disabled {
  opacity: 0.62;
  cursor: default;
}
.top-back svg {
  width: 16px;
  height: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 400px;
  max-width: 46%;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  -webkit-app-region: no-drag;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.search-input::placeholder {
  color: var(--text-dim);
  opacity: 0.75;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  -webkit-app-region: no-drag;
}
.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.top-btn:hover {
  background: var(--card-2);
  color: var(--accent-2);
}
.top-btn svg {
  width: 15px;
  height: 15px;
}

.top-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.top-icon-btn:hover {
  background: var(--card-2);
  color: var(--text);
}
.top-icon-btn svg {
  width: 17px;
  height: 17px;
}
.bell-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--bg-2);
}
.dl-badge.compact {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 14px;
  height: 14px;
  font-size: 9px;
}

/* 通知中心面板（Teleport 到 body，fixed 定位） */
.notice-mask {
  position: fixed;
  inset: 0;
  z-index: 9000;
}
.notes-panel {
  width: 380px;
  max-height: 480px;
}
.notes-list {
  overflow-y: auto;
  padding: 2px 14px 14px;
}
.note-version + .note-version {
  margin-top: 12px;
  border-top: 1px dashed var(--border, rgba(255, 255, 255, 0.12));
  padding-top: 12px;
}
.note-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 6px;
}
.note-ver {
  font-weight: 700;
  font-size: 13px;
}
.note-changes {
  margin: 0;
  padding-left: 16px;
  line-height: 1.7;
  font-size: 12.5px;
  color: var(--text, #dfe5ec);
}
.notice-panel {
  position: fixed;
  top: 82px;
  right: 92px;
  width: 320px;
  max-height: 420px;
  z-index: 9001;
  display: flex;
  flex-direction: column;
  background: var(--card-solid, #202830);
  background: color-mix(in srgb, var(--card-solid, #202830) 94%, transparent);
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  -webkit-app-region: no-drag;
  isolation: isolate;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-width: calc(100vw - 32px);
}
.notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.notice-title {
  font-size: 14px;
  font-weight: 700;
}
.notice-empty {
  padding: 36px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}
.notice-list {
  overflow-y: auto;
}
/* 下载中心 */
.dl-toggle {
  position: relative;
}
.dl-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dl-panel {
  width: 380px;
}
.dl-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.dl-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dl-actions {
  display: inline-flex;
  gap: 4px;
  flex: none;
}
.dl-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dl-sub {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}
.dl-error .dl-title {
  color: var(--danger);
}
.dl-bar {
  margin-top: 7px;
  height: 5px;
  border-radius: 999px;
  background: var(--card-2);
  overflow: hidden;
}
.dl-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.3s ease;
}
.dl-bar.is-indeterminate .dl-bar-fill {
  animation: dl-indeterminate 1.25s ease-in-out infinite;
}
@keyframes dl-indeterminate {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(320%);
  }
}
.dl-dismiss {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.dl-dismiss:hover {
  color: var(--text);
}
/* 启动失败弹窗 */
.launchfail-modal {
  width: 480px;
}
.launchfail-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  word-break: break-all;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.notice-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.notice-item:last-child {
  border-bottom: none;
}
.notice-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: var(--accent);
}
.notice-success .notice-dot {
  background: var(--ok);
}
.notice-error .notice-dot {
  background: var(--danger);
}
.notice-body {
  min-width: 0;
}
.notice-text {
  line-height: 1.5;
  word-break: break-all;
}
.notice-time {
  font-size: 11px;
  color: var(--text-dim);
}

.top-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 8px;
  flex-shrink: 0;
}

.win-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.win-btn svg {
  width: 15px;
  height: 15px;
}
.win-btn:hover {
  background: var(--card-2);
  color: var(--text);
}
.win-close:hover {
  background: var(--danger);
  color: #fff;
}

/* 内容区 */
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 22px;
}

@media (max-width: 1080px) {
  .shell {
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    margin: 8px;
    border-radius: 16px;
  }
  .content {
    padding: 12px 14px 18px;
  }
  .topbar {
    height: 68px;
  }
  .logo-area {
    height: 92px;
  }
}

/* ---------------- 整合包拖入遮罩 ---------------- */
.drop-mask {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  backdrop-filter: blur(2px);
  pointer-events: none; /* 遮罩不拦截拖拽事件，避免 dragleave 闪烁 */
}
.drop-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 52px 72px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  color: var(--accent);
}
.drop-box svg {
  width: 48px;
  height: 48px;
}
.drop-title {
  font-size: 17px;
  font-weight: 600;
}

/* ---------------- 整合包导入确认弹窗 ---------------- */
.mp-modal {
  width: min(620px, calc(100vw - 40px));
  max-height: 88vh;
  overflow-y: auto;
}
.mp-title {
  font-size: 17px;
  margin-bottom: 18px;
}
.mp-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}
.mp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mp-summary {
  margin: 10px 0 0;
  color: var(--text-dim);
  font-size: 11.5px;
}
.mp-label {
  font-size: 13px;
  color: var(--text-dim);
  margin: 16px 0 8px;
}
.mp-name-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mp-name-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.mp-name-opt:hover {
  border-color: var(--text-dim);
}
.mp-name-opt.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.mp-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  flex-shrink: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mp-name-opt.active .mp-radio {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 8px var(--accent);
}
.mp-name-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.mp-name-label {
  flex-shrink: 0;
}
.mp-name-value {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-name-opt.active .mp-name-value {
  color: var(--accent-2);
}
.mp-custom-name {
  width: 100%;
  margin-top: 9px;
}
.mp-conflict {
  display: grid;
  gap: 8px;
  margin-top: 13px;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, #e5a323 48%, var(--border));
  border-radius: 9px;
  background: color-mix(in srgb, #e5a323 8%, var(--card));
  font-size: 11.5px;
  color: var(--text-dim);
}
.mp-conflict strong {
  color: var(--text);
}
.mp-conflict-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  margin-top: 3px;
}
.mp-conflict-actions label,
.mp-replace-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.4;
}
.mp-conflict-actions label:hover, .mp-replace-confirm:hover { background: var(--card-2); }
.mp-conflict-actions label:has(input:checked), .mp-replace-confirm:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mp-conflict input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: 0;
}
.mp-existing-select {
  margin-top: 3px;
}
.mp-impact {
  padding: 8px 9px;
  border-radius: 7px;
  background: var(--card-2);
  line-height: 1.55;
}
.mp-impact.danger {
  color: var(--danger);
}
.mp-error {
  font-size: 13px;
  color: var(--danger);
  line-height: 1.7;
  word-break: break-all;
}
.mp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
