/* =========================================================================
 * styles.css — Apple 官方风格设计系统（浅色 / 留白 / SF 字体 / 苹果蓝）
 *  · 字体：-apple-system / SF Pro 系统字体栈
 *  · 配色：白底 #fff、浅灰 #f5f5f7、近黑 #1d1d1f、苹果蓝 #0071e3
 *  · 质感：克制的描边、轻盈阴影、胶囊按钮、充足留白
 *  · 无障碍：可见焦点环、≥44px 触摸目标、尊重 prefers-reduced-motion
 * ========================================================================= */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --border: #d2d2d7;
  --border-soft: #e8e8ed;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --danger: #d70015;
  --ok: #248a3d;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 980px;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.22);
  --focus: 0 0 0 3px rgba(0, 125, 250, 0.35);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  font-size: 17px;
  line-height: 1.47;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* ---------- 布局 ---------- */
.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .24s cubic-bezier(.2,.7,.2,1);
}
/* 筛选栏收起：只留 68px 图标栏，画布多出 232px */
.app.rail { grid-template-columns: 68px 1fr; }

/* ---------- 侧边栏（Apple 风：白底 + 细描边） ---------- */
.sidebar {
  position: sticky;
  top: var(--nav-h, 62px);
  align-self: start;
  height: calc(100vh - var(--nav-h, 62px));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 22px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--border-soft);
  transition: padding .24s ease;
}
/* 侧栏顶部：标题 + 收起箭头 */
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px; padding: 0 4px; min-height: 30px;
}
.side-toggle {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--border-soft); background: var(--bg-alt);
  color: var(--text-2); cursor: pointer; font-size: 17px; line-height: 1;
  display: grid; place-items: center; padding: 0;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.side-toggle:hover { background: #ececf0; color: var(--text); transform: translateX(-1px); }
.side-toggle:focus-visible { outline: none; box-shadow: var(--focus); }

/* 收起后：只留一列图标（悬停有中文名） */
.side-rail { display: none; }
.app.rail .sidebar { padding: 12px 8px 18px; }
.app.rail .sidebar .sidebar-title,
.app.rail .sidebar .side-body { display: none; }
.app.rail .sidebar .side-head { justify-content: center; padding: 0; margin-bottom: 8px; }
.app.rail .side-toggle:hover { transform: none; }
.app.rail .side-rail { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.rail-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 2px 7px; border-radius: 12px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-2); cursor: pointer; font-family: var(--font);
  transition: background .15s ease, color .15s ease;
}
.rail-item:hover { background: var(--bg-alt); color: var(--text); }
.rail-item.has { background: rgba(0, 113, 227, 0.08); color: var(--accent); border-color: rgba(0, 113, 227, 0.16); }
.rail-item .ri-ic { font-size: 19px; line-height: 1.1; }
.rail-item .ri-label { font-size: 11.5px; letter-spacing: -.01em; white-space: nowrap; }
.rail-item .ri-badge {
  position: absolute; top: 3px; right: 4px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600; line-height: 15px; text-align: center;
}
.rail-clear { margin-top: 4px; border-top: 1px solid var(--border-soft); border-radius: 0 0 12px 12px; padding-top: 10px; }
.rail-clear .ri-ic { font-size: 14px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand .mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--accent);
  display: grid; place-items: center;
  font-weight: 600; font-size: 18px; color: #fff;
}
.brand h1 { font-size: 21px; font-weight: 600; margin: 0; letter-spacing: -0.02em; }
.brand p { margin: 1px 0 0; font-size: 13px; color: var(--text-3); }

/* 库切换器 */
.lib-switch { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; }
.lib-item {
  display: flex; align-items: center; gap: 11px;
  min-height: 44px; padding: 0 12px;
  border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--text-2);
  cursor: pointer; font-family: var(--font);
  font-size: 16px; font-weight: 500; letter-spacing: -0.01em;
  transition: background .15s ease, color .15s ease;
}
.lib-item:hover { background: var(--bg-alt); color: var(--text); }
.lib-item.active { background: rgba(0, 113, 227, 0.10); color: var(--accent); }
.lib-item .lic { font-size: 19px; width: 24px; text-align: center; }
.lib-item .lt { flex: 1; text-align: left; }
.lib-item .count {
  font-size: 12px; color: var(--text-3);
  background: var(--bg-alt); border-radius: var(--radius-pill); padding: 1px 9px;
}

/* 筛选 */
.filter-block { margin-bottom: 8px; }
.filter-block + .filter-block { border-top: 1px solid var(--border-soft); padding-top: 4px; }
.filter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 9px 6px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; user-select: none;
  font-family: var(--font); text-align: left;
  transition: background .15s ease;
}
.filter-head:hover { background: var(--bg-alt); }
.filter-head:focus-visible { outline: none; box-shadow: var(--focus); }
.fh-left { display: flex; align-items: center; gap: 7px; min-width: 0; }
.fh-ic { font-size: 15px; line-height: 1; opacity: .9; }
.filter-head h2 {
  font-size: 14px; font-weight: 600; letter-spacing: 0;
  color: var(--text-2); margin: 0;
}
.fh-right { display: flex; align-items: center; gap: 6px; }
.fh-badge {
  min-width: 16px; height: 16px; padding: 0 5px; border-radius: 999px;
  background: rgba(0, 113, 227, .12); color: var(--accent);
  font-size: 10.5px; font-weight: 600; line-height: 16px; text-align: center;
}
.filter-head .chev { transition: transform .25s ease; color: var(--text-3); font-size: 11px; }
.filter-block.collapsed .chev { transform: rotate(-90deg); }
/* 折叠面板：grid-rows 0fr→1fr 做高度过渡，不抖动 */
.filter-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .24s cubic-bezier(.2,.7,.2,1); }
.filter-block.collapsed .filter-wrap { grid-template-rows: 0fr; }
.filter-list { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px; overflow: hidden; min-height: 0; }

.facet {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 10px;
  min-height: 42px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s ease;
}
.facet:hover { background: var(--bg-alt); }
.facet.active { background: rgba(0, 113, 227, 0.08); }
.facet input { accent-color: var(--accent); width: 17px; height: 17px; }
.facet .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.facet .label { flex: 1; font-size: 16px; color: var(--text); }
.facet .count {
  font-size: 13px; color: var(--text-3);
  background: var(--bg-alt); border-radius: var(--radius-pill); padding: 1px 9px;
}
.facet .sub { font-size: 12px; color: var(--text-3); margin-left: 4px; }

