:root {
  --bg-deep: #0a0e14;
  --bg: #0f1419;
  --surface: #151c28;
  --surface-2: #1a2332;
  --surface-hover: #1e2a3d;
  --text: #e8eef7;
  --text-secondary: #b8c4d4;
  --muted: #7d8fa3;
  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, 0.12);
  --accent-hover: #0ea5e9;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --warning: #fbbf24;
  --border: rgba(45, 58, 79, 0.85);
  --border-strong: #3d4f6a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

[data-theme="light"] {
  --bg-deep: #eef3fb;
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-2: #f4f8ff;
  --surface-hover: #ebf3ff;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-dim: rgba(2, 132, 199, 0.12);
  --accent-hover: #0369a1;
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.12);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.12);
  --warning: #d97706;
  --border: rgba(148, 163, 184, 0.42);
  --border-strong: #94a3b8;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 14px 40px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 900px 480px at 15% -8%, rgba(30, 58, 95, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse 700px 400px at 95% 5%, rgba(49, 46, 129, 0.35) 0%, transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  -webkit-font-smoothing: antialiased;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 900px 480px at 15% -8%, rgba(125, 211, 252, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 700px 400px at 95% 5%, rgba(191, 219, 254, 0.45) 0%, transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.site-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.site-footer {
  flex-shrink: 0;
  padding: 10px 16px 14px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid rgba(45, 58, 79, 0.5);
}

[data-theme="light"] .site-footer {
  border-top-color: var(--border);
}

/* —— 登录页 —— */
.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.shell.wide {
  max-width: 1460px;
}

/* 登录 / 首次改密页：顶角主题切换（与顶栏按钮共用 theme.js） */
.login-theme-float {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 60;
}

