/* ------------------------------------------------------------------
   软件库 · 公共样式
   ------------------------------------------------------------------ */

:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --bg-soft: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9edf3;
  --text: #131923;
  --text-soft: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --border: #e3e7ee;
  --border-strong: #cfd6e2;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff5ff;
  --primary-ring: rgba(37, 99, 235, 0.16);
  --success: #0f9f6e;
  --success-soft: #e8f8f1;
  --warning: #b54708;
  --warning-soft: #fff4e5;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 2px 6px rgba(16, 24, 40, 0.05), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 18px 40px -18px rgba(16, 24, 40, 0.22), 0 4px 10px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 32px 64px -20px rgba(16, 24, 40, 0.28);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --header-height: 64px;
}

@media (prefers-color-scheme: dark) {
  .brand-logo,
  .auth-logo {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09), 0 6px 14px -6px rgba(0, 0, 0, 0.8);
  }

  :root {
    color-scheme: dark;
    --bg: #0b0f16;
    --bg-soft: #0f1520;
    --surface: #141b26;
    --surface-2: #1a2331;
    --surface-3: #212c3d;
    --text: #e9eef7;
    --text-soft: #c7d0de;
    --muted: #97a3b6;
    --muted-2: #75839a;
    --border: #242f40;
    --border-strong: #354258;
    --primary: #4f8cff;
    --primary-hover: #6ba0ff;
    --primary-soft: rgba(79, 140, 255, 0.12);
    --primary-ring: rgba(79, 140, 255, 0.24);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.12);
    --warning: #fdb022;
    --warning-soft: rgba(253, 176, 34, 0.12);
    --danger: #f97066;
    --danger-soft: rgba(249, 112, 102, 0.12);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 18px 44px -18px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 32px 64px -20px rgba(0, 0, 0, 0.8);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1 0 auto;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

img,
svg {
  display: block;
}

::selection {
  background: var(--primary);
  color: #fff;
}

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

