:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-install:rgb(47, 147, 248);
  --accent-install-hover: #0071e3;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: rgba(245, 245, 247, 0.86);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}

.header-brand {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1rem;
  min-width: 0;
}

.header-logo {
  width: 25px;
  height: 25px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.header .header-brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.search-wrap {
  flex: 1;
  max-width: 420px;
}

.header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.header-console-btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.header-console-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.header-console-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.search-wrap label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.search {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.search-wrap {
  position: relative;
}

.search-wrap::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236e6e73'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.banner {
  margin-bottom: 1.5rem;
  padding: 1.5rem 1.25rem;
  background: linear-gradient(135deg, #e8f2ff 0%, #f5f5f7 50%, #eef6ff 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.banner p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.banner code {
  font-size: 0.8125rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.channel-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}

.channel-tab {
  margin: 0;
  padding: 0.45rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.channel-tab:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.channel-tab[aria-selected="true"] {
  color: var(--accent);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.channel-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.error-box {
  display: none;
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  background: #fff3f0;
  border: 1px solid #ffd4cc;
  border-radius: var(--radius-sm);
  color: #8a1c00;
  font-size: 0.9375rem;
}

.error-box.visible {
  display: block;
}

.count {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.tag-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  min-height: 2rem;
}

.tag-bar-wrap[hidden] {
  display: none !important;
}

.tag-bar-label {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.tag-bar-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px;
  min-width: 0;
  flex: 1;
}

.tag-bar-scroll::-webkit-scrollbar {
  height: 4px;
}

.tag-bar-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.tag-filter-chip {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tag-filter-chip:hover {
  background: var(--bg);
  color: var(--text);
}

.tag-filter-chip.is-active {
  border-color: rgba(0, 113, 227, 0.35);
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
}

.tag-filter-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: left;
  width: 100%;
  height: 100%;
  min-height: 0;
  font: inherit;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.card-main {
  display: flex;
  gap: 0.875rem;
  padding: 1rem;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  align-items: flex-start;
  flex-shrink: 0;
}

.card-main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* 覆盖 .card 的 display:flex，否则 [hidden] 在部分浏览器中无法隐藏卡片 */
.card[hidden] {
  display: none !important;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 11px;
  object-fit: cover;
  flex-shrink: 0;
}

.card-body {
  min-width: 0;
  flex: 1;
  padding-right: 3.75rem;
}

.card-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: rgba(0, 113, 227, 0.1);
  border-radius: 6px;
}

.badge-card-corner {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  margin-top: 0;
  z-index: 1;
}

.card-summary {
  margin: 0;
  padding: 0 1rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.card-summary:not(.card-summary-empty) {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-summary.card-summary-empty {
  color: var(--text-secondary);
  opacity: 0.72;
  font-style: italic;
}

.card-tags-wrap {
  padding: 0 1rem 0.65rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.card-tags-wrap::-webkit-scrollbar {
  height: 4px;
}

.card-tags-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.card-tags-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  width: max-content;
  max-width: 100%;
}

.tag-pill {
  display: inline-block;
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

.card-footer {
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.addon-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 0.65rem;
  align-items: center;
}

.addon-action-bar .addon-action-btn {
  flex: 1 1 calc(50% - 0.25rem);
  min-width: 5rem;
  margin-top: 0;
  width: auto;
  font-size: 0.8125rem;
  padding: 0.5rem 0.5rem;
  border-radius: 10px;
  text-align: center;
  justify-content: center;
}

.addon-action-bar .addon-action-btn-muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 calc(50% - 0.25rem);
  min-width: 6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.04);
  border: 1px dashed var(--border);
  cursor: default;
}

.detail-summary-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
}

.detail-summary-text.detail-summary-empty {
  color: var(--text-secondary);
  opacity: 0.8;
  font-style: italic;
}

.detail-section-doc .detail-doc-block {
  margin-top: 0.4rem;
}

.detail-tags-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.detail-tags-wrap::-webkit-scrollbar {
  height: 4px;
}

.detail-tags-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.detail-tags-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  width: max-content;
  max-width: 100%;
  padding-bottom: 0.15rem;
}

/* Detail overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.overlay.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 110;
  width: min(440px, 100vw);
  height: 100%;
  background: var(--surface);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.confirm-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.confirm-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  width: min(360px, calc(100vw - 2rem));
}

.confirm-modal-text {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  word-break: break-all;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.confirm-modal-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.confirm-modal-cancel {
  background: var(--bg);
  color: var(--text-secondary);
}

.confirm-modal-cancel:hover {
  background: var(--border);
}

.confirm-modal-ok {
  background: var(--accent);
  color: #fff;
}

.confirm-modal-ok:hover {
  background: var(--accent-hover);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  object-fit: cover;
  flex-shrink: 0;
}

.drawer-title-block {
  min-width: 0;
  flex: 1;
  padding-top: 0.25rem;
}

.drawer-title-block h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.drawer-sub {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.drawer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.drawer-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drawer-wrap {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
}

.drawer-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 0;
}

.drawer-footer:empty {
  display: none;
}

.detail-section {
  margin-bottom: 1.25rem;
}

.detail-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.detail-row {
  font-size: 0.875rem;
  word-break: break-all;
}

.detail-row+.detail-row {
  margin-top: 0.35rem;
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.link-list a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
}

.link-list a:hover {
  text-decoration: underline;
}

.acquire-block {
  margin-top: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.acquire-block:first-of-type {
  margin-top: 0.35rem;
}

.acquire-block-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.acquire-block-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.acquire-block-actions .btn-primary,
.acquire-block-actions .btn-secondary {
  margin-top: 0;
}

.history-links-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.5rem;
}

.history-links-group .split-btn {
  width: auto;
  height: 32px !important;
  flex-shrink: 0;
  align-items: stretch;
}

.history-links-group .split-btn-main {
  padding: 0 0.75rem;
  font-size: 0.8125rem;
  min-height: 0 !important;
  height: 32px !important;
}

.history-links-group .split-btn-toggle {
  width: 26px;
  flex: 0 0 26px;
  min-height: 0 !important;
  height: 32px !important;
}

.history-links-group .split-btn-main,
.history-links-group .split-btn-toggle {
  border: none;
}

.history-links-group .split-btn:has(.split-btn-toggle) .split-btn-main {
  border-radius: 8px 0 0 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.history-links-group .split-btn:has(.split-btn-toggle) .split-btn-toggle {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.history-links-group .history-download-btn + .split-btn-toggle {
  border-right-color: var(--border);
}

/* 横向排列时覆盖基础样式的 margin-top，避免按钮错位 */
.history-links-group .split-btn + .split-btn {
  margin-top: 0;
}

/* 主区「获取」按钮组 */
.detail-action-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-action-split {
  position: relative;
  display: flex;
  width: 100%;
  border-radius: 12px;
  overflow: visible;
}

.detail-action-split + .detail-action-split {
  margin-top: 0;
}

.detail-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.62rem 1rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
  white-space: nowrap;
}

.detail-action-install {
  background: rgba(0, 113, 227, 0.12);
  color: var(--accent);
  border-radius: 12px;
}

.detail-action-install:hover {
  background: rgba(0, 113, 227, 0.2);
}

.detail-action-download {
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
  border-radius: 12px;
}

.detail-action-download:hover {
  background: rgba(0, 113, 227, 0.15);
}

.detail-action-toggle {
  width: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-left: 1px solid rgba(0, 113, 227, 0.15);
  cursor: pointer;
  transition: background 0.15s;
  min-height: 44px;
  position: relative;
}

.detail-action-toggle.detail-action-install {
  border-radius: 0;
  background: rgba(0, 113, 227, 0.12);
  color: var(--accent);
}

.detail-action-toggle.detail-action-install:hover {
  background: rgba(0, 113, 227, 0.2);
}

.detail-action-toggle.detail-action-download {
  border-radius: 0;
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
}

.detail-action-toggle.detail-action-download:hover {
  background: rgba(0, 113, 227, 0.15);
}

.detail-action-split:has(.detail-action-toggle) .detail-action-btn {
  border-radius: 12px 0 0 12px;
}

.detail-action-split:has(.detail-action-toggle) .detail-action-toggle {
  border-radius: 0 12px 12px 0;
}

.detail-action-toggle::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.2s;
}

.detail-action-split.is-open .detail-action-toggle::after {
  transform: rotate(-135deg);
}

.detail-action-split .split-btn-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 100%;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 0.3rem;
  overflow: hidden;
}