.sidebar-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* ---------- 主区 ---------- */
.main { padding: 20px 28px 70px; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 26px; flex-wrap: wrap;
}
.search {
  flex: 1 1 280px; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-alt);
  border: 1px solid transparent; border-radius: 12px;
  padding: 0 14px; height: 40px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.search input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--text); font-size: 15px; font-family: var(--font);
}
.search input::placeholder { color: var(--text-3); }
.search svg { color: var(--text-3); flex: none; }
.toolbar-meta { font-size: 14px; color: var(--text-2); white-space: nowrap; }

/* 卡片缩略图统一 3:4 填充裁剪（v1.1.10 起不再提供「缩略图显示」调节） */

/* ---------- 按钮（胶囊） ---------- */
.btn {
  font-family: var(--font);
  font-size: 15px; font-weight: 500;
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; border: 1px solid transparent;
  background: var(--bg-alt); color: var(--text);
  transition: background .15s ease, transform .1s ease, box-shadow .2s ease;
}
.btn:hover { background: #ececf0; }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: rgba(0, 113, 227, 0.08); }
.btn-block { width: 100%; min-height: 46px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- 网格 / 卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
/* 入场动画只在整屏刷新时播一次；勾选 / 筛选 / 搜索不重播，避免“页面闪一下” */
.grid.anim .card { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 22ms); }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border); }
.card:focus-visible { outline: none; box-shadow: var(--focus); }
/* 缩略图容器：固定 3:4，图片铺满并居中裁剪，保证所有卡片高度一致 */
.card .media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--bg-alt);
  display: block;
}
.card .media .thumb {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform .18s ease;
}
.card .body { padding: 15px 16px 17px; }
.card .name {
  font-size: 17px; font-weight: 600; margin: 0 0 10px;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 12px; color: var(--text);
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--bg-alt);
  display: inline-flex; align-items: center; gap: 6px;
}
.badge .bdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

.card .src {
  position: absolute; top: 10px; left: 10px;
  font-size: 11px; letter-spacing: .3px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border); color: var(--text-2);
}
.card .src.upload { color: var(--ok); border-color: rgba(36, 138, 61, 0.4); }

/* ---------- 空状态 ---------- */
.empty {
  grid-column: 1 / -1; text-align: center;
  padding: 80px 20px; color: var(--text-2);
}
.empty .big { font-size: 24px; font-weight: 600; color: var(--text); margin-bottom: 8px; letter-spacing: -0.02em; }

/* ---------- 详情弹窗（页面居中，左图右信息） ---------- */
.drawer-mask {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 22, 28, 0.42);
  backdrop-filter: saturate(120%) blur(2px);
  -webkit-backdrop-filter: saturate(120%) blur(2px);
  display: none;
}
.drawer-mask.open { display: block; }
.drawer {
  position: fixed; top: 50%; left: 50%; right: auto; z-index: 41;
  width: min(900px, 94vw);
  max-height: 90vh; height: auto;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 26px 28px 24px;
  overflow-y: auto;
  opacity: 0;
  transform: translate(-50%, -47%) scale(.97);
  pointer-events: none;
  transition: transform .26s cubic-bezier(.2,.7,.2,1), opacity .18s ease;
}
.drawer.open { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.drawer .close {
  position: absolute; top: 16px; right: 18px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-alt); border: 0; color: var(--text);
  cursor: pointer; font-size: 18px; line-height: 1;
}
.drawer .close:hover { background: #ececf0; }
/* 详情页大图：等比完整显示，不裁剪不变形（固定为缩略图，不再提供查看原图） */
.drawer .hero {
  width: 100%; border-radius: var(--radius);
  overflow: hidden; margin-bottom: 6px;
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
}
.drawer .hero .thumb {
  width: 100%; height: auto; max-height: 52vh;
  object-fit: contain; display: block;
}
.drawer .hero-hint { font-size: 12px; color: var(--text-3); text-align: center; margin-bottom: 16px; }
.drawer .hero-hint { display: flex; justify-content: center; }
.drawer h3 { font-size: 26px; font-weight: 600; margin: 0 0 16px; letter-spacing: -0.02em; }
.drawer .meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.drawer .field { margin-bottom: 16px; }
.drawer .field label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 5px; letter-spacing: .02em; }
.drawer .field .v { font-size: 16px; color: var(--text); }
.drawer .title-input { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; padding: 9px 12px; }