.login-page {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(145deg, rgba(26, 35, 50, 0.97) 0%, rgba(18, 24, 35, 0.98) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px 40px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(56, 189, 248, 0.06);
}

[data-theme="light"] .login-card {
  background: linear-gradient(145deg, #ffffff 0%, var(--surface-2) 100%);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(2, 132, 199, 0.08);
}

[data-theme="light"] .brand-mark img {
  filter: drop-shadow(0 6px 18px rgba(15, 23, 42, 0.1));
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 8px;
}

.login-card .lead {
  text-align: center;
  margin: 0 0 28px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}

.login-insecure-hint {
  text-align: center;
  margin: -12px 0 20px;
  font-size: 0.78rem;
  color: var(--warning);
  line-height: 1.45;
}

.login-card .login-rate-hint {
  margin: 0;
  color: var(--warning);
}

.brand-mark {
  text-align: center;
  margin-bottom: 20px;
}

.brand-mark img {
  max-width: 112px;
  max-height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

/* —— 应用壳 —— */
.app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 14px 24px;
  margin: 0 0 8px;
  background: rgba(15, 20, 25, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .app-header {
  background: rgba(248, 251, 255, 0.88);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.nav-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-text .product-name {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.app-header .header-trail {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.app-header .user-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
}

.app-header .user-line .user-name {
  color: var(--text-secondary);
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-main {
  flex: 1;
  max-width: 1460px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 12px 56px;
}

.app-main--flush {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.modal-open {
  overflow: hidden;
}

/* —— 弹窗 —— */
.modal[hidden] {
  display: none !important;
}

.modal:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  box-sizing: border-box;
}

.modal--busy .modal__backdrop {
  pointer-events: none;
  cursor: default;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

[data-theme="light"] .modal__backdrop {
  background: rgba(148, 163, 184, 0.32);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(88vh, 860px);
  overflow: auto;
  background: linear-gradient(165deg, rgba(26, 35, 50, 0.98) 0%, rgba(18, 24, 35, 0.99) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

[data-theme="light"] .modal__panel {
  background: linear-gradient(165deg, #ffffff 0%, #f7fbff 100%);
}

.modal__panel--wide {
  max-width: 560px;
}

#modal-download-copy.modal .modal__panel--wide {
  max-width: min(92vw, 720px);
}

#modal-upload-version.modal .modal__panel--wide {
  max-width: min(94vw, 880px);
}

#modal-api-tokens.modal .modal__panel--wide {
  max-width: min(94vw, 720px);
}

.api-token-reveal-textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 4.5rem;
}

.api-token-new-row {
  margin-bottom: 8px;
}

.download-share-active {
  margin-bottom: 16px;
}

.download-share-active__title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.download-share-active__table-wrap {
  margin-top: 8px;
}

.download-share-table .col-actions {
  min-width: 11rem;
  white-space: nowrap;
}

.download-share-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.download-share-table__empty {
  text-align: center;
  color: var(--muted);
}

.download-share-table__empty.err {
  color: var(--danger);
}

.api-upload-tutorial {
  margin: 12px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.api-upload-tutorial summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

.api-upload-tutorial__body {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.api-upload-tutorial__h {
  margin: 12px 0 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.api-upload-tutorial__pre {
  margin: 0 0 8px;
  padding: 10px 12px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.45;
}

.api-upload-tutorial__ol {
  margin: 0 0 8px 1.2em;
  padding: 0;
  line-height: 1.55;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal__close {
  appearance: none;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.modal__close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal__body {
  padding: 16px 20px 22px;
  text-align: left;
}

.modal__body > .hint {
  margin: 0 0 8px;
  line-height: 1.55;
}

.modal__body form.modal-form {
  margin-top: 4px;
  gap: 12px;
}

.modal__body form.modal-form > label {
  align-items: flex-start;
  width: 100%;
  text-align: left;
}

/* 弹窗内文件选择：深色主题 + 自定义「选择文件」按钮，避免系统白按钮突兀 */
.modal__body input[type="file"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.4;
}

.modal__body input[type="file"]::file-selector-button {
  margin-right: 14px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.modal__body input[type="file"]::file-selector-button:hover {
  background: var(--accent-dim);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--accent);
}

.modal__body input[type="file"]::-webkit-file-upload-button {
  margin-right: 14px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.modal__body input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--accent-dim);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--accent);
}

.modal__body input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.modal__body input[type="text"],
.modal__body input[type="number"],
.modal__body input[type="password"],
.modal__body select {
  width: 100%;
  box-sizing: border-box;
}

.modal__body input[type="text"]:focus,
.modal__body input[type="number"]:focus,
.modal__body input[type="password"]:focus,
.modal__body select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 4px;
}

.btn-ghost-danger {
  color: var(--danger);
}

.btn-ghost-danger:hover {
  background: var(--danger-bg);
  color: #fecaca;
}

.card-head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.card-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn-compact {
  padding: 8px 14px;
  font-size: 0.88rem;
}

.brand-home-link {
  display: flex;
  flex-shrink: 0;
  line-height: 0;
  border-radius: 10px;
}

.product-name-link {
  text-decoration: none;
  color: inherit;
}

.product-name-link:hover .product-name {
  color: var(--accent);
}

.header-nav-link {
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.header-nav-link:hover {
  text-decoration: underline;
}

.icon-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 0.35em;
  line-height: 1;
  vertical-align: -2px;
}

.card-icon__svg {
  width: 16px;
  height: 16px;
  display: block;
}

.header-logout-btn {
  padding: 7px 12px;
  font-size: 0.84rem;
  line-height: 1.2;
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.05);
}

.header-logout-btn:hover {
  color: #ffe4e6;
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.16);
}

.header-theme-btn {
  padding: 7px 12px;
  font-size: 0.84rem;
  line-height: 1.2;
}

.card--compact .card-inner {
  padding-bottom: 16px;
}

.version-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.category-filter-bar {
  margin-top: 2px;
}

.user-filter-bar {
  gap: 10px;
  margin-top: 0;
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.user-filter-bar > label {
  display: flex;
  align-items: center;
  margin: 0;
}

.user-filter-keyword {
  flex: 1 1 300px;
  min-width: 240px;
  max-width: 340px;
}

.user-filter-small {
  flex: 0 0 130px;
  min-width: 130px;
}

.user-filter-bar input[type="text"],
.user-filter-bar select {
  height: 38px;
  padding: 8px 12px;
}

@media (max-width: 820px) {
  .user-filter-keyword {
    max-width: 100%;
  }

  .user-filter-small {
    flex: 1 1 130px;
  }
}

.dashboard-section .dashboard-subtitle {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-change-password-inline {
  width: 100%;
  max-width: none;
}

.perm-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px 12px;
  margin: 0;
  background: rgba(12, 17, 24, 0.55);
}

.perm-fieldset > legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.perm-radio-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.perm-radio {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(21, 28, 40, 0.72);
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.45;
  transition: background 0.15s, border-color 0.15s;
}

.perm-radio:first-of-type {
  margin-top: 2px;
}

.perm-radio:hover {
  background: var(--surface-hover);
  border-color: rgba(56, 189, 248, 0.35);
}

.perm-radio input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

@media (max-width: 980px) {
  .perm-radio-row {
    grid-template-columns: 1fr;
  }
}

.perm-multi-hint {
  margin: 0 0 6px;
  font-size: 0.82rem;
}

.perm-multiselect {
  width: 100%;
  min-height: 160px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.perm-user-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.perm-user-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.perm-user-input-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.perm-user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.perm-empty {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.perm-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--text-secondary);
  max-width: 100%;
}

.perm-tag__name {
  font-size: 0.84rem;
  white-space: nowrap;
}

.perm-tag__kind {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(10, 18, 30, 0.55);
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.perm-tag__remove {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
  color: var(--text-secondary);
  line-height: 1;
}

.perm-tag__remove:hover {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.filter-label {
  font-size: 0.85rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  appearance: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-chip:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.filter-chip.is-active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.4);
}

.category-chip {
  border-color: var(--cat-border, var(--border-strong));
  color: var(--cat-color, var(--text-secondary));
  background: var(--cat-bg, var(--surface));
}

.category-chip:hover {
  background: var(--cat-bg-hover, var(--surface-hover));
  color: var(--cat-color, var(--text));
}

.category-chip.is-active {
  background: var(--cat-bg-active, var(--accent-dim));
  color: var(--cat-color, var(--accent));
  border-color: var(--cat-border-active, rgba(56, 189, 248, 0.45));
}

.category-chip--blue { --cat-bg: rgba(59, 130, 246, 0.10); --cat-bg-hover: rgba(59, 130, 246, 0.16); --cat-bg-active: rgba(59, 130, 246, 0.20); --cat-border: rgba(59, 130, 246, 0.40); --cat-border-active: rgba(59, 130, 246, 0.55); --cat-color: #93c5fd; }
.category-chip--cyan { --cat-bg: rgba(6, 182, 212, 0.10); --cat-bg-hover: rgba(6, 182, 212, 0.16); --cat-bg-active: rgba(6, 182, 212, 0.20); --cat-border: rgba(6, 182, 212, 0.40); --cat-border-active: rgba(6, 182, 212, 0.55); --cat-color: #67e8f9; }
.category-chip--teal { --cat-bg: rgba(20, 184, 166, 0.10); --cat-bg-hover: rgba(20, 184, 166, 0.16); --cat-bg-active: rgba(20, 184, 166, 0.20); --cat-border: rgba(20, 184, 166, 0.40); --cat-border-active: rgba(20, 184, 166, 0.55); --cat-color: #5eead4; }
.category-chip--green { --cat-bg: rgba(34, 197, 94, 0.10); --cat-bg-hover: rgba(34, 197, 94, 0.16); --cat-bg-active: rgba(34, 197, 94, 0.20); --cat-border: rgba(34, 197, 94, 0.40); --cat-border-active: rgba(34, 197, 94, 0.55); --cat-color: #86efac; }
.category-chip--lime { --cat-bg: rgba(132, 204, 22, 0.10); --cat-bg-hover: rgba(132, 204, 22, 0.16); --cat-bg-active: rgba(132, 204, 22, 0.20); --cat-border: rgba(132, 204, 22, 0.40); --cat-border-active: rgba(132, 204, 22, 0.55); --cat-color: #bef264; }
.category-chip--amber { --cat-bg: rgba(245, 158, 11, 0.10); --cat-bg-hover: rgba(245, 158, 11, 0.16); --cat-bg-active: rgba(245, 158, 11, 0.20); --cat-border: rgba(245, 158, 11, 0.40); --cat-border-active: rgba(245, 158, 11, 0.55); --cat-color: #fcd34d; }
.category-chip--orange { --cat-bg: rgba(249, 115, 22, 0.10); --cat-bg-hover: rgba(249, 115, 22, 0.16); --cat-bg-active: rgba(249, 115, 22, 0.20); --cat-border: rgba(249, 115, 22, 0.40); --cat-border-active: rgba(249, 115, 22, 0.55); --cat-color: #fdba74; }
.category-chip--red { --cat-bg: rgba(239, 68, 68, 0.10); --cat-bg-hover: rgba(239, 68, 68, 0.16); --cat-bg-active: rgba(239, 68, 68, 0.20); --cat-border: rgba(239, 68, 68, 0.40); --cat-border-active: rgba(239, 68, 68, 0.55); --cat-color: #fca5a5; }
.category-chip--rose { --cat-bg: rgba(244, 63, 94, 0.10); --cat-bg-hover: rgba(244, 63, 94, 0.16); --cat-bg-active: rgba(244, 63, 94, 0.20); --cat-border: rgba(244, 63, 94, 0.40); --cat-border-active: rgba(244, 63, 94, 0.55); --cat-color: #fda4af; }
.category-chip--purple { --cat-bg: rgba(168, 85, 247, 0.10); --cat-bg-hover: rgba(168, 85, 247, 0.16); --cat-bg-active: rgba(168, 85, 247, 0.20); --cat-border: rgba(168, 85, 247, 0.40); --cat-border-active: rgba(168, 85, 247, 0.55); --cat-color: #d8b4fe; }
.category-chip--slate { --cat-bg: rgba(100, 116, 139, 0.16); --cat-bg-hover: rgba(100, 116, 139, 0.22); --cat-bg-active: rgba(100, 116, 139, 0.26); --cat-border: rgba(100, 116, 139, 0.42); --cat-border-active: rgba(100, 116, 139, 0.58); --cat-color: #cbd5e1; }

[data-theme="light"] .category-chip--blue { --cat-color: #1d4ed8; }
[data-theme="light"] .category-chip--cyan { --cat-color: #0e7490; }
[data-theme="light"] .category-chip--teal { --cat-color: #0f766e; }
[data-theme="light"] .category-chip--green { --cat-color: #15803d; }
[data-theme="light"] .category-chip--lime { --cat-color: #4d7c0f; }
[data-theme="light"] .category-chip--amber { --cat-color: #b45309; }
[data-theme="light"] .category-chip--orange { --cat-color: #c2410c; }
[data-theme="light"] .category-chip--red { --cat-color: #b91c1c; }
[data-theme="light"] .category-chip--rose { --cat-color: #be123c; }
[data-theme="light"] .category-chip--purple { --cat-color: #7e22ce; }
[data-theme="light"] .category-chip--slate { --cat-color: #334155; }

.sw-detail-header-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.sw-detail-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

table.data .col-icon {
  width: 52px;
  padding-left: 8px;
  padding-right: 8px;
  vertical-align: middle;
}

.sw-list-icon {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.table-entry-link {
  color: inherit;
  text-decoration: none;
}

.table-entry-link--icon {
  display: inline-block;
  border-radius: 8px;
}

.table-entry-link--icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.table-entry-link--name {
  font-weight: inherit;
}

.table-entry-link--name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.upload-progress-wrap {
  margin-top: 12px;
  max-width: 520px;
}

.upload-progress-wrap progress {
  display: block;
  width: 100%;
  height: 10px;
  margin-bottom: 6px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.upload-progress-wrap progress::-webkit-progress-bar {
  background: var(--surface);
  border-radius: 6px;
}

.upload-progress-wrap progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 6px;
}

.upload-progress-wrap progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 6px;
}

.upload-progress-text {
  font-size: 0.85rem;
}

.breadcrumb-nav {
  margin-bottom: 16px;
}

.breadcrumb-nav .back-to-app {
  font-size: 0.92rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-nav .back-to-app:hover {
  text-decoration: underline;
}

.welcome-banner {
  margin-bottom: 24px;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-dim) 0%, rgba(49, 46, 129, 0.15) 100%);
  border: 1px solid rgba(56, 189, 248, 0.18);
}

.welcome-banner h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.welcome-banner p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.welcome-banner p strong {
  color: var(--accent);
  font-weight: 600;
  margin-right: 6px;
}

/* 发布管理表单：替代内联 flex */
.row .flex-label {
  flex: 1;
  min-width: 140px;
}

.row .flex-label-wide {
  flex: 2;
  min-width: 180px;
}

/* —— Tab —— */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  padding: 6px;
  border-radius: var(--radius);
  background: rgba(15, 22, 32, 0.65);
  border: 1px solid var(--border);
}

.tab-btn {
  appearance: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.tab-btn.is-active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.12);
}

.tab-panel[hidden] {
  display: none !important;
}

.content-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

/* —— 卡片 —— */
.card {
  background: rgba(21, 28, 40, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.94);
}

.card-inner {
  padding: 22px 24px 24px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* 卡片内仅有标题区、无正文/表格时，底部分隔线会贴在卡片底边显得多余 */
.card-inner > .card-head:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.card-head h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-head .card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 1rem;
}

.card-head .hint {
  margin: 4px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.45;
}

.card-body .muted {
  margin: 0 0 16px;
  font-size: 0.9rem;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stack label,
.row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.row.wrap {
  align-items: center;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  font: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* 表格内编辑框与主题一致，避免系统默认浅色 number 框 */
table.data input[type="text"],
table.data input[type="number"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

table.data td .cat-sort-input {
  max-width: 7rem;
}

input[type="file"] {
  padding: 8px;
  font-size: 0.88rem;
}

button {
  cursor: pointer;
  font: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 10px 18px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.primary {
  background: linear-gradient(180deg, #4fc3f7 0%, var(--accent) 100%);
  color: #0a1628;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.25);
}

button.primary:hover {
  background: linear-gradient(180deg, #7dd3fc 0%, var(--accent-hover) 100%);
}

/* 公开下载落地页等：<a> 需与 button.primary 视觉一致 */
a.dl-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 18px;
  font: inherit;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.5);
  background: linear-gradient(180deg, #4fc3f7 0%, var(--accent) 100%);
  color: #0a1628;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.25);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}

a.dl-download-btn:hover {
  background: linear-gradient(180deg, #7dd3fc 0%, var(--accent-hover) 100%);
  color: #0a1628;
}

a.dl-download-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[data-theme="light"] a.dl-download-btn {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  border-color: rgba(2, 132, 199, 0.45);
  color: #f8fafc;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.22);
}

[data-theme="light"] a.dl-download-btn:hover {
  background: linear-gradient(180deg, #7dd3fc 0%, #0369a1 100%);
  color: #fff;
}

button.ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

button.ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

button.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
}

button.btn-danger-ghost:hover {
  background: var(--danger-bg);
}

/* 表格 */
.table-shell {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: auto;
  background: rgba(10, 14, 20, 0.45);
}

[data-theme="light"] .table-shell {
  background: rgba(248, 250, 252, 0.85);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(45, 58, 79, 0.5);
  vertical-align: middle;
  text-align: left;
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

table.data tbody tr:hover td {
  background: rgba(56, 189, 248, 0.04);
}

.col-name {
  font-weight: 500;
  color: var(--text);
}

.col-num {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.table-pager__meta {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

table.inner {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  table-layout: fixed;
}

table.inner thead th {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.inner tbody td {
  padding: 10px;
  border-bottom: 1px solid rgba(36, 48, 69, 0.8);
  vertical-align: middle;
  overflow: hidden;
  text-align: left;
}

.cell-ellipsis {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.inner th.col-ver,
table.inner td.col-ver {
  width: 17%;
}

table.inner th.col-os,
table.inner td.col-os {
  width: 8%;
}

table.inner th.col-py,
table.inner td.col-py {
  width: 8%;
}

table.inner th.col-file,
table.inner td.col-file {
  width: 24%;
}

table.inner th.col-size,
table.inner td.col-size {
  width: 8%;
}

table.inner th.col-dl,
table.inner td.col-dl {
  width: 8%;
}

table.inner th.col-time,
table.inner td.col-time {
  width: 12%;
}

.cell-datetime {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
  white-space: nowrap;
}

.cell-datetime__date {
  color: var(--text-secondary);
}

.cell-datetime__time {
  color: var(--muted);
  font-size: 0.78rem;
}

table.inner th.col-uploader,
table.inner td.col-uploader {
  width: 7%;
}

table.inner th.col-actions,
table.inner td.col-actions {
  width: 8%;
}

table.inner td.col-actions .table-actions {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 6px;
}

tr.sub td {
  background: rgba(8, 12, 18, 0.55);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] tr.sub td {
  background: rgba(241, 245, 249, 0.9);
}

.subbox {
  padding: 12px 4px 4px;
}

.linkbtn {
  background: none;
  border: none;
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
}

.linkbtn:hover {
  background: var(--accent-dim);
  color: #7dd3fc;
}

.linkbtn.danger {
  color: var(--danger);
}

.linkbtn.danger:hover {
  background: var(--danger-bg);
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.empty-state strong {
  display: block;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-size: 1rem;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-role-superadmin {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.badge-role-admin {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-role-group-admin {
  background: rgba(167, 139, 250, 0.12);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.badge-role-user {
  background: rgba(125, 143, 163, 0.15);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.badge-off {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.badge-warn {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.pill {
  display: inline-block;
  margin-left: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(125, 143, 163, 0.12);
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.role-select {
  min-width: 150px;
  padding: 8px 10px;
  font-size: 0.88rem;
}

.error {
  color: #fecaca;
  font-size: 0.9rem;
}

.msg {
  min-height: 1.2em;
  margin-top: 12px;
  font-size: 0.88rem;
}

.msg.ok {
  color: var(--success);
}

.msg.err {
  color: var(--danger);
}

.loading-line {
  color: var(--muted);
  padding: 20px;
  text-align: center;
  font-size: 0.9rem;
}

/* 用户管理表：紧凑模式，减少换行与行高 */
.data--users-compact thead th,
.data--users-compact tbody td {
  padding: 8px 10px;
}

.data--users-compact {
  font-size: 0.84rem;
}

.data--users-compact .badge {
  white-space: nowrap;
  padding: 2px 8px;
  font-size: 0.72rem;
}

.data--users-compact .table-actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.data--users-compact .linkbtn {
  padding: 4px 6px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.users-cell-ellipsis {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.users-cell-ellipsis--email {
  max-width: 220px;
}

.users-cell-ellipsis--time {
  max-width: 150px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.category-pill--blue { background: rgba(59, 130, 246, 0.16); color: #60a5fa; border-color: rgba(59, 130, 246, 0.45); }
.category-pill--cyan { background: rgba(6, 182, 212, 0.16); color: #22d3ee; border-color: rgba(6, 182, 212, 0.45); }
.category-pill--teal { background: rgba(20, 184, 166, 0.16); color: #2dd4bf; border-color: rgba(20, 184, 166, 0.45); }
.category-pill--green { background: rgba(34, 197, 94, 0.16); color: #4ade80; border-color: rgba(34, 197, 94, 0.45); }
.category-pill--lime { background: rgba(132, 204, 22, 0.16); color: #a3e635; border-color: rgba(132, 204, 22, 0.45); }
.category-pill--amber { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border-color: rgba(245, 158, 11, 0.45); }
.category-pill--orange { background: rgba(249, 115, 22, 0.16); color: #fb923c; border-color: rgba(249, 115, 22, 0.45); }
.category-pill--red { background: rgba(239, 68, 68, 0.16); color: #f87171; border-color: rgba(239, 68, 68, 0.45); }
.category-pill--rose { background: rgba(244, 63, 94, 0.16); color: #fb7185; border-color: rgba(244, 63, 94, 0.45); }
.category-pill--purple { background: rgba(168, 85, 247, 0.16); color: #c084fc; border-color: rgba(168, 85, 247, 0.45); }
.category-pill--slate { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; border-color: rgba(100, 116, 139, 0.45); }

[data-theme="light"] .category-pill--blue { color: #1d4ed8; }
[data-theme="light"] .category-pill--cyan { color: #0e7490; }
[data-theme="light"] .category-pill--teal { color: #0f766e; }
[data-theme="light"] .category-pill--green { color: #15803d; }
[data-theme="light"] .category-pill--lime { color: #4d7c0f; }
[data-theme="light"] .category-pill--amber { color: #b45309; }
[data-theme="light"] .category-pill--orange { color: #c2410c; }
[data-theme="light"] .category-pill--red { color: #b91c1c; }
[data-theme="light"] .category-pill--rose { color: #be123c; }
[data-theme="light"] .category-pill--purple { color: #7e22ce; }
[data-theme="light"] .category-pill--slate { color: #334155; }

.cat-color-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  flex-shrink: 0;
}

.category-color-dot--blue { background: #3b82f6; }
.category-color-dot--cyan { background: #06b6d4; }
.category-color-dot--teal { background: #14b8a6; }
.category-color-dot--green { background: #22c55e; }
.category-color-dot--lime { background: #84cc16; }
.category-color-dot--amber { background: #f59e0b; }
.category-color-dot--orange { background: #f97316; }
.category-color-dot--red { background: #ef4444; }
.category-color-dot--rose { background: #f43f5e; }
.category-color-dot--purple { background: #a855f7; }
.category-color-dot--slate { background: #64748b; }