.detail-action-split.is-open .split-btn-menu {
  display: block;
}

.split-btn {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  border-radius: 10px;
  overflow: visible;
}

.split-btn + .split-btn {
  margin-top: 0.5rem;
}

.split-btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0.6rem 1rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
  white-space: nowrap;
}

.split-btn-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  flex: 0 0 38px;
  padding: 0;
  font: inherit;
  font-size: 0.9375rem;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 44px;
  position: relative;
}

.history-download-btn + .split-btn-toggle {
  border-left-color: var(--border);
}

.split-btn-toggle::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.2s;
}

.split-btn.is-open .split-btn-toggle::after {
  transform: rotate(-135deg);
}

.split-btn-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 100%;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 0.3rem;
  overflow: hidden;
}

.split-btn.is-open .split-btn-menu {
  display: block;
}

.history-install-btn {
  background: var(--accent-install);
  color: rgb(220, 241, 255);
}

.history-install-btn:hover {
  background: var(--accent-install-hover);
  color: rgb(255, 255, 255);
}

.history-download-btn {
  background: var(--surface);
  color: var(--text);
}

.history-download-btn:hover {
  background: var(--bg);
}

.history-links-group .history-install-btn {
  background: var(--accent);
}

.history-links-group .history-download-btn {
  background: rgba(0, 0, 0, 0.06);
}

