/* =========================================================
   LabCTO · 后台
   ========================================================= */

body.admin-body {
  background: var(--bg-subtle);
  font-size: 14px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- 侧边栏 ---------- */
.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  background:
    radial-gradient(600px 300px at 0% 0%, rgba(37, 99, 235, 0.24), transparent 60%),
    linear-gradient(180deg, #0b1220 0%, #0d1526 60%, #0a1120 100%);
  color: #cbd5e1;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 20px;
  color: #f1f5f9;
}

.admin-brand:hover { color: #fff; }

.admin-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.admin-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.admin-brand-text strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.admin-brand-text span {
  font-size: 10px;
  color: #64748b;
  letter-spacing: 0.1em;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}

.admin-nav__label {
  padding: 16px 10px 6px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #475569;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s var(--ease);
  /* 菜单项一律单行，长名字不换行 */
  white-space: nowrap;
  overflow: hidden;
}

.admin-nav a .icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

.admin-nav a:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.1);
}

.admin-nav a.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.28), rgba(59, 130, 246, 0.06));
  box-shadow: inset 2px 0 0 #3b82f6;
}

.admin-nav a.is-active .icon { opacity: 1; color: #60a5fa; }

.admin-nav .nav-badge {
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
  font-size: 10px;
  font-weight: 600;
}

.admin-nav .nav-badge--warn { background: rgba(217, 119, 6, 0.2); color: var(--warning); }

/* ---------- 一级菜单 + 二级空间列表 ---------- */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-group + .nav-group { margin-top: 4px; }

.nav-group__head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-group__head > a {
  flex: 1;
  min-width: 0;
}

/* 带二级菜单的一级标题：整行是折叠/展开开关，不跳转 */
.nav-group__toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.nav-group__toggle:hover { color: #e2e8f0; background: rgba(148, 163, 184, 0.1); }

.nav-group__toggle.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0.04));
}