.container {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.btn-block {
  width: 100%;
}

.text-right {
  text-align: right;
}

.data-table th.text-right {
  text-align: right;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.modal-open {
  overflow: hidden;
}

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

/* ---------------------------- 顶栏 ---------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.header-inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.005em;
  border-radius: 10px;
}

.brand-logo {
  width: 48px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  flex: none;
  background: transparent;
  box-shadow: 0 6px 14px -6px rgba(16, 24, 40, 0.6);
}

.brand-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link svg {
  width: 16px;
  height: 16px;
}

/* ---------------------------- 首页 ---------------------------- */

.hero {
  position: relative;
  padding: 68px 0 36px;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -64px 0 auto;
  height: 380px;
  background:
    radial-gradient(52% 62% at 50% 0%, rgba(37, 99, 235, 0.09), transparent 70%),
    radial-gradient(30% 40% at 82% 12%, rgba(139, 92, 246, 0.07), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 7px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-xs);
}

.hero-eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.hero-title {
  font-size: clamp(32px, 4.6vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 750;
}

.hero-sub {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15.5px;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: min(620px, 100%);
  height: 54px;
  margin: 30px auto 0;
  padding: 0 10px 0 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-form:focus-within {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 4px var(--primary-ring), var(--shadow-sm);
}

.search-icon {
  color: var(--muted-2);
  flex: none;
}

.search-icon svg {
  width: 20px;
  height: 20px;
}

.search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
}

.search-input::placeholder {
  color: var(--muted-2);
}

.search-input::-webkit-search-cancel-button {
  display: none;
  appearance: none;
}

.search-hint {
  flex: none;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
}

.search-clear {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--muted);
  flex: none;
}

.search-clear:hover {
  background: var(--surface-2);
  color: var(--text);
}

.search-clear svg {
  width: 16px;
  height: 16px;
}

/* ---------------------------- 工具栏 ---------------------------- */

.browse {
  padding-bottom: 72px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
  margin: -2px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-sm);
}

.chip-count {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  opacity: 0.62;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.result-count {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select-wrap svg {
  position: absolute;
  right: 9px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}

.sort-select {
  appearance: none;
  height: 34px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
}

.sort-select:hover {
  border-color: var(--border-strong);
}

/* ---------------------------- 软件卡片 ---------------------------- */

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: card-in 0.34s ease;
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

@keyframes card-in {
  from {
    transform: translateY(6px);
  }
  to {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-card {
    animation: none;
  }
}

.card-link {
  display: flex;
  gap: 14px;
  min-width: 0;
  padding-bottom: 15px;
  border-radius: 10px;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: none;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 8px 18px -10px rgba(16, 24, 40, 0.5);
  user-select: none;
}

.tone-0 { background: linear-gradient(145deg, #4f8dff, #2158d8); }
.tone-1 { background: linear-gradient(145deg, #a78bfa, #6d28d9); }
.tone-2 { background: linear-gradient(145deg, #34d399, #059669); }
.tone-3 { background: linear-gradient(145deg, #fbbf24, #d97706); }
.tone-4 { background: linear-gradient(145deg, #fb7185, #e11d48); }
.tone-5 { background: linear-gradient(145deg, #22d3ee, #0891b2); }
.tone-6 { background: linear-gradient(145deg, #818cf8, #4f46e5); }
.tone-7 { background: linear-gradient(145deg, #2dd4bf, #0d9488); }

.app-body {
  min-width: 0;
  flex: 1;
}

.app-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version {
  flex: none;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.5;
}

.app-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 5px;
  min-height: 42px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.62;
}

.app-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.tag {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted-2);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta .meta-cat {
  color: var(--muted);
  font-weight: 500;
}

.meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
  opacity: 0.55;
  flex: none;
}

/* ---------------------------- 按钮 ---------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease,
    transform 0.12s ease, box-shadow 0.16s ease;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, 0.8);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-soft {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

.btn-soft:hover {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 86%, #000);
}

.btn-sm {
  height: 33px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
}

.btn-sm svg {
  width: 15px;
  height: 15px;
}

.btn-lg {
  height: 46px;
  padding: 0 22px;
  border-radius: 12px;
  font-size: 14.5px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  color: var(--muted);
}

.btn-icon:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-icon.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

/* ---------------------------- 空状态 / 骨架屏 ---------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--muted);
}

.empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty-title {
  font-size: 16px;
  font-weight: 650;
}

.empty-desc {
  max-width: 340px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.skeleton-card {
  height: 176px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  position: relative;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-2) 80%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.error-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border));
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.55;
}

.error-box svg {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 1px;
}

/* ---------------------------- 详情页 ---------------------------- */

.detail-main {
  padding: 34px 0 80px;
}

.detail-container {
  width: min(880px, calc(100% - 48px));
  margin-inline: auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
}

.back-link:hover {
  color: var(--text);
}

.back-link svg {
  width: 15px;
  height: 15px;
}

.detail-card {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.app-icon-lg {
  width: 82px;
  height: 82px;
  border-radius: 20px;
  font-size: 32px;
}

.detail-heading {
  flex: 1;
  min-width: 0;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-title {
  font-size: clamp(23px, 3vw, 30px);
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.detail-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 0;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.detail-meta + .detail-meta::before {
  content: "·";
  margin: 0 8px;
  color: var(--muted-2);
}

.detail-head .btn {
  flex: none;
  margin-left: auto;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.detail-divider {
  height: 1px;
  margin: 26px 0;
  background: var(--border);
}

.detail-section + .detail-section {
  margin-top: 26px;
}

.detail-section h2 {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.detail-desc {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.file-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 1px;
  border-radius: 12px;
  background: var(--border);
  overflow: hidden;
}

.file-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  background: var(--surface);
}

.file-row dt {
  color: var(--muted);
  font-size: 12.5px;
  flex: none;
}

.file-row dd {
  margin: 0;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.detail-note svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
}

.detail-skeleton {
  height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------------------------- 页脚 ---------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 34px;
  color: var(--muted-2);
  font-size: 12px;
}

.footer-inner .brand-name {
  font-size: 13.5px;
  color: var(--text-soft);
}

.footer-note {
  display: flex;
  align-items: center;
  gap: 7px;
}

.footer-note svg {
  width: 13px;
  height: 13px;
}

/* ---------------------------- 登录页 ---------------------------- */

.admin-page {
  background:
    radial-gradient(46% 40% at 50% 0%, rgba(37, 99, 235, 0.11), transparent 72%),
    radial-gradient(40% 40% at 88% 12%, rgba(139, 92, 246, 0.08), transparent 72%),
    var(--bg);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-card {
  width: min(400px, 100%);
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
}

.auth-logo {
  width: 64px;
  height: 53px;
  border-radius: 13px;
  margin-bottom: 14px;
  object-fit: contain;
  background: transparent;
  box-shadow: 0 10px 24px -10px rgba(16, 24, 40, 0.65);
}

.auth-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 12.5px;
}

.auth-footer a {
  color: var(--muted);
}

.auth-footer a:hover {
  color: var(--text);
}

.auth-copyright {
  margin-top: 24px;
  color: var(--muted-2);
  font-size: 11.5px;
}

/* ---------------------------- 表单控件 ---------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 2px;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 550;
}

.field-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.field-hint {
  margin-left: auto;
  padding-left: 8px;
  color: var(--muted-2);
  font-size: 11.5px;
  font-weight: 400;
}

.input,
.textarea,
.select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  outline: 0;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.textarea {
  height: auto;
  min-height: 118px;
  padding: 10px 12px;
  line-height: 1.65;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-2);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 18px, calc(100% - 10px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
  cursor: pointer;
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.input-icon-wrap .input {
  padding-left: 36px;
}

/* 分类选择：可手动输入，也可从已有分类中选择 */
.combo {
  position: relative;
}

.combo-input {
  padding-right: 38px;
}

.combo-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 0 9px 9px 0;
  color: var(--muted);
  transition: color 0.16s ease, background 0.16s ease;
}

.combo-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.combo-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.16s ease;
}

.combo.is-open .combo-toggle svg {
  transform: rotate(180deg);
}

.combo-list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 224px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.combo-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-soft);
  font-size: 13px;
  text-align: left;
}

.combo-option:hover,
.combo-option.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.combo-option-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-option-count {
  flex: none;
  color: var(--muted-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.combo-option.is-new {
  color: var(--primary);
  font-weight: 550;
}

.combo-option.is-new svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.combo-option-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.combo-empty {
  padding: 9px 10px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.6;
}

/* ---------------------------- 管理后台 ---------------------------- */

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.admin-topbar-inner {
  width: min(1180px, calc(100% - 48px));
  height: 62px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-badge {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-actions .nav-link {
  height: 34px;
  font-size: 12.5px;
}

.admin-wrap {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
  padding: 32px 0 72px;
}

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.admin-head h1 {
  font-size: 26px;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.admin-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.admin-head .btn {
  flex: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  flex: none;
}

.stat-icon svg {
  width: 18px;
  height: 18px;
}

.stat-icon.accent {
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon.success {
  background: var(--success-soft);
  color: var(--success);
}

.stat-icon.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.stat-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

.stat-value {
  margin-top: 2px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 650;
}

.panel-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-tools .input-icon-wrap {
  width: 220px;
}

.panel-tools .input {
  height: 36px;
  font-size: 12.5px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background 0.14s ease;
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}

.cell-app {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.cell-app .app-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 15px;
}

.cell-app-text {
  min-width: 0;
}

.cell-app-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-app-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-muted {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cell-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 550;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-neutral {
  background: var(--surface-2);
  color: var(--muted);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.admin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 58px 24px;
  text-align: center;
}

.admin-empty .empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
}

.admin-empty .empty-title {
  font-size: 14px;
}

.admin-empty .empty-desc {
  font-size: 12.5px;
}

/* ---------------------------- 弹窗 ---------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 24, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.18s ease both;
}

.modal-card {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  overflow: hidden;
}

.modal-card.modal-sm {
  width: min(440px, 100%);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}

.modal-head h2 {
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.015em;
}

.modal-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  color: var(--muted);
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 22px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 40%, transparent);
}

.modal-foot .btn {
  height: 38px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.form-grid .field-full {
  grid-column: 1 / -1;
}

.modal-error {
  margin-bottom: 14px;
}

/* 文件拖放区 */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 26px 18px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-xs);
}

.dropzone-icon svg {
  width: 19px;
  height: 19px;
}

.dropzone-title {
  font-size: 13px;
  font-weight: 550;
}

.dropzone-title strong {
  color: var(--primary);
  font-weight: 600;
}

.dropzone-hint {
  color: var(--muted-2);
  font-size: 11.5px;
}

.file-chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}

.file-chosen-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}

.file-chosen-icon svg {
  width: 15px;
  height: 15px;
}

.file-chosen-text {
  min-width: 0;
  flex: 1;
}

.file-chosen-name {
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-chosen-size {
  color: var(--muted-2);
  font-size: 11px;
}

.file-remove {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--muted);
  flex: none;
}

.file-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.file-remove svg {
  width: 14px;
  height: 14px;
}

/* 上传进度 */

.progress-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.progress-native {
  flex: 1;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-native::-webkit-progress-bar {
  background: var(--surface-2);
  border-radius: 999px;
}

.progress-native::-webkit-progress-value {
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.progress-native::-moz-progress-bar {
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 999px;
}

.progress-text {
  width: 82px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* 确认弹窗 */

.confirm-body {
  padding: 4px 22px 22px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

.confirm-body strong {
  color: var(--text);
  font-weight: 600;
}

/* Toast */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 40px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.toast-success svg {
  color: var(--success);
}

.toast-error svg {
  color: var(--danger);
}

/* ---------------------------- 响应式 ---------------------------- */

@media (max-width: 960px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .container,
  .detail-container,
  .admin-wrap,
  .admin-topbar-inner {
    width: calc(100% - 32px);
  }

  .hero {
    padding: 44px 0 28px;
  }

  .hero-sub {
    font-size: 14px;
  }

  .search-form {
    height: 50px;
    margin-top: 24px;
    border-radius: 14px;
  }

  .search-hint {
    display: none;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .toolbar-right {
    justify-content: space-between;
  }

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

  .detail-card {
    padding: 22px;
  }

  .detail-head {
    flex-wrap: wrap;
  }

  .detail-head .btn {
    width: 100%;
    margin-left: 0;
    order: 5;
  }

  .detail-title {
    font-size: 23px;
  }

  .app-icon-lg {
    width: 66px;
    height: 66px;
    border-radius: 17px;
    font-size: 26px;
  }

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

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .admin-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-head .btn {
    width: 100%;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-tools .input-icon-wrap {
    width: 100%;
  }

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

  .modal {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-card {
    max-height: calc(100vh - 24px);
    border-radius: 16px;
  }

  .auth-card {
    padding: 26px 22px;
  }

  .header-nav .nav-label {
    display: none;
  }

  .nav-link {
    padding: 0 9px;
  }
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
  }

  .stat-value {
    font-size: 17px;
  }

  .data-table {
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    padding: 0;
    border: 0;
  }

  .data-table td.cell-hide-mobile {
    display: none;
  }

  .data-table td.cell-actions {
    margin-top: 10px;
    justify-content: flex-start;
  }

  .data-table td.cell-actions .btn-icon {
    border: 1px solid var(--border);
  }

  .cell-app-name {
    font-size: 13.5px;
  }

  .topbar-actions .nav-link span {
    display: none;
  }

  .admin-topbar-inner {
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