/* 居中弹窗内部：左侧整块图片面板 + 右侧信息栏 */
.detail-head { grid-area: head; padding-right: 46px; margin-bottom: 16px; }
.detail-eyebrow {
  font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 4px;
}
.detail-title {
  font-size: 24px; font-weight: 600; margin: 0; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.detail-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1fr);
  grid-template-areas: "media head" "media info";
  grid-template-rows: auto 1fr;
  column-gap: 24px; align-items: start;
}
/* 图片面板：一整块浅色底，图片垂直居中，铺满右栏高度 */
.detail-media {
  grid-area: media;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  align-self: stretch;
  min-height: 340px; padding: 14px;
  border-radius: 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.detail-media .hero {
  width: 100%; margin: 0; padding: 0;
  background: transparent; border-radius: 12px;
  max-height: calc(88vh - 200px);
}
.detail-media .hero .thumb {
  width: 100%; height: auto;
  max-height: calc(88vh - 200px);
  object-fit: contain; border-radius: 12px;
}
.detail-info {
  grid-area: info;
  display: flex; flex-direction: column; min-width: 0;
}
.detail-info .field { margin-bottom: 14px; }
.detail-meta-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-meta-cols .v { font-size: 14px; color: var(--text); }
.detail-meta-cols .mono {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; color: var(--text-3); word-break: break-all;
}
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.detail-actions #dl-btn { grid-column: 1 / -1; }
.detail-actions .btn { min-height: 44px; font-size: 14.5px; }

/* ---------- 横图模式：顶部大图 + 下方两列信息，图片尽量铺开 ---------- */
.drawer.wide { width: min(1040px, 96vw); }
.drawer.wide .detail-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "media" "info";
  grid-template-rows: auto auto auto;
  column-gap: 0;
}
.drawer.wide .detail-head { margin-bottom: 14px; }
.drawer.wide .detail-media {
  align-self: auto;
  min-height: 0; padding: 12px;
  margin-bottom: 16px;
}
.drawer.wide .detail-media .hero,
.drawer.wide .detail-media .hero .thumb {
  max-height: 48vh;
  margin: 0 auto;
}
.drawer.wide .detail-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 26px; align-items: start;
}
.drawer.wide .detail-actions { margin-top: 6px; }
.drawer.wide .detail-actions #dl-btn { grid-column: 1 / -1; }
.btn-soft { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border-soft); }
.btn-soft:hover { background: #ececf0; }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid rgba(215, 0, 21, 0.22); }
.btn-danger-ghost:hover { background: rgba(215, 0, 21, 0.07); }

/* ---------- 模态框（上传） ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.40);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  width: min(560px, 96vw);
  max-height: 92vh; overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 22px; padding: 30px;
  box-shadow: var(--shadow-lg);
  animation: rise .3s ease both;
}
.modal h3 { font-size: 26px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.02em; }
.modal .sub { color: var(--text-2); font-size: 14.5px; margin: 0 0 22px; }
.modal .close {
  position: absolute; top: 18px; right: 20px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-alt); border: 0; color: var(--text); cursor: pointer; font-size: 18px;
}
.modal-head { position: relative; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field input[type=text], .field select, .field textarea {
  font-family: var(--font); font-size: 15px;
  background: var(--bg-alt);
  border: 1px solid transparent; color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 13px;
  min-height: 44px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: var(--focus); background: #fff;
}
.field .err { color: var(--danger); font-size: 12.5px; }
.field input.invalid, .field select.invalid { border-color: var(--danger); }

/* 上传预览 */
.dropzone {
  border: 1.5px dashed var(--border); border-radius: 14px;
  padding: 24px; text-align: center; color: var(--text-2); cursor: pointer;
  background: var(--bg-alt);
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(0, 113, 227, 0.05); }
.dropzone .preview { max-height: 200px; border-radius: 12px; margin-top: 12px; }

.tag-input { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 5px 10px; font-size: 13px; color: var(--text);
}
.tag-chip button { background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 14px; line-height: 1; }

.modal-actions { display: flex; gap: 12px; margin-top: 24px; }

/* 更新面板 */
.field .hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--text); cursor: pointer; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.up-status { margin: 18px 0 4px; padding: 12px 14px; border-radius: 12px; background: var(--bg-alt); border: 1px solid var(--border); font-size: 14px; color: var(--text); line-height: 1.5; }
.progress { height: 8px; border-radius: 99px; background: var(--bg-alt); overflow: hidden; margin: 10px 0 2px; border: 1px solid var(--border); }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 12px 18px; border-radius: 14px;
  box-shadow: var(--shadow); font-size: 14px; animation: rise .25s ease both;
}
.toast.ok { border-color: rgba(36, 138, 61, 0.5); }
.toast.err { border-color: rgba(215, 0, 21, 0.5); }

.menu-toggle { display: none; }