.nav-group__toggle .icon {
  flex: none;
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

.nav-group__toggle.is-active .icon { opacity: 1; color: #60a5fa; }

.nav-group__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-group__toggle .nav-caret {
  width: 13px;
  height: 13px;
  opacity: 0.5;
  transition: transform 0.18s var(--ease);
}

.nav-group.is-collapsed .nav-caret { transform: rotate(-90deg); }
.nav-group.is-collapsed .nav-sub { display: none; }

/* 一级标题右侧的「新建」文字按钮：常态低调，悬停才亮 */
.nav-add {
  flex: none;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  background: transparent;
  color: #7b8ca4;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.6;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.nav-add:hover {
  color: #dbeafe;
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(59, 130, 246, 0.16);
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 6px 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(148, 163, 184, 0.14);
}

.nav-sub a {
  padding: 5px 8px;
  gap: 8px;
  border-radius: 6px;
  color: #8496ad;
  font-size: 12.5px;
  font-weight: 500;
}

.nav-sub a:hover { color: #e2e8f0; background: rgba(148, 163, 184, 0.1); }

.nav-sub a.is-active {
  color: #fff;
  background: rgba(59, 130, 246, 0.18);
  box-shadow: none;
}

.nav-sub__dot {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3b82f6;
}

.nav-sub__dot[data-tone="teal"] { background: #14b8a6; }
.nav-sub__dot[data-tone="green"] { background: #22c55e; }
.nav-sub__dot[data-tone="violet"] { background: #8b5cf6; }
.nav-sub__dot[data-tone="amber"] { background: #f59e0b; }
.nav-sub__dot[data-tone="rose"] { background: #f43f5e; }
.nav-sub__dot[data-tone="slate"] { background: #94a3b8; }

.nav-sub__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 2px;
  margin-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.admin-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(145deg, #3b82f6, #0e7490);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.admin-user-info {
  min-width: 0;
  flex: 1;
}

.admin-user-info strong {
  display: block;
  font-size: 12.5px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-info span {
  font-size: 10.5px;
  color: #64748b;
}

.admin-user form { display: inline-flex; }

.admin-user button {
  border: 0;
  background: transparent;
  color: #64748b;
  padding: 4px;
  border-radius: 6px;
}

.admin-user button:hover { color: #f87171; background: rgba(248, 113, 113, 0.1); }

/* ---------- 主区域 ---------- */
.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.admin-topbar h1 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.admin-topbar .crumbs {
  font-size: 12px;
  color: var(--text-faint);
}

.admin-topbar .spacer { flex: 1; }

.admin-content {
  padding: 28px 32px 64px;
  max-width: 1440px;
  width: 100%;
}

/* ---------- 卡片 ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.card-head h2 {
  font-size: 13.5px;
  font-weight: 650;
}

.card-head .spacer { flex: 1; }

.card-body { padding: 18px; }
.card-body--flush { padding: 0; }

.card-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
}

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--brand-soft);
  opacity: 0.7;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-faint);
}

.stat-value {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-foot {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-faint);
}

/* ---------- 表格 ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-subtle); }

.data-table .title-cell {
  font-weight: 550;
  color: var(--text);
}

.data-table .title-cell:hover { color: var(--brand); }

.data-table .actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

.data-table .actions form { display: inline-flex; }

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  transition: all 0.15s var(--ease);
}

.row-actions:hover {
  background: var(--bg-sunken);
  color: var(--text);
}

.row-actions.danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.row-actions .icon { width: 15px; height: 15px; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .spacer { flex: 1; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}

.segmented a {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.segmented a:hover { color: var(--text); }

.segmented a.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* ---------- 提示条 ---------- */
.flash {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  margin-bottom: 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--bg-elevated);
  animation: fade-up 0.2s var(--ease);
}

.flash--success {
  border-color: rgba(5, 150, 105, 0.25);
  background: rgba(5, 150, 105, 0.07);
  color: var(--success);
}

.flash--error {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.06);
  color: var(--danger);
}

/* ---------- 登录 / 注册 ---------- */
body.auth-body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}

.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 44px 56px 36px;
  color: #eaf1ff;
  background:
    radial-gradient(900px 520px at 12% 0%, rgba(37, 99, 235, 0.5), transparent 62%),
    radial-gradient(720px 460px at 100% 82%, rgba(8, 145, 178, 0.3), transparent 60%),
    linear-gradient(150deg, #07101f 0%, #0c1a2f 46%, #0a2540 100%);
}

.auth-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 58px 58px;
  -webkit-mask-image: radial-gradient(80% 70% at 30% 30%, #000 20%, transparent 100%);
  mask-image: radial-gradient(80% 70% at 30% 30%, #000 20%, transparent 100%);
  pointer-events: none;
}

.auth-aside::after {
  content: "";
  position: absolute;
  right: -140px;
  bottom: -180px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, 0.18);
  box-shadow: 0 0 0 60px rgba(125, 211, 252, 0.04), 0 0 0 120px rgba(125, 211, 252, 0.025);
  pointer-events: none;
}

.auth-aside__brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  color: #fff;
}

.auth-aside__brand .brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(140deg, #3b82f6, #0891b2);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.38);
  color: #fff;
}

.auth-aside__brand .brand-mark .icon { width: 22px; height: 22px; }

.auth-aside__brandtext { display: flex; flex-direction: column; line-height: 1.15; }
.auth-aside__brandtext strong { font-size: 17px; letter-spacing: -0.01em; }

.auth-aside__brandtext small {
  margin-top: 2px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(226, 236, 255, 0.55);
}

.auth-aside__body {
  position: relative;
  z-index: 1;
  margin: auto 0;
  padding: 46px 0;
  max-width: 570px;
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.auth-eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.auth-aside h1 {
  margin: 20px 0 18px;
  font-size: clamp(36px, 3.4vw, 56px);
  line-height: 1.12;
  letter-spacing: -0.045em;
  color: #fff;
}

.auth-lede {
  max-width: 480px;
  font-size: 15px;
  line-height: 1.85;
  color: rgba(226, 236, 255, 0.72);
}

.auth-features {
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
  display: grid;
  gap: 11px;
  max-width: 500px;
}

.auth-features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(6px);
}

.auth-feature__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

.auth-feature__icon .icon { width: 17px; height: 17px; }

.auth-features strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13.5px;
  color: #f1f5ff;
}

.auth-features div > span {
  display: block;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(226, 236, 255, 0.6);
}

.auth-aside__foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-stats { display: flex; flex-wrap: wrap; gap: 34px; }

.auth-stats strong {
  display: block;
  font-size: 24px;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.auth-stats span { font-size: 11.5px; color: rgba(226, 236, 255, 0.55); }

.auth-aside__foot p {
  margin: 0;
  font-size: 11px;
  color: rgba(226, 236, 255, 0.38);
}

.auth-main {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 72px 56px;
  background:
    radial-gradient(620px 420px at 100% 0%, var(--brand-soft), transparent 62%),
    var(--bg-elevated);
}

.auth-main__back {
  position: absolute;
  top: 30px;
  right: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.auth-main__back .icon { width: 14px; height: 14px; }
.auth-main__back:hover { color: var(--brand); }

.auth-main__inner {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-card--wide { max-width: 520px; }

.auth-main .auth-brand { display: none; }

.auth-card h1 {
  font-size: 30px;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.auth-card .sub {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-form .field { gap: 7px; }
.auth-form .field > label { font-size: 13px; font-weight: 550; }

.auth-form .input {
  height: 46px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 14.5px;
}

.auth-form .select { height: 46px; }

.auth-form .btn {
  height: 46px;
  margin-top: 6px;
  font-size: 14.5px;
  border-radius: 9px;
}

.auth-form .help { margin: 0; font-size: 11.5px; }

.auth-hint {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.7;
}

.auth-hint a { color: var(--brand); }

.auth-back {
  display: none;
  justify-content: center;
  margin-top: 20px;
  font-size: 12.5px;
}

.auth-form .check {
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-muted);
}

.auth-form .check input { margin-top: 3px; }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }

  .auth-main {
    min-height: 100vh;
    padding: 64px 24px 40px;
    background:
      radial-gradient(720px 420px at 20% 0%, rgba(37, 99, 235, 0.12), transparent 60%),
      radial-gradient(560px 340px at 90% 18%, rgba(8, 145, 178, 0.1), transparent 60%),
      var(--bg-subtle);
  }

  .auth-main__back { display: none; }

  .auth-main__inner { max-width: 480px; }

  .auth-card,
  .auth-card--wide {
    max-width: 460px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
  }

  .auth-main .auth-brand { display: flex; margin-bottom: 22px; }

  .auth-main .auth-brand .brand-mark {
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand);
  }

  .auth-main .auth-brand .brand-text strong { color: var(--text); }
  .auth-main .auth-brand .brand-text span { color: var(--text-faint); }

  .auth-back { display: flex; }
}

[data-theme="dark"] .auth-main {
  background:
    radial-gradient(620px 420px at 100% 0%, rgba(37, 99, 235, 0.12), transparent 62%),
    var(--bg-elevated);
}

@media (max-width: 980px) {
  [data-theme="dark"] .auth-main {
    background:
      radial-gradient(720px 420px at 20% 0%, rgba(59, 130, 246, 0.14), transparent 60%),
      var(--bg-subtle);
  }
}

@media (max-height: 780px) and (min-width: 981px) {
  .auth-aside { padding-top: 34px; padding-bottom: 28px; }
  .auth-aside__body { padding: 26px 0; }
  .auth-aside h1 { font-size: 40px; margin: 16px 0 14px; }
  .auth-features { margin-top: 24px; gap: 8px; }
  .auth-features li { padding: 10px 13px; }
  .auth-stats strong { font-size: 21px; }
}

/* ---------- 编辑器 ---------- */
.editor-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.editor-side .card + .card { margin-top: 14px; }

.editor-main { min-width: 0; }

.editor-title-input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 2px 0;
}

.editor-title-input:focus { outline: none; }

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  position: sticky;
  top: 62px;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.editor-toolbar .spacer { flex: 1; }

.editor-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: calc(100vh - 300px);
}

.editor-split textarea {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 300px);
  border: 0;
  border-right: 1px solid var(--border);
  padding: 20px;
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  resize: none;
}

.editor-split textarea:focus { outline: none; }

.editor-preview {
  padding: 22px 26px;
  overflow-y: auto;
  max-height: calc(100vh - 240px);
  background: var(--bg-elevated);
}

.editor-preview .prose { font-size: 14.5px; }
.editor-preview .prose h2 { margin-top: 28px; font-size: 19px; }

.editor-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.editor-meta-grid .full { grid-column: 1 / -1; }

.editor-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.editor-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.editor-status .dot.draft { background: var(--warning); }

/* ---------- 目录管理 ---------- */
.tree-admin {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-admin ul {
  list-style: none;
  margin: 0;
  padding-left: 22px;
  border-left: 1px dashed var(--border-strong);
}

.tree-admin li { position: relative; }

.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13px;
}

.tree-row:hover { background: var(--bg-subtle); }

.tree-row .icon { color: var(--text-faint); width: 15px; height: 15px; }

.tree-row .type-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-sunken);
  color: var(--text-faint);
}

.tree-row .spacer { flex: 1; }

.tree-row .acts {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.tree-row:hover .acts { opacity: 1; }

.tree-row .acts button,
.tree-row .acts a {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 0;
  background: transparent;
  color: var(--text-faint);
}

.tree-row .acts button:hover,
.tree-row .acts a:hover {
  background: var(--bg-sunken);
  color: var(--text);
}

.tree-row .acts .danger:hover { color: var(--danger); }

/* ---------- 设置 ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav a {
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.settings-nav a:hover { background: var(--bg-subtle); color: var(--text); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full { grid-column: 1 / -1; }

.help {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.55;
}

.mono-mask {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ---------- 其他 ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
}

.pagination .pages { display: flex; gap: 4px; }

.pagination a,
.pagination span {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 12px;
}

.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .is-current { background: var(--brand); border-color: var(--brand); color: #fff; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--border) 37%, var(--bg-sunken) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { display: none; }
}

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 80;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.24s var(--ease);
  }
  .admin-shell.nav-open .admin-sidebar { transform: translateX(0); }
  .admin-content { padding: 18px 16px 48px; }
  .admin-topbar { padding: 0 16px; }
  .editor-split { grid-template-columns: minmax(0, 1fr); }
  .editor-split textarea { border-right: 0; border-bottom: 1px solid var(--border); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Users / members ---------- */
.seg-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bg-sunken);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
}

.segmented a.is-active .seg-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

[data-theme="dark"] .segmented a.is-active .seg-count { background: rgba(0, 0, 0, 0.22); color: var(--brand-strong); }

.user-cell { display: flex; align-items: center; gap: 10px; }

.user-cell__main { min-width: 0; }

.avatar-sm {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--brand), #0891b2);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Spaces ---------- */
.space-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.space-admin-card { align-self: start; }

.space-admin-head { display: flex; align-items: center; gap: 12px; }

.space-admin-head .space-icon { margin: 0; flex: none; width: 38px; height: 38px; border-radius: 10px; }

.space-admin-title { min-width: 0; }
.space-admin-title h2 { font-size: 15.5px; letter-spacing: -0.01em; }
.space-admin-title span { display: block; margin-top: 1px; }

.space-admin-desc { margin: 12px 0 0; min-height: 42px; line-height: 1.65; }

.space-admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-faint);
}