.history-links-group .history-download-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.history-dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.12s;
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent-install);
  color:rgb(220, 241, 255);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color:rgb(255, 255, 255);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn-primary.btn-install {
  background: var(--accent-install);
  font-weight: 600;
}

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

.btn-primary.btn-install:focus-visible {
  outline-color: var(--accent-install);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-secondary.detail-doc-btn {
  margin-top: 0;
  justify-content: center;
  padding: 0.62rem 1rem;
  font-weight: 600;
  border-radius: 12px;
  border-color: rgba(0, 113, 227, 0.22);
  color: var(--accent);
  background: rgba(0, 113, 227, 0.06);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-secondary.detail-doc-btn:hover {
  background: rgba(0, 113, 227, 0.1);
  border-color: rgba(0, 113, 227, 0.32);
  color: var(--accent-hover);
}

.btn-secondary.detail-doc-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

details.history-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

details.history-block summary {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}

details.history-block summary:hover {
  background: var(--bg);
}

details.history-block summary::-webkit-details-marker {
  display: none;
}

details.history-block summary::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236e6e73'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.history-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: auto;
}

details.history-block summary::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  margin-left: 0.25rem;
}

details.history-block[open] summary::after {
  transform: rotate(45deg);
}

.history-inner {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
}

.history-timeline {
  position: relative;
  padding-left: 1.5rem;
}

.history-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.history-item {
  position: relative;
  padding: 0.75rem 0 0.75rem 0.75rem;
  font-size: 0.8125rem;
}

.history-item::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 1.1rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  z-index: 1;
  transform: translateX(0.5px);
}

.history-item:first-child::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.history-item + .history-item {
  border-top: 1px solid var(--border);
}