/* ---------- 动画 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 45;
    width: 286px; background: #fff;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.2,.7,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg-alt); border: 0; color: var(--text); cursor: pointer; font-size: 18px;
  }
  .main { padding: 18px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
}

/* ---------- 节点连接栏（局域网互连） ---------- */
.conn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, .04);
  border: 1px solid rgba(0, 0, 0, .06);
}
[data-theme="dark"] .conn {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .1);
}
.conn #conn-input {
  width: 210px; border: none; background: transparent;
  font-size: 13px; color: var(--text); outline: none;
}
/* 网页版（公网站点）固定连本站，整块节点连接栏隐藏 */
body.web-mode .conn { display: none; }
.btn-sm { padding: 5px 12px; font-size: 13px; line-height: 1.4; }
@media (max-width: 1180px) { .conn #conn-input { width: 130px; } }
@media (max-width: 880px) {
  .conn #conn-input, .conn #conn-btn, .conn .peers { display: none; }
}

/* ---------- 无障碍：尊重减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* =========================================================================
 * 顶部导航条（Apple 风：居中毛玻璃 + 胶囊导航）
 * ========================================================================= */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  max-width: 1560px; margin: 0 auto; height: 62px;
  display: flex; align-items: center; gap: 8px; padding: 0 16px;
  flex-wrap: nowrap;              /* 严格单行：任何宽度下都不换行 */
  min-width: 0;
}
.nav-brand {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  color: var(--text); font-weight: 600; font-size: 17px; letter-spacing: -0.02em;
  flex: none;
}
.nav-brand .mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
/* 库切换：与全局按钮同一行（不再单独占一行） */
.nav-libs {
  display: flex; align-items: center; gap: 2px;
  flex: 1 1 0; min-width: 0;      /* 空间不够时优先压缩库切换，保证右侧按钮不被挤走 */
  overflow-x: auto; scrollbar-width: none;
  padding: 0; border-top: 0;
}
.nav-libs::-webkit-scrollbar { display: none; }
.nav-lib {
  min-height: 34px; padding: 0 12px; border-radius: var(--radius-pill);
  border: 1px solid transparent; background: transparent;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
  font-family: var(--font); font-size: 14px; font-weight: 500; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s ease, color .15s ease;
}
.nav-lib:hover { background: var(--bg-alt); color: var(--text); }
.nav-lib.active { background: var(--accent); color: #fff; }
.nav-lib .lic { font-size: 15px; }
.nav-lib .count { font-size: 11px; opacity: .85; }

/* 右侧：搜索 + 全局按钮，固定在最右边 */
.nav-right {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  flex: none; flex-wrap: nowrap; min-width: 0;
}
.nav-search {
  width: clamp(150px, 15vw, 250px); height: 38px; flex: 0 0 auto;
  order: 9;                       /* 永远排在全排最右 */
  background: var(--bg-alt); border-radius: var(--radius-pill);
  padding: 0 12px; gap: 7px;
  transition: width .2s ease, border-color .15s ease, box-shadow .15s ease;
}
.nav-search:focus-within { width: clamp(200px, 24vw, 340px); }
.nav-search input { font-size: 14px; min-width: 0; }
.nav-search .search-meta {
  flex: none; font-size: 11.5px; color: var(--text-3); white-space: nowrap;
  padding-left: 8px; border-left: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.nav-search .search-meta b { color: var(--text-2); font-weight: 600; }
/* 命中数：画布右上角一行轻量说明，给顶栏腾出空间 */
.grid-head {
  display: flex; align-items: center; justify-content: flex-end;
  margin: -2px 2px 10px; min-height: 18px;
  font-size: 12.5px; color: var(--text-3);
}
.grid-head .hit b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.nav-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: var(--bg-alt); color: var(--text);
  cursor: pointer; font-size: 17px; line-height: 1;
  display: grid; place-items: center; transition: background .15s ease;
}
.icon-btn:hover { background: #ececf0; }

/* 产品页式 Hero 区块已按需求移除；详情页大图使用上方 .drawer .hero 独立样式。
 * 这里不再定义全局 .hero，避免给详情大图带来额外内边距与光晕。 */

/* 侧边栏微调（导航已承载库切换，侧栏仅筛选） */
.sidebar-title {
  font-size: 15px; font-weight: 600; letter-spacing: 0;
  color: var(--text); margin-bottom: 0;
}

/* 卡片独立下载按钮 */
.card .card-dl {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 16px; line-height: 1;
  display: grid; place-items: center; opacity: 0;
  transition: opacity .15s ease, background .15s ease, transform .1s ease;
}
.card .card-dl:hover { background: #fff; transform: scale(1.05); }
.card:hover .card-dl, .card:focus-within .card-dl { opacity: 1; }
@media (hover: none) { .card .card-dl { opacity: 1; } }

/* ---------- 网格多选 ---------- */
.card-check {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.18); background: rgba(255,255,255,.85);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.card-check.on { background: var(--accent); border-color: var(--accent); }
.card-check:active { transform: scale(.92); }
.card.selected { outline: 2px solid var(--accent); outline-offset: -2px; border-color: var(--accent); }

/* ---------- 批量操作条（吸顶固定在顶栏下方） ---------- */
.bulk-bar { display: flex; }
.bulk-bar[hidden] { display: none; }
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px; margin: 0 0 14px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  position: sticky; top: calc(var(--nav-h, 62px) + 10px); z-index: 22;
}
[data-theme="dark"] .bulk-bar { background: rgba(29, 29, 31, 0.92); }
.bulk-info { font-size: 14px; }
.bulk-info b { color: var(--accent); }
.bulk-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.bulk-actions .btn { min-height: 34px; padding: 5px 11px; font-size: 13.5px; }
.bulk-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }

/* =========================================================================
 * 批量上传
 * ========================================================================= */
.batch-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; max-height: 300px; overflow-y: auto; }
.batch-empty { color: var(--text-3); font-size: 13px; padding: 8px 2px; }
.batch-item {
  display: flex; gap: 12px; align-items: center; padding: 10px;
  border: 1px solid var(--border-soft); border-radius: 14px;
}
.batch-item img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg-alt); }
.batch-item .bi-main { flex: 1; min-width: 0; }
.batch-item .bi-main input { width: 100%; }
.batch-item .bi-remove {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: var(--bg-alt); color: var(--text-3); cursor: pointer; font-size: 16px; line-height: 1;
}
.batch-item .bi-remove:hover { background: #ececf0; color: var(--text); }
.batch-shared { margin-top: 16px; border-top: 1px solid var(--border-soft); padding-top: 16px; }

/* =========================================================================
 * 深色模式
 * ========================================================================= */
[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #1d1d1f;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #86868b;
  --border: #38383c;
  --border-soft: #2c2c2e;
  --accent: #2997ff;
  --accent-hover: #2997ff;
  --danger: #ff453a;
  --ok: #30d158;
  --focus: 0 0 0 3px rgba(41, 151, 255, 0.45);
}
[data-theme="dark"] .nav,
[data-theme="dark"] .sidebar { background: rgba(22, 22, 24, 0.72); }
[data-theme="dark"] .card .src,
[data-theme="dark"] .card .card-dl,
[data-theme="dark"] .modal .close,
[data-theme="dark"] .drawer .close,
[data-theme="dark"] .icon-btn,
[data-theme="dark"] .tag-chip,
[data-theme="dark"] .batch-item .bi-remove { background: rgba(28, 28, 30, 0.92); }
[data-theme="dark"] .modal,
[data-theme="dark"] .drawer,
[data-theme="dark"] .toast { background: #1d1d1f; }
[data-theme="dark"] .field input[type=text],
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .search { background: #2c2c2e; color: var(--text); }
[data-theme="dark"] .field input:focus,
[data-theme="dark"] .field select:focus,
[data-theme="dark"] .field textarea:focus { background: #1d1d1f; }
[data-theme="dark"] .btn { background: #2c2c2e; color: var(--text); }
[data-theme="dark"] .btn:hover { background: #3a3a3c; }
[data-theme="dark"] .btn-primary { background: var(--accent); color: #000; }
[data-theme="dark"] .btn-primary:hover { background: var(--accent-hover); }

/* =========================================================================
 * 响应式：导航在窄屏的适配
 * ========================================================================= */
@media (max-width: 880px) {
  .nav-inner { gap: 10px; padding: 0 14px; }
  .nav-brand-text { display: none; }
  .nav-libs { justify-content: flex-start; }
  .nav-lib .lt { display: none; }
  .nav-actions .btn { padding: 8px 12px; font-size: 14px; }
  .sidebar { top: var(--nav-h, 56px); height: calc(100vh - var(--nav-h, 56px)); }
}

/* =========================================================================
 * 更新红点 / 设置 / 节点自动发现 新增样式
 * ========================================================================= */
.icon-btn { position: relative; }
.up-dot {
  position: absolute; top: 3px; right: 3px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #ff3b30; box-shadow: 0 0 0 2px #fff;
  animation: pulse 1.6s ease-in-out infinite;
}
[data-theme="dark"] .up-dot { box-shadow: 0 0 0 2px #1d1d1f; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.25); opacity: .75; } }

/* 节点自动发现下拉 */
.peers { position: relative; }
.peers-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 35;
  min-width: 250px; max-width: 320px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 8px; animation: rise .18s ease both;
}
.peer-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px; border-radius: 10px; background: transparent;
  border: 0; cursor: pointer; text-align: left; font-family: var(--font);
}
.peer-item:hover { background: var(--bg-alt); }
.peer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.peer-dot.local { background: var(--text-muted); }
.peer-meta { display: flex; flex-direction: column; min-width: 0; }
.peer-name { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer-addr { font-size: 12px; color: var(--text-3); font-family: ui-monospace, Menlo, Consolas, monospace; }
.peers-empty { padding: 14px; font-size: 13px; color: var(--text-2); text-align: center; line-height: 1.6; }
.peers-empty span { display: block; color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* 设置面板 */
.set-section { border-top: 1px solid var(--border-soft); padding-top: 16px; margin-top: 16px; }
.set-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.set-section h4 { font-size: 16px; margin: 0 0 4px; letter-spacing: -0.01em; }
.set-desc { font-size: 13px; color: var(--text-3); margin: 0 0 12px; line-height: 1.55; }
.tag-ok {
  font-size: 11px; color: var(--ok);
  background: rgba(48, 209, 88, 0.12); padding: 1px 8px; border-radius: 999px; margin-left: 6px;
}

/* =========================================================================
 * 卡片底部：下载次数 / 原图大小
 * ========================================================================= */
.batch-item .bi-size {
  display: block; font-size: 11.5px; color: var(--text-3);
  margin-top: 4px; font-variant-numeric: tabular-nums;
}

/* =========================================================================
 * 顶栏操作区：图标分组 + 选择 / AI 生成 / 上传素材（合并下拉）
 * ========================================================================= */
.nav-actions { gap: 8px; margin-left: auto; }
.nav-tools {
  display: flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border-soft);
}
.nav-tools .icon-btn { width: 32px; height: 32px; background: transparent; font-size: 15px; }
.nav-tools .icon-btn:hover { background: rgba(255, 255, 255, 0.9); }
[data-theme="dark"] .nav-tools .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.nav-btn { min-height: 38px; padding: 7px 15px; font-size: 14px; gap: 6px; }
.nav-btn .ni { font-size: 14px; line-height: 1; opacity: .9; }
.nav-btn-soft { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border-soft); }
.nav-btn-soft:hover { background: #ececf0; }
.nav-btn-ai { background: rgba(0, 113, 227, 0.09); color: var(--accent); border: 1px solid rgba(0, 113, 227, 0.16); }
.nav-btn-ai:hover { background: rgba(0, 113, 227, 0.15); }
.nav-btn-primary {
  background: var(--accent); color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.26);
  padding-right: 13px;
}
.nav-btn-primary:hover { background: var(--accent-hover); box-shadow: 0 6px 16px rgba(0, 113, 227, 0.32); }
.nav-btn-primary .caret { font-size: 11px; margin-left: 3px; opacity: .9; }
[data-theme="dark"] .nav-btn-primary,
[data-theme="dark"] .nav-btn-primary:hover { background: var(--accent); color: #fff; }
[data-theme="dark"] .nav-btn-soft { background: #2c2c2e; color: var(--text); border-color: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .nav-btn-soft:hover { background: #3a3a3c; }
[data-theme="dark"] .nav-btn-ai { background: rgba(10, 132, 255, 0.18); color: #6cb8ff; border-color: rgba(10, 132, 255, 0.28); }
[data-theme="dark"] .nav-btn-ai:hover { background: rgba(10, 132, 255, 0.26); }
[data-theme="dark"] .nav-tools { background: #1c1c1e; border-color: rgba(255, 255, 255, 0.1); }

.upload-ctl { position: relative; }
.upload-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 36;
  width: 272px; padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: rise .16s ease both;
}
.upload-pop[hidden] { display: none; }
.upload-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px; border: 0; border-radius: 12px;
  background: transparent; cursor: pointer; text-align: left;
  font-family: var(--font);
}
.upload-item:hover { background: var(--bg-alt); }
.upload-item .ui-icon {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(0, 113, 227, 0.1); color: var(--accent);
  font-size: 15px; font-weight: 600;
}
.upload-item .ui-text { display: flex; flex-direction: column; min-width: 0; }
.upload-item .ui-text b { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-item .ui-text small { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.upload-foot {
  margin-top: 6px; padding: 8px 10px 2px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px; color: var(--text-3);
}
.upload-foot b { color: var(--accent); font-weight: 600; }

/* 详情弹窗与顶栏在窄屏下的适配 */
@media (max-width: 900px) {
  /* 窄屏一律单列：标题 → 图片 → 信息（横图也一样，不再左右分栏） */
  .detail-layout,
  .drawer.wide .detail-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "media" "info";
    grid-template-rows: auto auto auto;
    column-gap: 0; row-gap: 14px;
  }
  .detail-head,
  .drawer.wide .detail-head { margin-bottom: 0; }
  .detail-info,
  .drawer.wide .detail-info { display: flex; flex-direction: column; }
  /* 窄屏：去掉图片面板底色与边框，让图片按自身比例居中，避免大片留白 */
  .detail-media,
  .drawer.wide .detail-media {
    min-height: 0; padding: 0; margin-bottom: 0;
    background: transparent; border: 0; border-radius: 0;
  }
  .detail-media .hero,
  .drawer.wide .detail-media .hero { width: auto; max-width: 100%; max-height: 40vh; }
  .detail-media .hero .thumb,
  .drawer.wide .detail-media .hero .thumb {
    width: auto; max-width: 100%; max-height: 40vh;
    border-radius: 14px;
  }
  .drawer { width: min(620px, 94vw); padding: 22px 18px 20px; border-radius: 20px; max-height: 92vh; }
  .detail-title { font-size: 21px; }
  .drawer.wide .detail-actions { margin-top: 12px; }
}
@media (max-width: 880px) {
  .nav-btn .ni { display: none; }
  .nav-btn { padding: 7px 11px; font-size: 13px; }
  .nav-tools { padding: 2px; }
  .nav-tools .icon-btn { width: 28px; height: 28px; font-size: 13px; }
  .upload-pop { width: 238px; }
}
@media (max-width: 620px) {
  .nav-btn-soft { display: none; }
}


/* =========================================================================
 * v1.1.11 — 顶栏单行融合 / 搜索右上角 / 筛选分组折叠 + 图标栏
 * ========================================================================= */

/* 节点连接：收进右上角图标浮层（桌面端），不再占用顶栏横向空间 */
.conn-ctl { position: relative; display: flex; }
.conn-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 38;
  width: 300px; padding: 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  animation: rise .16s ease both;
}
.conn-pop[hidden] { display: none; }
.conn-pop-title { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; margin: 2px 2px 10px; }
.conn-pop .conn {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  padding: 0; background: transparent; border: 0;
}
.conn-pop #conn-input {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--bg-alt); border-radius: 10px;
  border: 1px solid transparent; font-size: 13px;
}
.conn-pop #conn-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.conn-pop .peers { position: relative; }
.conn-pop .peers-pop { left: 0; right: 0; top: calc(100% + 8px); min-width: 0; width: 100%; }

/* 搜索框固定在右上角：窄屏时缩短，聚焦时展开 */
.nav-search svg { flex: none; }
body.web-mode .conn-ctl { display: none; }
/* 分组箭头：用描边三角，比 ▾ 字符更清晰 */
.filter-head .chev {
  width: 0; height: 0; font-size: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-3);
  transition: transform .25s ease;
}
@media (max-width: 1280px) {
  .nav-inner { gap: 7px; padding: 0 14px; }
  .nav-search { width: clamp(150px, 16vw, 205px); }
  .nav-search:focus-within { width: clamp(190px, 22vw, 260px); }
  .nav-lib { padding: 0 8px; }
  .nav-lib .count { font-size: 10.5px; }
  .nav-actions { gap: 6px; }
  .nav-btn { padding: 7px 10px; font-size: 13px; }
  .nav-tools .icon-btn { width: 30px; height: 30px; font-size: 14px; }
}
@media (max-width: 900px) {
  .nav-brand-text { display: none; }
  .nav-lib { padding: 0 10px; }
}
@media (max-width: 880px) {
  .nav-inner { height: 56px; gap: 8px; padding: 0 12px; }
  .nav-search { width: 132px; height: 34px; }
  .nav-search:focus-within { width: 176px; }
  .nav-libs { justify-content: flex-start; }
  .side-toggle { display: none; }
  .bulk-bar { top: calc(var(--nav-h, 56px) + 8px); padding: 8px 10px; }
  .bulk-actions .btn { padding: 6px 10px; font-size: 13px; }
  .bulk-sep { display: none; }
  /* 移动端筛选是抽屉，不做图标栏 */
  .app.rail { grid-template-columns: 1fr; }
  .app.rail .sidebar { padding: 18px 16px 22px; }
  .app.rail .sidebar .sidebar-title,
  .app.rail .sidebar .side-body { display: block; }
  .app.rail .side-rail { display: none; }
}
@media (max-width: 620px) {
  .nav-search { display: none; }
}

/* v1.1.12 — 顶栏：中等宽度收紧间距，保证 4 个库标签 + 全部按钮 + 搜索单行放得下 */
@media (max-width: 1120px) {
  .nav-inner { gap: 6px; padding: 0 12px; }
  .nav-brand { gap: 7px; font-size: 16px; }
  .nav-lib { padding: 0 8px; font-size: 13.5px; gap: 4px; }
  .nav-lib .lic { font-size: 13px; }
  .nav-lib .count { font-size: 10px; }
  .nav-search { width: clamp(120px, 13vw, 190px); }
  .nav-search input { font-size: 13px; }
  .nav-actions { gap: 6px; }
  .nav-btn { padding: 7px 11px; font-size: 13.5px; }
  .nav-tools .icon-btn { width: 29px; height: 29px; font-size: 14px; }
}
@media (max-width: 1000px) {
  .nav-brand-text { display: none; }
  .nav-btn .ni { display: none; }
  .nav-search { width: 120px; }
}

/* =========================================================================
 * v1.1.13 — 详情弹窗一屏放下 / 顶栏精简 / 整体排版与按钮优化
 * ========================================================================= */

/* ---------- 详情弹窗：改为「内部分区」而不是整块滚动 ---------- */
.drawer {
  display: flex; flex-direction: column;
  padding: 22px 24px 20px;
  border-radius: 22px;
  max-height: 90vh;
}
#drawer-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; height: 100%; }
.detail-layout { flex: 1 1 auto; min-height: 0; }

/* 标题区：标题 + 一行信息胶囊（来源 / 下载 / 时间 / ID） */
.detail-head { padding-right: 46px; margin-bottom: 12px; }
.detail-eyebrow {
  font-size: 11px; letter-spacing: .08em;
  color: var(--text-3); margin-bottom: 3px;
}
.detail-title { font-size: 21px; letter-spacing: -0.015em; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; color: var(--text-2);
  background: var(--bg-alt); border: 1px solid var(--border-soft);
  white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip-id {
  max-width: 190px; overflow: hidden; text-overflow: ellipsis;
  font-size: 11px; letter-spacing: 0;
}
[data-theme="dark"] .chip { background: #232325; border-color: rgba(255,255,255,.08); }

/* 表单小标题（属性） */
.field-label { font-size: 12px; color: var(--text-3); margin: 2px 0 6px; letter-spacing: .01em; }
.form-grid-attrs { gap: 10px; margin-bottom: 0; }
.form-grid-attrs .field { margin-bottom: 0; }
.detail-info .field > label { font-size: 12px; }

/* 竖图：右侧信息栏 + 双列按钮 */
.detail-actions { margin-top: 12px; }
.detail-actions .btn { min-height: 40px; font-size: 14px; }

/* 横图：卡片式布局，高度写死一屏，图片吃掉剩余空间，信息区固定高度 —— 内部永不出现滚动条 */
.drawer.wide {
  width: min(1120px, 96vw);
  height: min(90vh, 860px);
  max-height: 90vh;
  overflow: hidden;
}
.drawer.wide .detail-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.drawer.wide .detail-title { font-size: 19px; }
.drawer.wide .detail-chips { margin-top: 0; }
.drawer.wide .detail-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "media" "info";
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
}
.drawer.wide .detail-media {
  min-height: 0; height: 100%; max-height: 100%;
  margin-bottom: 14px; padding: 10px;
  border-radius: 16px; overflow: hidden;
}
.drawer.wide .detail-media .hero {
  height: 100%; max-height: 100%; width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.drawer.wide .detail-media .hero .thumb {
  width: auto; height: auto;
  max-width: 100%; max-height: 100%;
  object-fit: contain; border-radius: 10px;
}
.drawer.wide .detail-info {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  column-gap: 24px; align-items: start;
}
.drawer.wide .detail-actions {
  grid-template-columns: 1.25fr 1fr .8fr;
  margin-top: 10px;
}
.drawer.wide .detail-actions #dl-btn { grid-column: auto; }

/* ---------- 顶栏：「多选」按钮 ---------- */
.nav-btn-multi {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border-soft);
  min-height: 36px; padding: 0 13px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .18s ease;
}
.nav-btn-multi:hover { background: #ececf0; border-color: var(--border); }
.nav-btn-multi .ni { font-size: 14px; opacity: .8; }
.nav-btn-multi.is-on {
  background: rgba(0, 113, 227, 0.10);
  color: var(--accent);
  border-color: rgba(0, 113, 227, 0.30);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.06);
}
.nav-btn-multi.is-on .ni { opacity: 1; }
[data-theme="dark"] .nav-btn-multi { background: #2c2c2e; border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .nav-btn-multi:hover { background: #3a3a3c; }
[data-theme="dark"] .nav-btn-multi.is-on { background: rgba(10,132,255,.20); color: #6cb8ff; border-color: rgba(10,132,255,.4); }

/* ---------- 整体排版：字号 / 间距 / 质感统一 ---------- */
body { font-size: 16px; line-height: 1.5; }
.nav-inner { height: 60px; }
.nav-brand { font-size: 16.5px; }
.nav-lib { min-height: 32px; font-size: 13.5px; }
.nav-lib.active { box-shadow: 0 2px 8px rgba(0, 113, 227, .24); }
.nav-btn { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.nav-search { height: 36px; }

.grid { gap: 18px; }
.card { border-radius: 16px; }
.card .body { padding: 12px 14px 14px; }
.card .name { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
.badge { font-size: 11.5px; padding: 3px 9px; }
.card .media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}
.grid-head { font-size: 12px; margin-bottom: 8px; }

.sidebar { padding: 14px 14px 22px; }
.side-head { margin-bottom: 6px; }
.filter-head { padding: 8px 6px; }
.facet { min-height: 40px; }

.btn { min-height: 38px; font-size: 14px; padding: 8px 16px; }
.field input, .field select, .field textarea { font-size: 14.5px; }

/* 窄屏：横图弹窗改为可滚动（高度不够时无法硬塞），竖图保持原逻辑 */
@media (max-width: 900px) {
  .drawer.wide { height: auto; max-height: 92vh; overflow-y: auto; }
  .drawer.wide .detail-layout { grid-template-rows: auto auto auto; height: auto; }
  .drawer.wide .detail-actions { grid-template-columns: 1fr 1fr; }
  .drawer.wide .detail-actions #dl-btn { grid-column: 1 / -1; }
}
/* 多选按钮图标：矢量描边图标与文字基线对齐 */
.nav-btn-multi .ni-check { display: inline-flex; align-items: center; }
.nav-btn-multi .ni-check svg { display: block; }
.nav-btn-multi .nb { font-variant-numeric: tabular-nums; }

/* ---------- 批量操作条：按钮改为统一的浅色胶囊，层级更清楚 ---------- */
.bulk-bar { padding: 9px 12px 9px 14px; border-radius: 14px; }
.bulk-info { font-size: 13.5px; color: var(--text-2); }
.bulk-info b { color: var(--text); font-weight: 600; }
.bulk-actions { gap: 8px; }
.bulk-actions .btn {
  min-height: 32px; padding: 0 12px; font-size: 13px;
  border-radius: 9px; font-weight: 500;
}
.bulk-actions .btn-ghost {
  background: var(--bg-alt); color: var(--text);
  border: 1px solid var(--border-soft);
}
.bulk-actions .btn-ghost:hover { background: #e9e9ee; border-color: var(--border); }
.bulk-actions #bulk-del { color: var(--danger); }
.bulk-actions #bulk-del:hover { background: rgba(215, 0, 21, .07); border-color: rgba(215, 0, 21, .25); }
.bulk-actions #bulk-done { min-width: 62px; }
[data-theme="dark"] .bulk-actions .btn-ghost { background: #2c2c2e; border-color: rgba(255,255,255,.1); color: var(--text); }

/* 勾选框与图标风格统一（圆角方块） */
.card-check { width: 24px; height: 24px; border-radius: 8px; font-size: 13px; }

/* 详情弹窗：按钮统一单行（下载 / 保存 / 删除），省出垂直空间让竖图也一屏放下 */
.detail-actions { grid-template-columns: 1.25fr 1fr .8fr; gap: 8px; }
.detail-actions #dl-btn { grid-column: auto; }
.detail-actions .btn { min-height: 38px; padding: 0 10px; font-size: 13.5px; white-space: nowrap; }
.detail-info .field { margin-bottom: 10px; }
.drawer .field > input, .drawer .field > select { height: 40px; }
/* 细节收紧：让竖图/横图在 720p 级屏幕上都能整屏放下 */
.drawer { padding: 20px 22px 18px; }
.detail-head { margin-bottom: 10px; }
.detail-chips { margin-top: 6px; }
.detail-info .field { margin-bottom: 8px; }
.detail-actions { margin-top: 10px; }
.drawer { padding: 20px 22px 16px; }
.detail-head { margin-bottom: 8px; }
.detail-actions .btn { min-height: 36px; }

/* =========================================================================
 * v1.1.14 — 详情弹窗精简：删标签说明 / 属性一行 / 按钮底部居中 / 取消「查看原图」
 * ========================================================================= */

/* 1) 标签区：去掉「标签（可增删…）」标题与「暂无标签，添加后便于检索」提示，
 *    只留下可回车添加的输入框；有标签时才显示标签胶囊，无标签不占高度 */
.field-tags { display: flex; flex-direction: column; gap: 8px; }
.field-tags .tag-input:empty { display: none; }
.field-tags > input { width: 100%; }

/* 2) 属性下拉强制在一行等分（各库 2~3 个维度都铺满整行） */
.form-grid-attrs,
.drawer.wide .form-grid-attrs {
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 10px;
}
.form-grid-attrs .field { min-width: 0; margin-bottom: 0; }
.form-grid-attrs .field select { width: 100%; }

/* 3) 操作按钮独立成行：贴在弹窗最底部、水平居中，上方一条淡分隔线 */
.detail-actions {
  grid-area: actions;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.detail-actions .btn {
  min-width: 116px; min-height: 40px;
  padding: 0 18px; font-size: 14px; white-space: nowrap;
}
.detail-actions #dl-btn { min-width: 200px; }
.dl-size {
  margin-left: 4px; font-size: .86em; font-weight: 500;
  opacity: .86; font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .detail-actions { border-top-color: rgba(255, 255, 255, .09); }

/* 竖图：左图右信息 + 底部整行按钮 */
.detail-layout {
  grid-template-areas: "media head" "media info" "actions actions";
  grid-template-rows: auto minmax(0, 1fr) auto;
  row-gap: 0;
}
/* 横图：标题 → 大图（吃掉剩余空间）→ 信息 → 底部按钮，仍然一屏不滚动 */
.drawer.wide .detail-layout {
  grid-template-areas: "head" "media" "info" "actions";
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  row-gap: 0;
}
.drawer.wide .detail-media { margin-bottom: 12px; }
.drawer.wide .detail-actions { margin-top: 8px; padding-top: 12px; }

/* 4) 图片固定为缩略图，不再有「点击查看原图」提示与放大光标 */
.detail-media .hero, .detail-media .hero .thumb { cursor: default; }

/* 窄屏：单列顺序补上 actions 行；属性两列折行，按钮可换行 */
@media (max-width: 900px) {
  .detail-layout,
  .drawer.wide .detail-layout {
    grid-template-areas: "head" "media" "info" "actions";
    grid-template-rows: auto auto auto auto;
  }
  .form-grid-attrs,
  .drawer.wide .form-grid-attrs {
    grid-auto-flow: row; grid-auto-columns: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-actions { flex-wrap: wrap; margin-top: 8px; padding-top: 12px; }
  .detail-actions .btn { flex: 1 1 120px; min-width: 0; }
  .detail-actions #dl-btn { flex-basis: 100%; min-width: 0; }
}

/* =========================================================================
 * v1.1.15 — 竖图恢复上一版紧凑排版；横图信息区「名称|标签 / 属性|按钮」两行对齐
 * ========================================================================= */

/* 1) 竖图：弹窗高度随内容收缩，图片不再撑满 90vh，右栏从上到下紧凑排列 */
/* 竖向 flex 链改为「不压缩」，否则 auto 栅格行会被压矮、图片压到表单上 */
.drawer:not(.wide) #drawer-body,
.drawer:not(.wide) .detail-layout { height: auto; flex: 0 0 auto; }
.detail-layout {
  grid-template-areas: "media head" "media info";
  grid-template-rows: auto auto;
  align-items: start;
}
.detail-media { align-self: start; min-height: 0; }
.detail-media .hero .thumb {
  width: auto; max-width: 100%;
  max-height: min(56vh, 470px);
}
.detail-info { display: flex; flex-direction: column; }
.detail-info .field-name { margin-bottom: 10px; }
.detail-info .field-attrs { margin-bottom: 12px; }
.detail-info .field-tags { margin-bottom: 12px; }

/* 2) 按钮回到右栏、紧跟标签输入框：取消底部通栏、淡分隔线与水平居中 */
.detail-actions {
  grid-area: auto;
  display: grid;
  grid-template-columns: 1.3fr 1fr .8fr;
  align-items: center; justify-content: stretch;
  gap: 8px; margin: 0; padding: 0; border: 0;
}
.detail-actions .btn { min-width: 0; min-height: 38px; padding: 0 10px; font-size: 13.5px; }
.detail-actions #dl-btn { min-width: 0; }

/* 3) 横图：信息区两列两行 —— 名称与标签同一行，属性与按钮同一行，底边对齐 */
.drawer.wide .detail-layout {
  grid-template-areas: "head" "media" "info";
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.drawer.wide .detail-info {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  grid-template-areas: "name tags" "attrs actions";
  grid-template-rows: auto auto;
  column-gap: 24px; row-gap: 12px;
  align-items: end;
}
.drawer.wide .detail-info > .field-name { grid-area: name; }
.drawer.wide .detail-info > .field-attrs { grid-area: attrs; }
.drawer.wide .detail-info > .field-tags { grid-area: tags; }
.drawer.wide .detail-info > .detail-actions { grid-area: actions; }
.drawer.wide .detail-info .field-name,
.drawer.wide .detail-info .field-attrs,
.drawer.wide .detail-info .field-tags { margin-bottom: 0; }
.drawer.wide .detail-actions {
  display: grid; grid-template-columns: 1.25fr 1fr .8fr;
  gap: 8px; margin: 0; padding: 0; border: 0;
}
.drawer.wide .detail-actions .btn { min-width: 0; padding: 0 10px; font-size: 13.5px; }
.drawer.wide .detail-actions #dl-btn { min-width: 0; }

/* 4) 窄屏：单列顺序恢复 名称 → 属性 → 标签 → 按钮，按钮两行铺满 */
@media (max-width: 900px) {
  #drawer-body, .drawer.wide #drawer-body,
  .detail-layout, .drawer.wide .detail-layout { height: auto; flex: 0 0 auto; }
  .detail-layout,
  .drawer.wide .detail-layout {
    grid-template-areas: "head" "media" "info";
    grid-template-rows: auto auto auto;
  }
  .detail-info,
  .drawer.wide .detail-info { display: flex; flex-direction: column; align-items: stretch; }
  .detail-media .hero .thumb,
  .drawer.wide .detail-media .hero .thumb { max-height: 40vh; }
  .drawer.wide .detail-info .field-name,
  .drawer.wide .detail-info .field-attrs,
  .drawer.wide .detail-info .field-tags { margin-bottom: 10px; }
  .detail-actions,
  .drawer.wide .detail-actions { grid-template-columns: 1fr 1fr; }
  .detail-actions #dl-btn,
  .drawer.wide .detail-actions #dl-btn { grid-column: 1 / -1; }
}