.space-admin-stats strong { color: var(--text-soft); font-weight: 600; font-variant-numeric: tabular-nums; }

.space-icon--teal { background: rgba(8, 145, 178, 0.1); color: var(--accent); }
.space-icon--violet { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
.space-icon--amber { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.space-icon--rose { background: rgba(225, 29, 72, 0.1); color: #e11d48; }
.space-icon--slate { background: var(--bg-sunken); color: var(--text-muted); }

[data-theme="dark"] .space-icon--violet { color: #c4b5fd; }
[data-theme="dark"] .space-icon--rose { color: #fda4af; }

.space-admin-card--new {
  border-style: dashed;
  background: var(--bg-subtle);
}

.inline-details > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details > summary .icon { width: 15px; height: 15px; }
.inline-details[open] > summary { color: var(--brand); }

/* ---------- Master-detail (tags) ---------- */
.master-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.master-detail__side { position: sticky; top: 84px; }

.data-table tr.is-editing { background: var(--brand-soft); }

.tag-badge { font-size: 12px; padding: 3px 10px; }

/* ---------- Feedback ---------- */
.feedback-content {
  margin: 0;
  max-width: 560px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.feedback-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.feedback-meta a { display: inline-flex; align-items: center; gap: 4px; }
.feedback-meta .icon { width: 13px; height: 13px; }

.select--compact {
  height: 30px;
  padding: 2px 26px 2px 8px;
  font-size: 12.5px;
  border-radius: 7px;
}

/* ---------- Media library ---------- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.media-card { overflow: hidden; }

.media-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(45deg, var(--bg-sunken) 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, var(--bg-sunken) 25%, transparent 25%) 0 8px / 16px 16px,
    var(--bg-subtle);
}

.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s var(--ease); }
.media-thumb:hover img { transform: scale(1.03); }

.media-meta { padding: 10px 12px 11px; border-top: 1px solid var(--border); }

.media-name {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}

.media-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; }
.media-actions .btn { padding: 4px 8px; font-size: 11.5px; }

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--bg-sunken);
  color: var(--text-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Logs ---------- */
.chip-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.chip-filter .badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
  transition: all 0.15s var(--ease);
}

.chip-filter .badge:hover { border-color: var(--brand); color: var(--brand); }
.chip-filter .badge.is-active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.chip-count { margin-left: 4px; font-size: 10.5px; opacity: 0.7; }

.search-log-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.hit-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-sunken);
  overflow: hidden;
}

.hit-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #22d3ee);
}

.recent-search { list-style: none; margin: 0; padding: 0; }

.recent-search li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.recent-search li:last-child { border-bottom: 0; }
.recent-search__kw { font-weight: 500; color: var(--text-soft); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1080px) {
  .space-admin-grid { grid-template-columns: minmax(0, 1fr); }
  .master-detail { grid-template-columns: minmax(0, 1fr); }
  .master-detail__side { position: static; }
  .search-log-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .admin-topbar h1 { font-size: 15px; }
  .admin-topbar .btn-secondary { display: none; }
  .toolbar { gap: 8px; }
  .toolbar form { flex-wrap: wrap; width: 100%; }
  .toolbar form .input { flex: 1 1 140px; width: auto !important; min-width: 0; }
  .toolbar form .select { flex: 0 0 auto; }
  .toolbar .spacer { display: none; }
  .segmented { max-width: 100%; overflow-x: auto; }
  .admin-body .data-table { min-width: 0; }

  /* 移动端只保留关键列，避免表格被压成竖排文字 */
  .admin-docs .data-table :is(th, td):nth-child(2),
  .admin-docs .data-table :is(th, td):nth-child(4),
  .admin-docs .data-table :is(th, td):nth-child(5),
  .admin-docs .data-table :is(th, td):nth-child(6),
  .admin-users .data-table :is(th, td):nth-child(2),
  .admin-users .data-table :is(th, td):nth-child(4),
  .admin-users .data-table :is(th, td):nth-child(5),
  .admin-feedback .data-table :is(th, td):nth-child(2),
  .admin-feedback .data-table :is(th, td):nth-child(4),
  .admin-trash .data-table :is(th, td):nth-child(2),
  .admin-trash .data-table :is(th, td):nth-child(3),
  .admin-logs-audit .data-table :is(th, td):nth-child(4),
  .admin-logs-audit .data-table :is(th, td):nth-child(5),
  .admin-logs-audit .data-table :is(th, td):nth-child(6),
  .admin-logs-search .data-table :is(th, td):nth-child(2),
  .admin-logs-search .data-table :is(th, td):nth-child(5),
  .admin-tags .data-table :is(th, td):nth-child(2),
  .admin-tags .data-table :is(th, td):nth-child(3) {
    display: none;
  }

  .admin-body .data-table .title-cell,
  .admin-body .data-table .feedback-content { word-break: break-word; }

  .admin-body .data-table th,
  .admin-body .data-table td { padding-left: 10px; padding-right: 10px; }
  .admin-body .data-table .badge { white-space: nowrap; }
  .admin-body .data-table .actions { gap: 2px; }
  .admin-body .data-table .row-actions { width: 24px; height: 24px; }

  .admin-docs .data-table .actions a[title="版本历史"],
  .admin-docs .data-table .actions form:first-of-type,
  .admin-users .data-table .actions form:nth-child(2),
  .admin-users .data-table .actions form:nth-child(3) {
    display: none;
  }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* =========================================================
   后台布局升级 v2：更宽的工作区 / 更现代的卡片与表格
   ========================================================= */

/* 工作区居中，超宽屏不再紧贴左侧 */
.admin-content {
  margin-inline: auto;
}

/* 顶栏：更轻盈的分隔与标题层级 */
.admin-topbar h1 {
  font-size: 16.5px;
  font-weight: 680;
  letter-spacing: -0.015em;
}

.admin-topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 1px;
  background: linear-gradient(90deg, var(--brand-ring), transparent 45%);
  opacity: 0.7;
}

/* 卡片：更大圆角 + 柔和投影 + 悬停反馈 */
.card {
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 14px 34px -30px rgba(15, 23, 42, 0.55);
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.card-head {
  padding: 16px 20px;
}

.card-head h2 { font-size: 14px; letter-spacing: -0.01em; }

.card-body { padding: 20px; }

/* 统计卡：悬停微抬升 + 更大字号 */
.stat-card {
  padding: 18px 20px;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 14px 34px -30px rgba(15, 23, 42, 0.55);
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 26%, var(--border));
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 22px 44px -30px rgba(15, 23, 42, 0.6);
}

.stat-value { font-size: 30px; }
.stat-label { font-size: 12.5px; }

/* 表格：更舒展的行高与悬停高亮 */
.admin-body .data-table th { padding: 11px 18px; }
.admin-body .data-table td { padding: 12px 18px; }

.admin-body .data-table tbody tr {
  transition: background 0.14s var(--ease);
}

.admin-body .data-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand-soft) 55%, transparent);
}