.history-ver {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-ver-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.history-ver-tag--latest {
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
}

.history-changelog {
  margin: 0.5rem 0 0.65rem;
  font-size: 0.8125rem;
}

.history-changelog.loading .changelog-loading-text {
  color: var(--text-secondary);
}

.changelog-md-wrap {
  margin-top: 0.35rem;
}

.changelog-md {
  margin: 0;
  padding: 0.65rem 0.85rem;
  max-height: 280px;
  overflow: auto;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.changelog-md> :first-child {
  margin-top: 0;
}

.changelog-md> :last-child {
  margin-bottom: 0;
}

.changelog-md h1,
.changelog-md h2,
.changelog-md h3,
.changelog-md h4 {
  margin: 0.85em 0 0.4em;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.changelog-md h1 {
  font-size: 1.1rem;
}

.changelog-md h2 {
  font-size: 1rem;
}

.changelog-md h3,
.changelog-md h4 {
  font-size: 0.9375rem;
}

.changelog-md p {
  margin: 0.5em 0;
}

.changelog-md ul,
.changelog-md ol {
  margin: 0.5em 0;
  padding-left: 1.35rem;
}

.changelog-md li {
  margin: 0.25em 0;
}

.changelog-md blockquote {
  margin: 0.5em 0;
  padding: 0.35rem 0 0.35rem 0.75rem;
  border-left: 3px solid var(--border);
  color: var(--text-secondary);
}

.changelog-md pre {
  margin: 0.6em 0;
  padding: 0.55rem 0.65rem;
  overflow: auto;
  font-size: 0.75rem;
  line-height: 1.45;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.changelog-md code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.12em 0.35em;
  background: var(--bg);
  border-radius: 4px;
}

.changelog-md pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.changelog-md table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6em 0;
  font-size: 0.8125rem;
}

.changelog-md th,
.changelog-md td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
}

.changelog-md th {
  background: var(--bg);
}

.changelog-md a {
  color: var(--accent);
  word-break: break-all;
}

.changelog-md hr {
  margin: 0.75em 0;
  border: none;
  border-top: 1px solid var(--border);
}

.changelog-md img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.changelog-open-link {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
}

.changelog-open-link:hover {
  text-decoration: underline;
}

.changelog-err-msg {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  color: #8a1c00;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Admin console overlay */
.console-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.console-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* 控制台主容器：窄屏单列；宽屏在 --with-edit 时与编辑区分栏 */
.console-layout {
  width: 100%;
  max-width: min(560px, calc(100vw - 2rem));
  max-height: min(85vh, 760px);
  position: relative;
}

.console-panel {
  position: relative;
  width: 100%;
  max-height: inherit;
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.35rem 1.5rem 1.5rem;
}

@media (min-width: 960px) {
  .console-layout--with-edit,
  .console-layout--with-new-plugin {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    max-width: min(1100px, calc(100vw - 2rem));
    max-height: min(85vh, 800px);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }

  .console-layout--with-edit .console-panel,
  .console-layout--with-new-plugin .console-panel {
    flex: 0 0 clamp(280px, 32vw, 400px);
    max-height: none;
    min-height: 0;
    align-self: stretch;
    border-radius: 0;
    box-shadow: none;
    border-right: 1px solid var(--border);
  }

  .console-edit-overlay:not(.open),
  .console-new-plugin-overlay:not(.open) {
    display: none !important;
  }

  .console-layout--with-edit .console-edit-overlay.open,
  .console-layout--with-new-plugin .console-new-plugin-overlay.open {
    position: static !important;
    inset: auto !important;
    z-index: auto !important;
    padding: 0 !important;
    background: transparent !important;
    opacity: 1 !important;
    visibility: visible !important;
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex !important;
    align-items: stretch;
    justify-content: stretch;
  }

  .console-layout--with-edit .console-edit-panel,
  .console-layout--with-new-plugin .console-new-plugin-panel {
    width: 100%;
    max-width: none;
    min-height: 0;
    max-height: min(85vh, 800px);
    border-radius: 0;
    box-shadow: none;
  }

  /* 未分栏时控制台加宽 */
  .console-layout:not(.console-layout--with-edit):not(.console-layout--with-new-plugin) {
    max-width: min(960px, calc(100vw - 2rem));
    max-height: min(88vh, 860px);
  }

  .console-layout--with-new-plugin .console-upload-dropzone {
    min-height: 128px;
  }
}

.console-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.console-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.console-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.console-title {
  margin: 0 0 0.75rem;
  padding-right: 2.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.console-lead {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.console-lead code,
.console-my-lead code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}

.console-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.console-key-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.console-key-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.console-err {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: #8a1c00;
}

.btn-console-submit {
  margin-top: 1rem;
  width: 100%;
  height: 42px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-console-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.console-body .console-placeholder {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.console-my-lead {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.console-my-section {
  margin-bottom: 1rem;
}

.console-my-section[hidden] {
  display: none !important;
}

.console-upload-section {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.console-body--upload-only .console-upload-section {
  padding-top: 0;
  border-top: none;
}

.console-new-plugin-entry {
  margin: 0;
}

.btn-open-new-plugin-form {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(0, 113, 227, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(0, 113, 227, 0.06);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-open-new-plugin-form:hover {
  background: rgba(0, 113, 227, 0.1);
  border-color: var(--accent);
}

.btn-open-new-plugin-form:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.console-new-plugin-panel {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  max-height: min(90vh, 820px);
  overflow: auto;
  margin: 0;
  padding: 1.35rem 1.5rem 1.15rem;
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.console-new-plugin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0;
}

/* 与「编辑插件」共用 .console-edit-title；此处为标题+「收起」横排，无需为右上角 × 预留 padding */
.console-new-plugin-panel-head .console-edit-title {
  flex: 1;
  min-width: 0;
  padding-right: 0;
}

.btn-console-new-plugin-collapse {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-console-new-plugin-collapse:hover {
  background: rgba(0, 0, 0, 0.1);
}

.btn-console-new-plugin-collapse:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.console-new-plugin-upload-block {
  margin-top: 0.25rem;
}

.console-edit-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.console-edit-fields--new-plugin {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.console-section-title {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.console-upload-lead {
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.console-upload-lead code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}

.console-upload-dropzone {
  position: relative;
  min-height: 118px;
  border: 2px dashed rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}

.console-upload-dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(0, 113, 227, 0.06);
}

.console-upload-dropzone-label {
  pointer-events: none;
  position: relative;
  z-index: 0;
  padding: 1.25rem 1rem;
  text-align: center;
}

.console-upload-file-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.console-upload-prompt {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.console-upload-sub {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.console-upload-msg {
  margin: 0.65rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.console-upload-msg--ok {
  color: #1d6b2c;
}

.console-upload-msg--warn {
  color: var(--text-secondary);
}

.console-upload-msg--err {
  color: #8a1c00;
}

.console-upload-pending {
  margin-top: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 113, 227, 0.06);
  border: 1px solid rgba(0, 113, 227, 0.2);
}

.console-upload-pending-label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.console-upload-pending-name {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  word-break: break-all;
  color: var(--text);
}

.console-upload-changelog-field {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.console-upload-pending-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* 避免 display:flex 覆盖 HTML hidden，导致未选文件时按钮仍可见 */
.console-upload-pending[hidden],
.console-upload-actions[hidden] {
  display: none !important;
}

.console-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.btn-console-upload-cancel {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-console-upload-cancel:hover {
  background: rgba(0, 0, 0, 0.04);
}

.btn-console-upload-confirm {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-console-upload-confirm:hover {
  background: var(--accent-hover);
}

.btn-console-upload-cancel:focus-visible,
.btn-console-upload-confirm:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.console-edit-upload-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.console-edit-upload-title {
  margin: 0 0 0.4rem;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.console-edit-upload-lead {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.console-edit-upload-lead code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}

.console-edit-upload-dropzone {
  min-height: 100px;
}

.console-my-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.console-my-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.console-my-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.console-my-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

/* 无图标时的占位块：仅用细边框，不加底色 */
div.console-my-icon {
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.console-my-meta {
  flex: 1;
  min-width: 0;
}

.console-my-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-my-id {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-console-edit {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-console-edit:hover {
  background: rgba(0, 113, 227, 0.08);
  border-color: rgba(0, 113, 227, 0.35);
}

.btn-console-edit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 控制台内「新建插件」弹层（窄屏叠层；宽屏与左栏分栏） */
.console-new-plugin-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.console-new-plugin-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* 控制台内编辑弹层（叠在控制台之上） */
.console-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.console-edit-overlay.open {
  opacity: 1;
  visibility: visible;
}

.console-edit-panel {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  max-height: min(90vh, 820px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.35rem 1.5rem 1.15rem;
}

.console-edit-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.console-edit-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.console-edit-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.console-edit-title {
  margin: 0 0 1rem;
  padding-right: 2.25rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.console-edit-fields {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.console-edit-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.console-edit-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.console-edit-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.console-edit-textarea {
  width: 100%;
  min-height: 4.5rem;
  max-height: 12rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.console-edit-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.console-edit-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.btn-console-edit-cancel {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-console-edit-cancel:hover {
  background: rgba(0, 0, 0, 0.04);
}

.btn-console-edit-save {
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-console-edit-save:hover {
  background: var(--accent-hover);
}

.btn-console-edit-cancel:focus-visible,
.btn-console-edit-save:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .header-brand {
    order: 1;
  }

  .header-actions {
    order: 2;
    margin-left: auto;
  }

  .search-wrap {
    max-width: none;
    order: 3;
    width: 100%;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}