/* ==========================================================================
   知识库中心 · 设计系统
   浅色主题 / 蓝青渐变 / 圆角卡片
   ========================================================================== */

:root {
  --bg: #f2f6fc;
  --bg-soft: #e8eefb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-2: #0ea5e9;
  --brand-soft: #eff6ff;
  --ok: #16a34a;
  --ok-soft: #f0fdf4;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 28px -12px rgba(15, 23, 42, .16), 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .28);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
  font-size: 15px;
}

/* 页面背景光晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(37, 99, 235, .14), transparent 70%),
    radial-gradient(760px 380px at 88% 0%, rgba(14, 165, 233, .14), transparent 70%);
  pointer-events: none;
}

img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -.01em; }
p { margin: 0; }

.hidden { display: none !important; }
.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;
}

/* ------------------------------- 顶栏 ------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
}

.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff; font-size: 17px;
  box-shadow: 0 6px 14px -6px rgba(37, 99, 235, .7);
  flex: none;
}
.brand__text { display: block; font-size: 16.5px; line-height: 1.2; letter-spacing: -.02em; }
.brand__sub { display: block; font-size: 9px; color: var(--muted-2); font-weight: 600; letter-spacing: .16em; line-height: 1.25; }

.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.topbar__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: var(--brand-dark); font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}

/* ------------------------------- 按钮 ------------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink-2);
  --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  min-height: 40px;
  border-radius: 11px;
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:focus-visible { outline: 3px solid rgba(37, 99, 235, .3); outline-offset: 2px; }

.btn--primary {
  --btn-bg: linear-gradient(135deg, var(--brand), var(--brand-2));
  --btn-fg: #fff;
  --btn-bd: transparent;
  box-shadow: 0 10px 20px -12px rgba(37, 99, 235, .9);
}
.btn--primary:hover { box-shadow: 0 14px 26px -12px rgba(37, 99, 235, .95); }

.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--muted); }
.btn--ghost:hover { --btn-bg: var(--surface); --btn-bd: var(--line); --btn-fg: var(--ink-2); }

.btn--danger { --btn-fg: var(--danger); --btn-bd: #fecaca; --btn-bg: #fff; }
.btn--danger:hover { --btn-bg: var(--danger-soft); }

.btn--sm { min-height: 32px; padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn--block { width: 100%; }
.btn--icon { padding: 8px; min-height: 34px; width: 34px; }

/* ------------------------------ 用户页 Hero ------------------------------ */
.hero {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(38px, 7vw, 76px) 20px 8px;
  text-align: center;
}

.hero__badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 999px;
  background: rgba(37, 99, 235, .09);
  color: var(--brand-dark);
  font-size: 12.5px; font-weight: 600;
  margin-bottom: 18px;
}
.hero__badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .16); }

.hero__title {
  font-size: clamp(30px, 5.2vw, 46px);
  font-weight: 800;
  letter-spacing: -.03em;
  background: linear-gradient(120deg, #0f172a 30%, #1d4ed8 70%, #0ea5e9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  margin-top: 14px;
  color: var(--muted);
  font-size: clamp(14px, 1.6vw, 16px);
}

/* ------------------------------ 搜索框 ------------------------------ */
.search {
  margin: 26px auto 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 7px 7px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within {
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12), var(--shadow-md);
}
.search__icon { color: var(--muted-2); display: grid; place-items: center; flex: none; }
.search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 16px;
  padding: 10px 4px;
  color: var(--ink);
  background: transparent;
}
.search__input::placeholder { color: var(--muted-2); }
.search__btn { padding: 11px 22px; border-radius: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .7);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all .16s ease;
}
.chip:hover { color: var(--brand-dark); border-color: rgba(37, 99, 235, .4); background: #fff; }

/* ------------------------------ 结果区 ------------------------------ */
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }

.section { margin-top: clamp(30px, 5vw, 52px); }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.section__title { font-size: 19px; font-weight: 700; }
.section__meta { font-size: 13px; color: var(--muted); }
.section__meta strong { color: var(--brand); font-variant-numeric: tabular-nums; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s cubic-bezier(.2, .7, .3, 1), box-shadow .2s, border-color .2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: cardIn .38s cubic-bezier(.2, .7, .3, 1) both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #d7e2f5; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card__head { display: flex; gap: 12px; align-items: flex-start; }
.card__index {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.card__q {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
  word-break: break-word;
}

.card__a {
  color: var(--ink-2);
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__a.is-open { -webkit-line-clamp: unset; line-clamp: unset; display: block; }

.card__more {
  align-self: flex-start;
  border: 0; background: none; padding: 0;
  color: var(--brand); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.card__more:hover { text-decoration: underline; }

.card__img {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: zoom-in;
  position: relative;
}
.card__img img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  transition: transform .35s cubic-bezier(.2, .7, .3, 1);
}
.card__img:hover img { transform: scale(1.03); }

.card__foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted-2);
}
.card__tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px;
}

/* 空态 / 加载 */
.empty, .loader {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty__icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 26px;
  box-shadow: var(--shadow-xs);
}
.empty__title { font-weight: 700; color: var(--ink-2); margin-bottom: 6px; font-size: 16px; }
.empty__desc { font-size: 13.5px; }

.spinner {
  width: 22px; height: 22px; margin: 0 auto 12px;
  border: 2.5px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  height: 190px;
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, #eef2f9 30%, #f8fafc 50%, #eef2f9 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -120% 0; } }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; }
.pager__info { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 图片放大 */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 15, 30, .86);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 24px;
  cursor: zoom-out;
  animation: fadeIn .18s ease;
}
.lightbox img { max-width: min(1100px, 94vw); max-height: 90vh; border-radius: 12px; box-shadow: var(--shadow-lg); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------ 表单 ------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.field__label .req { color: var(--danger); }
.field__hint { font-size: 12px; color: var(--muted-2); }
.field__counter { margin-left: auto; font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.input, .textarea, .select {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 10px 13px;
  transition: border-color .16s, box-shadow .16s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, .7);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, .12);
}
.textarea { resize: vertical; min-height: 132px; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }

/* 上传组件 */
.uploader {
  border: 1.6px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  position: relative;
}
.uploader:hover, .uploader.is-drag {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.uploader__icon { font-size: 22px; color: var(--brand); }
.uploader__title { font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.uploader__hint { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

.uploader__preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.uploader__preview img { width: 100%; max-height: 240px; object-fit: contain; background: #fff; }
.uploader__remove {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: rgba(15, 23, 42, .62);
  color: #fff; font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  backdrop-filter: blur(4px);
}
.uploader__remove:hover { background: var(--danger); }

.progress { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 10px; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .2s; }

/* ------------------------------ 登录页 ------------------------------ */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}
.auth__card {
  width: 100%;
  max-width: 404px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px 32px 28px;
  box-shadow: var(--shadow-lg);
  animation: cardIn .4s cubic-bezier(.2, .7, .3, 1) both;
}
.auth__logo {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  color: #fff; font-size: 24px;
  box-shadow: 0 12px 26px -12px rgba(37, 99, 235, .9);
  margin-bottom: 18px;
}
.auth__title { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.auth__sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.auth__form { margin-top: 24px; }
.auth__foot { margin-top: 18px; text-align: center; font-size: 12.5px; color: var(--muted-2); }

.alert {
  display: none;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 13px;
  border-radius: 11px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.55;
}
.alert.is-show { display: flex; }
.alert--error { background: var(--danger-soft); color: #b91c1c; border: 1px solid #fecaca; }
.alert--ok { background: var(--ok-soft); color: #15803d; border: 1px solid #bbf7d0; }
.alert--info { background: var(--brand-soft); color: #1e40af; border: 1px solid #bfdbfe; }

/* ------------------------------ 后台布局 ------------------------------ */
.admin-shell { max-width: 1320px; margin: 0 auto; padding: 24px 20px 60px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}
.stat__label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat__value.small { font-size: 15px; font-weight: 700; margin-top: 8px; }

.admin-layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff, #fff);
}
.panel__title { font-size: 15.5px; font-weight: 700; }
.panel__body { padding: 20px; }
.panel__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.panel--sticky { position: sticky; top: 84px; }

/* 列表 */
.list { display: flex; flex-direction: column; }
.list-item {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  transition: background .15s;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fafcff; }
.list-item.is-editing { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }

.thumb {
  width: 62px; height: 62px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: grid; place-items: center;
  color: var(--muted-2);
  font-size: 17px;
  flex: none;
  cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb--empty { cursor: default; background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 6px, #f1f5f9 6px, #f1f5f9 12px); }

.list-item__main { min-width: 0; }
.list-item__q {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item__meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted-2); margin-top: 4px;
}
.list-item__meta .has-pic { color: var(--brand); }
.list-item__ops { display: flex; gap: 6px; }

/* ------------------------------ 模态框 ------------------------------ */
.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .16s ease;
}
.modal__card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 26px;
  animation: modalIn .22s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__title { font-size: 17px; font-weight: 700; }
.modal__desc { font-size: 13.5px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ------------------------------ Toast ------------------------------ */
.toasts {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn .24s cubic-bezier(.2, .7, .3, 1) both;
  max-width: min(92vw, 460px);
}
.toast--ok { background: #15803d; }
.toast--error { background: #b91c1c; }
.toast--info { background: #1e40af; }
.toast.is-out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ------------------------------ 页脚 ------------------------------ */
.footer {
  text-align: center;
  padding: 28px 20px 40px;
  color: var(--muted-2);
  font-size: 12.5px;
}
.footer a { color: var(--muted); }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 1024px) {
  .admin-layout { grid-template-columns: 1fr; }
  .panel--sticky { position: static; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar__inner { padding: 10px 14px; }
  .brand__sub { display: none; }
  .container { padding: 0 14px 48px; }
  .hero { padding-top: 32px; }
  .search { padding-left: 14px; border-radius: 16px; }
  .search__btn { padding: 11px 16px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card { padding: 18px 16px 14px; border-radius: 18px; }
  .admin-shell { padding: 16px 12px 40px; }
  .list-item { grid-template-columns: 48px 1fr; }
  .thumb { width: 48px; height: 48px; border-radius: 10px; }
  .list-item__ops { grid-column: 2; justify-content: flex-start; }
  .modal__card { padding: 22px 18px; }
  .auth__card { padding: 26px 20px 22px; }
  .toasts { top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   数据表视图（/table.html）—— 仿「编辑前 N 行」的表格
   ========================================================================== */
.dt-shell { max-width: 1280px; margin: 0 auto; padding: 22px 20px 56px; }

.dt-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.dt-title { font-size: 20px; font-weight: 750; letter-spacing: -.2px; font-family: var(--mono); }
.dt-sub { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.dt-sub strong { color: var(--ink-2); font-weight: 650; }

.dt-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  border-bottom: 0;
  padding: 12px 14px;
}
.dt-search { width: 280px; min-height: 34px; padding: 6px 11px; font-size: 13.5px; }
.dt-plabel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.dt-select { width: auto; min-height: 34px; padding: 5px 8px; font-size: 13.5px; }
.dt-spacer { flex: 1; }
.dt-count { font-size: 12.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.dt-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0;
  overflow: auto;
  max-height: calc(100vh - 250px);
  box-shadow: var(--shadow-sm);
}

.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.dt thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc;
  border-bottom: 1px solid var(--line-strong);
  padding: 10px 12px;
  text-align: left;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
}
.dt tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink-2);
  line-height: 1.55;
}
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tbody tr:hover td { background: #fbfdff; }

.dt-col-id { width: 62px; }
.dt-col-q { width: 26%; }
.dt-col-s { width: 30%; }
.dt-col-pic { width: 190px; }
.dt-col-time { width: 132px; }
.dt-col-op { width: 84px; }

.dt-id { font-family: var(--mono); color: var(--muted-2); font-variant-numeric: tabular-nums; }
.dt-time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* 可编辑单元格：悬停给出暗示 */
.dt-editable { cursor: text; position: relative; }
.dt-editable:hover { background: var(--brand-soft) !important; box-shadow: inset 0 0 0 1px #bfdbfe; }
.dt-cell-s { cursor: pointer; color: var(--muted); }
.dt-cell-s:hover { color: var(--ink-2); }
.dt-editable.is-editing { padding: 4px 6px; background: #fff !important; box-shadow: inset 0 0 0 2px var(--brand); }

.dt-input {
  width: 100%;
  border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--ink);
  padding: 3px 4px;
}

/* 图片列 */
.dt-cell-pic { cursor: pointer; }
.dt-pic { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dt-thumb {
  width: 34px; height: 34px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--line); flex: none; cursor: zoom-in;
}
.dt-plink {
  font-family: var(--mono); font-size: 11px; color: var(--brand);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dt-null { font-family: var(--mono); font-size: 11.5px; color: var(--muted-2); font-style: italic; }
.dt-cell-pic:hover .dt-null { color: var(--brand); }

.dt-op { text-align: right; }
.dt-pager { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; background: var(--surface); }

/* 弹窗加宽（长文本/图片编辑） */
.modal__card--wide { max-width: 720px; }
.dt-picpick { display: flex; gap: 8px; margin-top: 10px; }
.dt-picpreview {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); padding: 10px; text-align: center;
}
.dt-picpreview img { max-width: 100%; max-height: 260px; border-radius: 8px; }

@media (max-width: 860px) {
  .dt-shell { padding: 14px 10px 40px; }
  .dt-search { width: 100%; }
  .dt-toolbar { border-radius: 12px 12px 0 0; }
  .dt-wrap { max-height: none; }
  .dt-col-s, .dt-col-time { display: none; }
  .dt tbody td:nth-child(3), .dt thead th:nth-child(3),
  .dt tbody td:nth-child(5), .dt thead th:nth-child(5),
  .dt tbody td:nth-child(6), .dt thead th:nth-child(6) { display: none; }
}

/* ==========================================================================
   移动端适配（手机浏览器）
   --------------------------------------------------------------------------
   原来顶栏是单行 flex：品牌 + 用户名 + 4 个按钮，在 390px 宽度下总宽远超
   视口，导致整页出现横向滚动、右侧内容被顶出屏幕（“显示不全”）。
   这里让操作按钮独占第二行并按等分网格排列；同时修掉列表搜索框写死 200px、
   弹窗贴边、统计卡片过高等窄屏问题。
   ========================================================================== */

/* 顶栏操作区（桌面端：与其它元素同排） */
.topbar__acts { display: flex; align-items: center; gap: 8px; }

/* 列表搜索框（原为内联 style，改为类以便窄屏覆盖） */
.admin-search { width: 200px; min-height: 34px; padding: 6px 11px; font-size: 13.5px; }

@media (max-width: 700px) {
  /* ---------- 顶栏：两行布局 ---------- */
  .topbar__inner {
    flex-wrap: wrap;
    row-gap: 8px;
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar__spacer { display: none; }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand__logo { width: 30px; height: 30px; border-radius: 9px; }
  .brand__text { font-size: 15px; white-space: nowrap; }
  .brand__sub { display: none; }

  .topbar__user { margin-left: auto; gap: 6px; flex: none; }
  /* 只留头像，用户名在窄屏太占位；头像 title 仍可看全名 */
  .topbar__user > span:not(.topbar__avatar) { display: none; }
  .topbar__avatar { width: 28px; height: 28px; font-size: 12px; }

  /* 操作按钮独占一行，等分列宽，永远不溢出 */
  .topbar__acts {
    flex: 1 0 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 6px;
  }
  .topbar__acts .btn {
    width: 100%;
    min-height: 34px;
    padding: 6px 4px;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---------- 统计卡片：两列 ---------- */
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .stat { padding: 12px 13px; border-radius: 14px; }
  .stat__label { font-size: 11.5px; }
  .stat__value { font-size: 20px; margin-top: 2px; }
  .stat__value.small { font-size: 12.5px; margin-top: 5px; }

  /* ---------- 面板 ---------- */
  .admin-shell { padding: 14px 12px 40px; }
  .admin-layout { gap: 14px; }
  .panel__head { flex-wrap: wrap; row-gap: 9px; padding: 13px 14px; }
  .panel__title { font-size: 14.5px; }
  .panel__actions { margin-left: 0; width: 100%; gap: 7px; }
  .admin-search { flex: 1; width: auto; min-width: 0; }
  .panel__body { padding: 15px 14px; }

  .list-item { padding: 12px 14px; gap: 11px; }
  .list-item__ops { gap: 5px; }
  .list-item__ops .btn { padding: 6px 10px; min-height: 32px; font-size: 12.5px; }
  .list-item__q { font-size: 14px; }
  .list-item__meta { gap: 9px; font-size: 11.5px; }

  /* ---------- 弹窗：留边距、可滚动（键盘弹出时不被顶出屏幕） ---------- */
  .modal { padding: 14px; overflow-y: auto; }
  .modal__card { max-width: none; padding: 20px 16px; border-radius: 16px; }
  .modal__title { font-size: 16px; }
  .modal__desc { font-size: 12.5px; }
  .modal__foot { margin-top: 18px; gap: 8px; }
  .modal__foot .btn { flex: 1; }

  /* ---------- 表单 / 上传 ---------- */
  .textarea { min-height: 110px; }
  .uploader { padding: 18px 12px; }
  .uploader__preview img { max-height: 190px; }
  .field { margin-bottom: 14px; }

  /* ---------- 登录页：靠上对齐，避免小屏 + 键盘时溢出 ---------- */
  .auth { align-items: start; padding: 7vh 12px 24px; }
  .auth__card { padding: 26px 18px 22px; border-radius: 20px; }
  .auth__title { font-size: 20px; }
  .auth__logo { width: 46px; height: 46px; border-radius: 14px; margin-bottom: 14px; }

  /* ---------- 分页 ---------- */
  .pager { margin-top: 18px; gap: 8px; }
  .pager .btn { min-height: 34px; padding: 6px 11px; font-size: 12.5px; }

  /* ---------- 数据表视图 ---------- */
  .dt-shell { padding: 14px 10px 36px; }
  .dt-head { margin-bottom: 12px; }
  .dt-title { font-size: 17px; }
  .dt-sub { font-size: 12px; }
  .dt-toolbar { gap: 8px; padding: 10px; }
  .dt-toolbar .btn { flex: 1 1 84px; }
  .dt-toolbar .dt-plabel { flex: 0 0 auto; }
  .dt-search { width: 100%; }
  .dt-spacer { display: none; }
  .dt-count { margin-left: auto; }
  /* 窄屏让「问题」列拿到足够宽度：隐藏 id 列、图片列只留缩略图、操作列收窄 */
  .dt tbody td:nth-child(1), .dt thead th:nth-child(1) { display: none; }
  /* 解决方案列不整列砍掉，折叠成 46px 的「编辑」入口，点开还是同一个弹窗 */
  .dt thead th.dt-col-s { display: table-cell; width: 46px; font-size: 0; }
  .dt thead th.dt-col-s::after { content: "方案"; font-size: 11px; }
  .dt thead th:nth-child(3), .dt tbody td:nth-child(3) { display: table-cell; }
  .dt tbody td:nth-child(3) { width: 46px; font-size: 0; }
  .dt tbody td:nth-child(3)::after { content: "编辑"; font-size: 12px; color: var(--brand); }
  .dt { table-layout: fixed; }
  .dt tbody td { overflow-wrap: anywhere; }
  .dt-col-q { width: auto; }
  .dt-col-pic { width: 80px; }
  .dt-col-op { width: 60px; }
  .dt-plink { display: none; }   /* 窄列放不下路径文字，只留缩略图 */
  .dt-thumb { width: 30px; height: 30px; border-radius: 7px; }
  .dt-op .btn { padding: 5px 7px; min-height: 30px; font-size: 12px; }
  /* “NULL（点此设置）”在窄列里会折三行，换成短标记 */
  .dt-cell-pic .dt-null { font-size: 0; }
  .dt-cell-pic .dt-null::after { content: "＋图片"; font-size: 11px; color: var(--muted-2); }
  .dt tbody td { padding: 8px 10px; }
  .dt thead th { padding: 8px 10px; }

  /* ---------- 提示条移到屏幕底部，避免盖住顶栏品牌名 ---------- */
  .toasts {
    top: auto;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
}

/* 超窄屏（iPhone SE / 320-360px）：进一步压缩按钮字号，保证 4 个按钮不挤压 */
@media (max-width: 380px) {
  .topbar__acts .btn { font-size: 11.5px; padding: 6px 2px; }
  .brand__text { font-size: 14px; }
  .stat { padding: 10px 12px; }
  .stat__value { font-size: 18px; }
  .stat__value.small { font-size: 12px; }
}