.admin-body .data-table tbody tr:last-child td { border-bottom: 0; }

/* 工具条与按钮细节 */
.toolbar { border-radius: 12px; }

.admin-body .btn { border-radius: 9px; }

/* 空状态与提示更柔和 */
.flash {
  border-radius: 12px;
}

/* =========================================================
   弹窗（新建目录 / 新建空间）
   ========================================================= */
body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.16s var(--ease);
}

.modal.is-open .modal__backdrop { opacity: 1; }

.modal__panel {
  position: relative;
  width: min(580px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 64px -12px rgba(15, 23, 42, 0.32), 0 2px 8px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.modal.is-open .modal__panel {
  opacity: 1;
  transform: none;
}

.modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.modal__head h2 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.modal__close {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.modal__close:hover { background: var(--bg-subtle); color: var(--text); }
.modal__close .icon { width: 16px; height: 16px; }

.modal__body { padding: 18px; }
.modal__body .field { gap: 6px; }

.modal__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.modal__foot .spacer { flex: 1; }
.modal__foot .help { margin: 0; }

@media (max-width: 640px) {
  .modal { padding: 12px; }
  .modal__panel { max-height: calc(100vh - 24px); }
  .modal__foot .help { display: none; }
}

/* =========================================================
   后台手机自适应：仪表盘两栏改单栏，表格不再被压成竖排文字
   ========================================================= */

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  /* 标题列占满整行；更新时间让位，否则一列只剩一个字宽 */
  .dash-recent { min-width: 0; }
  .dash-recent :is(th, td):nth-child(3) { display: none; }
  .dash-recent .title-cell { white-space: normal; word-break: break-word; }
  .dash-recent :is(th, td):nth-child(2) { white-space: nowrap; }
  .dash-recent th,
  .dash-recent td { padding-left: 10px; padding-right: 10px; }
  .dash-recent .row-actions { width: 26px; height: 26px; }
}

/* =========================================================
   媒体库瀑布流（2026-11）
   ---------------------------------------------------------
   与前台图片墙同一套视觉：CSS 多栏瀑布流，卡片高度随图走。
   名称是常显输入框（透明无边框，hover/focus 才描边），回车即存。
   ========================================================= */
.media-wall {
  columns: 236px;
  column-gap: 14px;
  margin-bottom: 14px;
}

.media-tile {
  break-inside: avoid;
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.media-tile:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.media-tile__media {
  position: relative;
  display: block;
  background: var(--bg-sunken);
  line-height: 0;
}

.media-tile__media img {
  width: 100%;
  height: auto;
  display: block;
}

.media-tile__cat {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(9, 12, 20, 0.62);
  color: #fff;
  font-size: 11px;
  line-height: 1.5;
  backdrop-filter: blur(2px);
}

.media-tile__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px 10px;
}

.media-tile__name {
  display: flex;
  align-items: center;
  gap: 4px;
}

.media-name-input {
  flex: 1;
  min-width: 0;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.media-name-input:hover {
  border-color: var(--border);
  background: var(--bg-subtle);
}

.media-name-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg-elevated);
}

.media-name-save {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  cursor: pointer;
  /* 常显一点点，让人知道名字能改；hover 卡片时亮起来 */
  opacity: 0.38;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
}

.media-tile:hover .media-name-save,
.media-name-input:focus + .media-name-save {
  opacity: 1;
}

.media-name-save svg { width: 13px; height: 13px; }

.media-tile__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}

.media-tile__actions .btn {
  padding: 3px 6px;
  font-size: 11.5px;
}

@media (max-width: 720px) {
  .media-wall { columns: 168px; column-gap: 10px; }
  .media-tile { margin-bottom: 10px; }
  .media-name-input { font-size: 12.5px; }
}
