/* 彩盛花边图库（团队版） — 界面样式 */
:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --surface-3: #f1ede6;
  --line: #e7e1d8;
  --line-strong: #d8d0c4;
  --text: #241f1c;
  --text-2: #57504a;
  --muted: #8b8177;
  --accent: #9a3f5c;
  --accent-dark: #7d3049;
  --accent-soft: #f8eef1;
  --ok: #2f7d5b;
  --ok-soft: #eaf4ef;
  --warn: #a9752a;
  --shadow-sm: 0 1px 2px rgba(40, 32, 26, .06), 0 1px 1px rgba(40, 32, 26, .04);
  --shadow-md: 0 6px 20px -6px rgba(40, 32, 26, .18), 0 2px 6px rgba(40, 32, 26, .05);
  --shadow-lg: 0 24px 60px -20px rgba(40, 32, 26, .32), 0 6px 18px rgba(40, 32, 26, .08);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --top: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: #f0d6de; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d9d1c5; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c4b9aa; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------- 顶栏 ------------------------------- */
.topbar {
  position: relative;
  z-index: 40;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px 0 18px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand .mark { width: 32px; height: 32px; color: var(--accent); flex: none; }
.brand-txt { display: flex; align-items: baseline; gap: 7px; }
.brand-txt strong { font-size: 15.5px; letter-spacing: .3px; font-weight: 650; }
.badge {
  font-size: 10.5px; letter-spacing: .5px; color: var(--accent);
  background: var(--accent-soft); border: 1px solid #eddcE3;
  padding: 1px 6px; border-radius: 20px; font-weight: 600;
}

.search-wrap {
  flex: 1; max-width: 520px; position: relative; display: flex; align-items: center;
  background: var(--surface-3); border: 1px solid transparent; border-radius: 8px;
  transition: .18s;
}
.search-wrap:focus-within { background: #fff; border-color: #dcc3cc; box-shadow: 0 0 0 3px rgba(154, 63, 92, .09); }
.search-wrap .ic { width: 16px; height: 16px; margin-left: 11px; color: var(--muted); flex: none; }
.search-wrap input {
  flex: 1; border: 0; background: transparent; outline: none; padding: 8px 8px;
  font-size: 13px;
}
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-wrap kbd {
  font-size: 10.5px; color: var(--muted); background: #fff; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; margin-right: 8px; font-family: inherit;
}

.actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  font-size: 12.8px; font-weight: 550; white-space: nowrap;
  transition: .16s; box-shadow: var(--shadow-sm);
}
.btn .ic { width: 15px; height: 15px; }
.btn:hover { border-color: #c6bbac; background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent-dark); color: #fff;
  box-shadow: 0 1px 2px rgba(125, 48, 73, .3), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn.primary:hover { background: var(--accent-dark); border-color: #642537; }
.btn.ghost { background: rgba(255,255,255,.6); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; box-shadow: none; }
.btn.danger { color: #a23a3a; border-color: #e4c9c9; }
.btn.danger:hover { background: #fdf3f3; border-color: #d9adad; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.sync {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted);
  padding-left: 4px; user-select: none;
}
.sync i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft); transition: .3s;
}
.sync.off i { background: #b9532e; box-shadow: 0 0 0 3px #fbeae3; }
.sync.busy i { background: var(--warn); box-shadow: 0 0 0 3px #fbf1e0; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ------------------------------- 布局 ------------------------------- */
.layout {
  display: flex; height: calc(100vh - var(--top));
}

.side {
  width: 246px; flex: none; background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto; padding: 14px 12px 40px;
}
.side::-webkit-scrollbar { width: 8px; }

.side-block { margin-bottom: 20px; }
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 7px; font-size: 11px; letter-spacing: 1px;
  color: var(--muted); font-weight: 600;
}
.side-head button {
  border: 0; background: transparent; color: var(--muted); font-size: 11.5px;
  letter-spacing: 0; padding: 1px 4px; border-radius: 4px;
}
.side-head button:hover { background: var(--surface-3); color: var(--accent); }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 9px 10px 8px;
}
.stat b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.2px; line-height: 1.15; }
.stat span { font-size: 11px; color: var(--muted); }
.stat em { display: block; font-style: normal; font-size: 10.5px; color: var(--ok); margin-top: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: 0; background: transparent; border-radius: 7px;
  font-size: 12.8px; color: var(--text-2); text-align: left; transition: .13s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.08); }
.nav-item .cnt { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item.on .cnt { color: var(--accent); }

.fac-item { display: flex; align-items: center; gap: 7px; }
.fac-item .av {
  width: 20px; height: 20px; border-radius: 5px; flex: none;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line);
}
.fac-item.on .av { background: #fff; color: var(--accent); border-color: #e6cdd5; }
.fac-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 内容区 */
.content { flex: 1; min-width: 0; overflow-y: auto; padding: 0 22px 60px; }

.toolbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0 12px;
  background: linear-gradient(var(--bg) 72%, rgba(244, 242, 238, 0));
}
.crumb { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.crumb b { color: var(--text); font-weight: 600; font-size: 13.5px; }
.crumb .sep { color: #c4bbaf; }
.crumb .chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 2px 4px 2px 9px; font-size: 11.5px; color: var(--text-2);
}
.crumb .chip button { border: 0; background: transparent; color: var(--muted); line-height: 1; padding: 0 3px; font-size: 13px; }
.crumb .chip button:hover { color: var(--accent); }

.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.select-wrap { position: relative; }
.select-wrap select {
  appearance: none; height: 28px; padding: 0 24px 0 10px;
  border: 1px solid var(--line-strong); border-radius: 7px; background: #fff;
  font-size: 12px; color: var(--text-2); outline: none; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.select-wrap.dim select { border-color: var(--line); color: var(--muted); box-shadow: none; }
.select-wrap::after {
  content: ""; position: absolute; right: 9px; top: 50%; width: 5px; height: 5px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.select-wrap select:focus { border-color: #dcc3cc; box-shadow: 0 0 0 3px rgba(154,63,92,.08); }

/* ------------------------------- 卡片网格 ------------------------------- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
}
.grid.large { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.compact { grid-template-columns: 1fr; gap: 6px; }

.card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; cursor: pointer;
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s, border-color .18s;
  box-shadow: var(--shadow-sm);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(154,63,92,.18), var(--shadow-md); }

.card .ph {
  position: relative; aspect-ratio: 4 / 3; background: var(--surface-3); overflow: hidden;
}
.card .ph img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
.card:hover .ph img { transform: scale(1.035); }
.card .row-no { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.card .no-mono {
  font-size: 11.5px; font-weight: 650; color: var(--text-2); letter-spacing: .2px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.card .w-tag {
  margin-left: auto; font-size: 11px; font-weight: 700; color: #3d342e;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 6px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.card .w-tag.none { color: #b3a89a; background: transparent; border-style: dashed; font-weight: 500; }
.card .cat-tag {
  position: absolute; right: 8px; top: 8px; z-index: 2;
  font-size: 10px; color: #fff; background: rgba(52,42,38,.55);
  padding: 2px 6px; border-radius: 5px; backdrop-filter: blur(4px);
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .body { padding: 9px 11px 10px; }
.card .line1 { display: flex; align-items: baseline; gap: 6px; }
.card .fac { font-size: 12.6px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .fac.none { color: var(--muted); font-weight: 400; }
.card .price { margin-left: auto; font-size: 12.4px; font-weight: 650; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .price small { font-size: 10px; font-weight: 500; color: var(--muted); margin-left: 1px; }
.card .specs {
  margin-top: 5px; display: flex; gap: 8px; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden;
}
.card .specs i { font-style: normal; color: #c8c0b4; }

/* 密列表 */
.grid.compact .card { display: flex; align-items: center; gap: 12px; padding: 7px 12px 7px 8px; border-radius: 9px; }
.grid.compact .card .ph { width: 72px; height: 54px; aspect-ratio: auto; border-radius: 6px; flex: none; }
.grid.compact .card .body { padding: 0; flex: 1; min-width: 0; }
.grid.compact .card .no-mono { font-size: 11.8px; color: var(--text-2); font-weight: 600; }
.grid.compact .card .w-tag {
  margin-left: 0; background: none; border: 0; padding: 0;
  font-size: 11.5px; color: var(--text); font-weight: 600;
}
.grid.compact .card .row-no { margin-bottom: 2px; gap: 10px; }
.grid.compact .card .cat-tag { display: none; }
.grid.compact .card .specs { margin-top: 3px; }
.grid.compact .card .line1 { gap: 10px; }

.empty {
  text-align: center; padding: 70px 20px; color: var(--muted);
}
.empty svg { width: 46px; height: 46px; opacity: .35; margin-bottom: 10px; }
.empty h3 { margin: 0 0 6px; font-size: 14px; color: var(--text-2); font-weight: 600; }
.empty p { margin: 0; font-size: 12.5px; line-height: 1.9; }
.empty .btn { margin-top: 14px; }

/* ------------------------------- 详情抽屉 ------------------------------- */
.scrim {
  position: fixed; inset: 0; background: rgba(36, 31, 28, .28);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 50;
  backdrop-filter: blur(1.5px);
}
.scrim.on { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 436px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); z-index: 60;
  transform: translateX(102%); transition: transform .3s cubic-bezier(.3,.8,.3,1);
  display: flex; flex-direction: column;
}
.drawer.on { transform: none; }

.dr-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-bottom: 1px solid var(--line); flex: none;
}
.dr-head .no { font-size: 12px; font-weight: 650; letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.dr-head .state { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dr-head .state.saved { color: var(--ok); }
.dr-head .spacer { margin-left: auto; }
.x-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--muted); display: grid; place-items: center; font-size: 16px;
}
.x-btn:hover { background: var(--surface-3); color: var(--text); }

.dr-body { flex: 1; overflow-y: auto; padding: 0 0 24px; }
.dr-photo {
  position: relative; background: var(--surface-3); margin-bottom: 4px;
  max-height: 320px; overflow: hidden; display: grid; place-items: center;
}
.dr-photo img { width: 100%; max-height: 320px; object-fit: contain; display: block; }
.dr-photo .tools {
  position: absolute; inset: auto 10px 10px auto; display: flex; gap: 6px;
}
.dr-photo .tools button {
  background: rgba(255,255,255,.94); border: 1px solid rgba(0,0,0,.06); border-radius: 7px;
  height: 28px; padding: 0 9px; font-size: 11.5px; font-weight: 550; display: inline-flex;
  align-items: center; gap: 5px; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.dr-photo .tools button:hover { background: #fff; color: var(--accent); }

.sect { padding: 14px 16px 0; }
.sect-title {
  font-size: 11px; letter-spacing: 1px; color: var(--muted); font-weight: 600;
  margin-bottom: 9px; display: flex; align-items: center; gap: 6px;
}
.sect-title::after { content: ""; flex: 1; height: 1px; background: var(--line); order: 2; }
.sect-title .link { order: 3; letter-spacing: 0; font-size: 11.5px; padding: 1px 5px; }

.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld.full { grid-column: 1 / -1; }
.fld label { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.fld label u { text-decoration: none; font-size: 9.5px; color: #b9afa2; }
.fld input, .fld select, .fld textarea {
  height: 32px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: #fff; outline: none; font-size: 12.6px; width: 100%;
  transition: .15s; font-variant-numeric: tabular-nums;
}
.fld textarea { height: auto; min-height: 62px; padding: 7px 9px; resize: vertical; line-height: 1.6; }
.fld input:hover, .fld select:hover, .fld textarea:hover { border-color: #c9bdae; }
.fld input:focus, .fld select:focus, .fld textarea:focus {
  border-color: #cf9fb0; box-shadow: 0 0 0 3px rgba(154,63,92,.09);
}
.fld .unit { position: relative; }
.fld .unit input { padding-right: 34px; }
.fld .unit span {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 10.5px; color: #b0a699; pointer-events: none;
}
.fld select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #a89d90 50%), linear-gradient(135deg, #a89d90 50%, transparent 50%); background-position: calc(100% - 13px) 14px, calc(100% - 9px) 14px; background-size: 4px 4px; background-repeat: no-repeat; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 20px;
  padding: 4px 10px; font-size: 11.5px; color: var(--text-2);
}
.chip-btn:hover { border-color: #cf9fb0; color: var(--accent); }
.chip-btn.on { background: var(--accent-soft); border-color: #e3c4ce; color: var(--accent-dark); font-weight: 600; }

.dr-foot {
  flex: none; padding: 11px 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
}
.dr-foot .meta { font-size: 10.8px; color: var(--muted); line-height: 1.5; }
.dr-foot .grow { flex: 1; }

.similar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.sim-card {
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff;
  cursor: pointer; transition: .15s;
}
.sim-card:hover { border-color: #cf9fb0; box-shadow: var(--shadow-sm); }
.sim-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.sim-card .cap { padding: 3px 5px 4px; font-size: 10px; color: var(--muted); display: flex; justify-content: space-between; gap: 4px; }
.sim-card .cap b { color: var(--accent); font-weight: 650; }

/* ------------------------------- 弹窗 ------------------------------- */
.modal {
  position: fixed; z-index: 70; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.98);
  width: 760px; max-width: 94vw; max-height: 88vh; background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  opacity: 0; pointer-events: none; transition: .22s cubic-bezier(.3,.8,.3,1);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal.on { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.md-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px 12px; flex: none;
}
.md-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: .2px; }
.md-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
.md-head .x-btn { margin-left: auto; }
.md-body { padding: 0 18px 18px; overflow-y: auto; }

.drop-area {
  border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2);
  padding: 34px 20px; text-align: center; cursor: pointer; transition: .18s;
}
.drop-area:hover, .drop-area.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-area svg { width: 34px; height: 34px; color: var(--accent); opacity: .8; }
.drop-area h3 { margin: 8px 0 4px; font-size: 13.5px; font-weight: 600; }
.drop-area p { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.8; }

.result-head {
  display: flex; align-items: center; gap: 10px; margin: 16px 0 10px;
  font-size: 12px; color: var(--muted);
}
.result-head b { color: var(--text); font-size: 12.5px; }
.result-head .btn { margin-left: auto; }

.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.res-card {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff;
  cursor: pointer; transition: .15s; position: relative;
}
.res-card:hover { border-color: #cf9fb0; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.res-card.best { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(154,63,92,.14); }
.res-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--surface-3); }
.res-card .cap { padding: 6px 8px 7px; }
.res-card .cap .r1 { display: flex; align-items: center; gap: 5px; font-size: 11.8px; font-weight: 600; }
.res-card .cap .r2 { font-size: 10.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; }
.score {
  position: absolute; right: 6px; top: 6px; z-index: 2;
  font-size: 10.5px; font-weight: 700; color: #fff; padding: 2px 6px; border-radius: 20px;
  background: rgba(45, 38, 34, .62); backdrop-filter: blur(4px); font-variant-numeric: tabular-nums;
}
.score.hot { background: var(--accent); }

/* ------------------------------- 其它 ------------------------------- */
.toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(38, 32, 29, .94); color: #fff; padding: 8px 15px; border-radius: 22px;
  font-size: 12.3px; box-shadow: var(--shadow-md); animation: tin .26s cubic-bezier(.3,.8,.3,1);
  display: flex; align-items: center; gap: 7px; max-width: 80vw;
}
.toast.ok { background: rgba(38, 92, 68, .95); }
.toast.err { background: rgba(140, 48, 48, .95); }
@keyframes tin { from { opacity: 0; transform: translateY(8px) scale(.97); } }

.drop-hint {
  position: fixed; inset: 12px; z-index: 80; border: 2px dashed var(--accent);
  border-radius: 16px; background: rgba(248, 238, 241, .82); backdrop-filter: blur(3px);
  display: none; place-items: center; font-size: 16px; font-weight: 600; color: var(--accent-dark);
}
.drop-hint.on { display: grid; }

.progress-bar {
  position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 100;
  background: transparent; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.progress-bar.on { opacity: 1; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.progress-bar em {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  font-style: normal; font-size: 11px; color: var(--accent-dark); background: #fff;
  padding: 2px 9px; border-radius: 20px; box-shadow: var(--shadow-sm); border: 1px solid #eddcE3;
}

.skeleton { background: linear-gradient(100deg, #f1ede6 30%, #f8f5f0 50%, #f1ede6 70%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

@media (max-width: 1080px) {
  .side { display: none; }
  .content { padding: 0 14px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .search-wrap kbd { display: none; }
}
@media (max-width: 720px) {
  .brand-txt strong { font-size: 13.5px; }
  .actions .btn span, .sync span { display: none; }
}

/* ------------------------------- 资料库 ------------------------------- */
.lib {
  position: fixed; z-index: 65; left: 50%; top: 4vh; transform: translate(-50%, 10px) scale(.99);
  width: min(1060px, 94vw); height: 88vh; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; pointer-events: none; transition: .24s cubic-bezier(.3,.8,.3,1);
}
.lib.on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0) scale(1); }

.lib-head {
  display: flex; align-items: center; gap: 18px; padding: 15px 18px 13px;
  border-bottom: 1px solid var(--line); flex: none;
}
.lib-title h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.lib-title p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.lib-tabs {
  margin-left: auto; display: flex; gap: 2px; background: var(--surface-3);
  padding: 3px; border-radius: 9px;
}
.lib-tabs button {
  border: 0; background: transparent; padding: 5px 13px; border-radius: 7px;
  font-size: 12.3px; color: var(--text-2); font-weight: 550; transition: .15s;
}
.lib-tabs button:hover { color: var(--text); }
.lib-tabs button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

.lib-body { flex: 1; overflow-y: auto; padding: 16px 18px 22px; }

.cat-add { display: flex; gap: 8px; margin-bottom: 14px; }
.cat-add input {
  flex: 1; height: 34px; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 0 10px; font-size: 12.5px; outline: none; background: #fff; min-width: 0;
}
.cat-add input:focus { border-color: #cf9fb0; box-shadow: 0 0 0 3px rgba(154, 63, 92, .08); }

.cat-table { width: 100%; border-collapse: collapse; font-size: 12.3px; }
.cat-table th {
  text-align: left; font-size: 11px; letter-spacing: .5px; color: var(--muted);
  font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.cat-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cat-table tbody tr:hover td { background: var(--surface-2); }
.cat-table td.nm { font-weight: 600; }
.cat-table td.nm .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 8px; vertical-align: 1px; border: 1px solid rgba(0,0,0,.08);
}
.cat-table td.ops { white-space: nowrap; }
.cat-table .link { font-size: 11.8px; }

.lib-note { margin: 14px 2px 0; font-size: 11.5px; color: var(--muted); line-height: 1.75; }
.dim-note { font-size: 11.3px; color: #a89d90; line-height: 1.6; }
.side-empty { padding: 4px 9px 6px; font-size: 11.5px; color: #a89d90; line-height: 1.6; }

.cat-inline { display: flex; gap: 6px; margin-top: 9px; }
.cat-inline[hidden] { display: none; }
.cat-inline input {
  flex: 1; height: 28px; border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 0 8px; font-size: 12px; outline: none; background: #fff; min-width: 0;
}
.cat-inline input:focus { border-color: #cf9fb0; box-shadow: 0 0 0 3px rgba(154, 63, 92, .08); }

.cat-empty { padding: 14px 10px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }

.fac-add { display: grid; grid-template-columns: 1.3fr .9fr 1fr 1.9fr auto; gap: 8px; margin-bottom: 14px; }
.fac-add input {
  height: 32px; border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 0 9px; font-size: 12.3px; outline: none; width: 100%; background: #fff;
}
.fac-add input:focus { border-color: #cf9fb0; box-shadow: 0 0 0 3px rgba(154, 63, 92, .08); }

.fac-table, .log-table { width: 100%; border-collapse: collapse; font-size: 12.3px; }
.fac-table th, .log-table th {
  text-align: left; font-size: 11px; letter-spacing: .5px; color: var(--muted);
  font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.fac-table td, .log-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.fac-table tbody tr:hover td { background: var(--surface-2); }
.fac-table td.nm { font-weight: 600; }
.fac-table input {
  width: 100%; height: 27px; border: 1px solid transparent; border-bottom: 1px dashed #e2d9cc;
  border-radius: 6px; padding: 0 6px; font-size: 12.2px; background: transparent; outline: none;
}
.fac-table input:hover { border-color: var(--line); background: #fff; }
.fac-table input:focus { border-color: #cf9fb0; background: #fff; box-shadow: 0 0 0 3px rgba(154, 63, 92, .08); }
th.num, td.num { text-align: right; }
.link { border: 0; background: transparent; color: var(--accent); font-size: 12px; padding: 2px 5px; border-radius: 5px; }
.link:hover { background: var(--accent-soft); }
.link.danger { color: #a23a3a; }
.link.danger:hover { background: #fdf3f3; }
.dim { color: var(--muted); }
.log-table td.mono { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 11.8px; white-space: nowrap; }
.log-table td.detail { color: var(--text-2); }

@media (max-width: 900px) {
  .cat-grid { grid-template-columns: 1fr; }
  .fac-add { grid-template-columns: 1fr 1fr; }
  .lib-head { flex-wrap: wrap; gap: 10px; }
  .lib-tabs { margin-left: 0; }
}

/* ------------------------------- 多选下载 ------------------------------- */
.btn.on {
  background: var(--accent-soft); border-color: #e3c4ce; color: var(--accent-dark);
  font-weight: 600;
}
.card .ph .pick-box {
  position: absolute; left: 8px; top: 8px; z-index: 3;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(255, 255, 255, .94); border: 1.5px solid rgba(60, 48, 40, .22);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .16);
  transition: background .15s, border-color .15s;
}
.card .ph .pick-box::after {
  content: ""; position: absolute; left: 5px; top: 2.6px; width: 4.4px; height: 8.4px;
  border: solid #fff; border-width: 0 1.8px 1.8px 0; transform: rotate(40deg);
  opacity: 0; transition: opacity .12s;
}
.card.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-md); }
.card.picked .pick-box { background: var(--accent); border-color: var(--accent); }
.card.picked .pick-box::after { opacity: 1; }
.card.picked .ph img { opacity: .9; }
.grid.compact .card .ph .pick-box { width: 15px; height: 15px; left: 5px; top: 5px; }
.grid.compact .card .ph .pick-box::after { left: 4px; top: 1.6px; width: 4px; height: 7.4px; }

.pickbar {
  position: fixed; left: 50%; bottom: -80px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: #2f2a26; color: #f3ece4; border-radius: 14px;
  padding: 10px 10px 10px 18px; box-shadow: 0 14px 34px rgba(0, 0, 0, .3);
  z-index: 60; opacity: 0; pointer-events: none;
  transition: bottom .26s cubic-bezier(.3, .8, .3, 1), opacity .2s;
}
.pickbar.on { bottom: 24px; opacity: 1; pointer-events: auto; }
body.picking .toasts { bottom: 88px; }
.toasts { transition: bottom .26s cubic-bezier(.3,.8,.3,1); }
.pickbar b { font-variant-numeric: tabular-nums; font-size: 13.5px; }
.pk-count { font-size: 12.5px; color: #efe6db; white-space: nowrap; }
.pk-sep { width: 1px; height: 18px; background: rgba(255, 255, 255, .16); margin: 0 5px; }
.pickbar button {
  border: 0; background: rgba(255, 255, 255, .1); color: #f3ece4;
  font-size: 12.6px; padding: 7px 12px; border-radius: 9px; transition: .15s; white-space: nowrap;
}
.pickbar button:hover { background: rgba(255, 255, 255, .2); }
.pickbar .pk-dl { background: var(--accent); color: #fff; font-weight: 600; padding: 7px 16px; }
.pickbar .pk-dl:hover { background: #8d3550; }
.pickbar .pk-dl[disabled] { opacity: .4; pointer-events: none; }
.pickbar .pk-x {
  background: transparent; font-size: 18px; line-height: 1; padding: 3px 8px 6px;
  color: rgba(255, 255, 255, .55);
}
.pickbar .pk-x:hover { background: transparent; color: #fff; }

/* ------------------------------- 账号与登录 ------------------------------- */

.acct { position: relative; flex: none; }
.acct-btn {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 7px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: #fff;
  box-shadow: var(--shadow-sm); transition: .16s; text-align: left;
}
.acct-btn:hover { border-color: #c6bbac; background: var(--surface-2); }
.acct-btn .av {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 650;
}
.acct-btn .av svg { width: 13px; height: 13px; }
.acct-btn .av.on { background: linear-gradient(140deg, #9a3f5c, #b8627c); color: #fff; }
.acct-btn .txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.acct-btn .txt b { font-size: 12.2px; font-weight: 600; white-space: nowrap; }
.acct-btn .txt em { font-style: normal; font-size: 10px; color: var(--muted); white-space: nowrap; }

.acct-menu {
  position: absolute; right: 0; top: 42px; z-index: 80; min-width: 196px;
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow-lg); padding: 5px; animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.acct-menu .mi-head {
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 9px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.acct-menu .mi-head b { font-size: 12.4px; }
.acct-menu .mi-head span { font-size: 10.5px; color: var(--muted); }
.acct-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 7px 9px; border-radius: 7px; font-size: 12.3px; color: var(--text);
}
.acct-menu button:hover { background: var(--surface-3); }
.acct-menu button.mi-danger { color: #a23a3a; }
.acct-menu button.mi-danger:hover { background: #fdf3f3; }

/* 锁定标记：没登录时给受限按钮加一把小锁 */
.btn.locked { position: relative; }
.btn.locked::after {
  content: ""; position: absolute; right: -5px; top: -5px; width: 13px; height: 13px;
  border-radius: 50%; border: 1px solid #ded5c7; background-color: #fff;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8177' stroke-width='2.8' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2.4'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 8px 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.login {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(36, 31, 28, .38); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.login.on { opacity: 1; pointer-events: auto; }
.login-card {
  position: relative; width: 372px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 16px; border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); padding: 26px 26px 20px;
  animation: lgIn .22s cubic-bezier(.3, .8, .3, 1);
}
@keyframes lgIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.login-card .x-btn { position: absolute; right: 12px; top: 10px; }
.lg-mark { width: 34px; height: 34px; color: var(--accent); margin-bottom: 12px; }
.lg-mark svg { width: 100%; height: 100%; }
.login-card h2 { margin: 0 0 5px; font-size: 17px; letter-spacing: .2px; }
.login-card .lg-sub { margin: 0 0 15px; font-size: 11.8px; color: var(--muted); line-height: 1.55; }
.lg-reason {
  background: var(--accent-soft); border: 1px solid #eddcE3; color: var(--accent-dark);
  border-radius: 9px; padding: 8px 10px; font-size: 11.8px; margin-bottom: 13px; line-height: 1.5;
}
.lg-fld { display: block; margin-bottom: 11px; }
.lg-fld span { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 5px; }
.lg-fld input {
  width: 100%; height: 37px; border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 0 11px; font-size: 13px; outline: none; background: #fff; transition: .15s;
}
.lg-fld input:focus { border-color: #cf9fb0; box-shadow: 0 0 0 3px rgba(154, 63, 92, .1); }
.lg-err {
  background: #fdf3f3; border: 1px solid #eccdcd; color: #a23a3a;
  border-radius: 8px; padding: 7px 10px; font-size: 11.8px; margin-bottom: 11px;
}
.lg-submit { width: 100%; justify-content: center; height: 38px; margin-top: 3px; }
.lg-foot { margin: 13px 0 0; font-size: 10.8px; color: var(--muted); text-align: center; }

/* 详情抽屉只读态 */
.ro-bar {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  background: #fdf8ef; border: 1px solid #efe2ca; color: #8a6a35;
  border-radius: 9px; padding: 8px 10px; font-size: 11.5px; line-height: 1.45;
}
.ro-bar svg { width: 13px; height: 13px; flex: none; }
.ro-bar span { flex: 1; }
.ro-bar button {
  flex: none; border: 1px solid #e0cba6; background: #fff; color: #8a6a35;
  border-radius: 7px; padding: 4px 9px; font-size: 11.2px; font-weight: 600;
}
.ro-bar button:hover { background: #fbf0dc; }
.ro-tag {
  font-size: 10.5px; color: var(--muted); background: var(--surface-3);
  border-radius: 20px; padding: 2px 8px; margin-left: 4px;
}
.locked-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px;
  border: 1px solid rgba(0, 0, 0, .07); border-radius: 7px;
  background: rgba(255, 255, 255, .94); font-size: 11.5px; font-weight: 550;
  color: var(--muted); box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.locked-btn:hover { color: var(--accent); border-color: #e4cdd5; }
#drawer input[readonly] { background: var(--surface-2); color: var(--text-2); cursor: default; }
#drawer input[readonly]:focus { border-color: var(--line-strong); box-shadow: none; }
#drawer textarea[readonly] { background: var(--surface-2); color: var(--text-2); cursor: default; }
#drawer textarea[readonly]:focus { border-color: var(--line-strong); box-shadow: none; }
.chip-btn[disabled] { cursor: default; opacity: .85; }
.chip-btn[disabled]:hover { border-color: var(--line-strong); }

/* 账号管理 */
.user-add { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.user-add input, .user-add select {
  height: 32px; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 0 10px; font-size: 12.3px; outline: none; background: #fff;
}
.user-add input[name=username] { flex: 1.2; min-width: 160px; }
.user-add input[name=password] { flex: 1; min-width: 140px; }
.user-add select { flex: none; }
.user-add input:focus, .user-add select:focus { border-color: #cf9fb0; box-shadow: 0 0 0 3px rgba(154, 63, 92, .08); }
.user-table { width: 100%; border-collapse: collapse; font-size: 12.2px; }
.user-table th {
  text-align: left; font-weight: 600; font-size: 11.2px; color: var(--muted);
  padding: 0 8px 7px; border-bottom: 1px solid var(--line);
}
.user-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.user-table tr.me td { background: #fdfaf6; }
.user-table td.nm { display: flex; align-items: center; gap: 8px; }
.u-av {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); font-size: 11px; font-weight: 650; color: var(--text-2);
}
.u-me {
  font-size: 10px; color: var(--accent); background: var(--accent-soft);
  border-radius: 20px; padding: 1px 7px;
}
.mini-select {
  height: 27px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; padding: 0 6px; font-size: 11.8px; outline: none;
}
.mini-select:focus { border-color: #cf9fb0; }

@media (max-width: 1000px) {
  .acct-btn .txt { display: none; }
  .acct-btn { padding: 0 6px; }
}
@media (max-width: 980px) {
  .sync span { display: none; }
}

/* ------------------------------- 未登录：只留图片与尺寸 ------------------------------- */

body.is-guest .side { display: none; }
body.is-guest .search-wrap { display: none; }
body.is-guest #sort { display: none; }
body.is-guest .toolbar { padding-top: 10px; }

.guest-bar {
  display: flex; align-items: center; gap: 9px;
  margin: 14px 0 0; padding: 9px 12px;
  background: #fdf8ef; border: 1px solid #efe2ca; border-radius: 10px;
  font-size: 11.8px; color: #8a6a35; line-height: 1.55;
}
.guest-bar[hidden] { display: none; }
.guest-bar svg { width: 14px; height: 14px; flex: none; }
.guest-bar span { flex: 1; }
.guest-bar b { font-weight: 650; }
.guest-bar .btn { flex: none; }

.card.guest-card { cursor: pointer; }
.card.guest-card .ph { aspect-ratio: 4 / 3; }
.card.guest-card .guest-size {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  font-size: 10.5px; color: #fff; background: rgba(45, 38, 34, .6);
  padding: 2px 7px; border-radius: 20px; backdrop-filter: blur(4px);
  font-variant-numeric: tabular-nums;
}
.grid.compact .card.guest-card { padding: 7px; }
.grid.compact .card.guest-card .ph { width: 100%; height: auto; }

.guest-tip {
  color: #a07d33; background: #fdf8ef; border: 1px solid #efe2ca;
  border-radius: 20px; padding: 1px 8px; font-size: 11px;
}

.gv-body { padding: 0 0 24px; }
.gv-photo { background: var(--surface-3); }
.gv-meta { display: flex; gap: 10px; padding: 14px 16px 0; }
.gv-row {
  flex: 1; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px 10px;
}
.gv-row span { display: block; font-size: 11px; color: var(--muted); }
.gv-row b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gv-row b small { font-size: 11px; color: var(--muted); font-weight: 500; }
.gv-note {
  display: flex; gap: 8px; margin: 14px 16px 0; padding: 9px 11px;
  background: #fdf8ef; border: 1px solid #efe2ca; border-radius: 9px;
  color: #8a6a35; font-size: 11.5px; line-height: 1.6;
}
.gv-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.gv-login { margin: 14px 16px 0; width: calc(100% - 32px); justify-content: center; }

/* ------------------------------- 账号与权限面板 ------------------------------- */

.user-add {
  display: block; margin-bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px 14px;
}
.ua-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.ua-head b { font-size: 12.8px; }
.ua-head span { font-size: 11.3px; color: var(--muted); }
.ua-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ua-row input {
  height: 32px; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 0 10px; font-size: 12.3px; outline: none; background: #fff;
}
.ua-row input[name=username] { flex: 1.2; min-width: 170px; }
.ua-row input[name=password] { flex: 1; min-width: 150px; }
.ua-row input:focus { border-color: #cf9fb0; box-shadow: 0 0 0 3px rgba(154, 63, 92, .08); }

.preset-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 11px 0 9px; }
.pb-label { font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.pb-hint { font-size: 10.8px; color: #b3a89a; margin-left: 2px; }
.preset {
  border: 1px dashed var(--line-strong); background: #fff; color: var(--text-2);
  border-radius: 20px; padding: 3px 10px; font-size: 11.4px;
}
.preset:hover { border-color: #cf9fb0; color: var(--accent); background: var(--accent-soft); }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(224px, 1fr)); gap: 10px; }
.perm-group {
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 9px 10px 7px;
}
.pg-title { font-size: 10.8px; letter-spacing: 1px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.perm-item {
  display: flex; gap: 7px; align-items: flex-start;
  padding: 4px 3px; border-radius: 6px; cursor: pointer;
}
.perm-item:hover { background: var(--surface-2); }
.perm-item input { margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.pi-txt { display: flex; flex-direction: column; line-height: 1.45; min-width: 0; }
.pi-txt b { font-size: 12px; font-weight: 600; }
.pi-txt i { font-style: normal; font-size: 10.6px; color: var(--muted); }

.user-table .perm-cell { vertical-align: middle; }
.perm-list { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-chip {
  font-size: 10.5px; color: var(--text-2); background: var(--surface-3);
  border: 1px solid var(--line); border-radius: 20px; padding: 1px 7px; white-space: nowrap;
}
.perm-all {
  font-size: 10.8px; color: var(--accent-dark); background: var(--accent-soft);
  border: 1px solid #eddcE3; border-radius: 20px; padding: 1px 8px;
}
.perm-none {
  font-size: 10.8px; color: var(--muted); border: 1px dashed var(--line-strong);
  border-radius: 20px; padding: 1px 8px;
}
.role-tag {
  font-size: 10.8px; border-radius: 20px; padding: 1px 8px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line);
}
.role-tag.admin { background: var(--accent-soft); color: var(--accent-dark); border-color: #eddcE3; }

.perm-row td { background: var(--surface-2); padding: 0 8px 12px; }
.perm-edit { padding: 11px 12px 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.pr-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pr-hint { font-size: 10.8px; color: var(--muted); }
.user-table .ops { white-space: nowrap; }
.user-table .ops .link { display: inline-block; }
.user-table button.link[disabled] { opacity: .4; pointer-events: none; }

/* ==========================================================================
   生产化增强：加载态 / 离线 / 忙碌态 / 移动端 / 回收站 / 可访问性
   ========================================================================== */

/* ------------------------------ 通用状态 ------------------------------ */

.btn.busy { cursor: progress; opacity: .82; }
.btn.busy::before {
  content: ""; width: 12px; height: 12px; flex: none; margin-right: 2px;
  border: 1.7px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.fld input.bad, .fld textarea.bad, .ua-row input.bad, input.bad {
  border-color: #c25b5b !important;
  background: #fdf6f6 !important;
  box-shadow: 0 0 0 3px rgba(194, 91, 91, .08) !important;
}

:focus-visible { outline: 2px solid #b06a86; outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

/* 首屏骨架 */
.card.skel-card { cursor: default; box-shadow: none; pointer-events: none; }
.card.skel-card:hover { transform: none; box-shadow: none; border-color: var(--line); }
.card.skel-card .ph { width: 100%; aspect-ratio: 4 / 3; background: #f1ede6; }
.skel-line {
  height: 10px; border-radius: 6px; margin: 9px 12px;
  background: linear-gradient(100deg, #f1ede6 30%, #f8f5f0 50%, #f1ede6 70%);
  background-size: 200% 100%; animation: sk 1.2s infinite;
}
.skel-line.w70 { width: 70%; }
.skel-line.w45 { width: 45%; }
.card.skel-card .body { padding-bottom: 14px; }

#grid[aria-busy="true"] { pointer-events: none; }
.empty .btn { margin-top: 12px; }
.empty h3 { margin-bottom: 6px; }

/* 离线提示条 */
.net-bar {
  display: flex; align-items: center; gap: 9px;
  margin: 10px 0 0; padding: 8px 12px;
  background: #fdf6e8; border: 1px solid #eeddb8; border-radius: 9px;
  color: #8a6a35; font-size: 12px; line-height: 1.5;
}
.net-bar[hidden] { display: none; }
.net-bar svg { width: 15px; height: 15px; flex: none; }
.net-bar span { flex: 1; }
.net-bar .btn { flex: none; }
body.net-off .sync { color: #a9752a; }
body.net-off .sync i { background: #d6a24a; }

/* 移动端侧栏开关 */
.side-toggle {
  display: none; width: 34px; height: 34px; flex: none;
  align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); background: #fff; border-radius: 8px;
  color: var(--text-2); box-shadow: var(--shadow-sm);
}
.side-toggle svg { width: 17px; height: 17px; }
.side-toggle:hover { border-color: #c6bbac; color: var(--accent); }

.side-veil { display: none; }

.side-foot {
  margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; color: #b3a89a; letter-spacing: .3px;
}

/* 回收站 */
.trash-table { width: 100%; border-collapse: collapse; font-size: 12.3px; }
.trash-table th {
  text-align: left; font-size: 10.8px; letter-spacing: .6px; color: var(--muted);
  font-weight: 600; padding: 0 8px 9px; border-bottom: 1px solid var(--line);
}
.trash-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.trash-table tr:last-child td { border-bottom: 0; }
.trash-table .ops { white-space: nowrap; }
.trash-thumb {
  width: 44px; height: 34px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface-3); display: block;
}
.cat-empty b { display: block; color: var(--text-2); font-weight: 600; }

/* 账号状态 */
.u-off {
  font-size: 10.5px; color: #a23a3a; background: #fdf3f3;
  border: 1px solid #e9cccc; border-radius: 20px; padding: 1px 7px;
}
.user-table tr.off td { opacity: .62; }
.user-table tr.off .ops { opacity: 1; }
.user-table .ops .link { margin-right: 2px; }

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

@media (max-width: 1080px) {
  .side-toggle { display: inline-flex; }
  .side-veil:not([hidden]) {
    display: block; position: fixed; inset: 0; z-index: 69;
    background: rgba(30, 24, 20, .34); backdrop-filter: blur(1px);
  }
  body.side-open .side {
    display: block; position: fixed; z-index: 70; top: 0; left: 0; bottom: 0;
    width: min(310px, 86vw); padding: 16px 14px calc(20px + env(safe-area-inset-bottom));
    background: var(--surface); overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: sideIn .2s cubic-bezier(.3, .8, .3, 1);
  }
  @keyframes sideIn { from { transform: translateX(-12px); opacity: .6; } }
  body.side-open { overflow: hidden; }
}

@media (max-width: 900px) {
  .lib { width: 100vw; height: 100vh; max-height: none; top: 0; left: 0; transform: none; border-radius: 0; }
  .lib.on { transform: none; }
  .lib-head { padding: 12px 14px; gap: 10px; }
  .lib-title p { display: none; }
  .lib-tabs { overflow-x: auto; max-width: 100%; }
  .lib-body { padding: 14px 12px 24px; }
  .user-table, .cat-table, .fac-table, .log-table, .trash-table { display: block; overflow-x: auto; white-space: nowrap; }
  .user-table td, .user-table th { white-space: nowrap; }
}

@media (max-width: 720px) {
  :root { --top: 56px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .brand-txt .badge { display: none; }
  .brand-txt strong { font-size: 13.5px; }
  .brand .mark { width: 27px; height: 27px; }
  .actions { gap: 6px; }
  .actions .btn { padding: 0 9px; height: 32px; font-size: 12px; }
  .actions .btn .ic { width: 14px; height: 14px; }
  .sync { display: none; }
  .search-wrap { max-width: none; min-width: 0; }
  .content { padding: 0 10px calc(70px + env(safe-area-inset-bottom)); }
  .toolbar { flex-wrap: wrap; gap: 8px; padding: 10px 0 8px; }
  .tools { margin-left: 0; width: 100%; flex-wrap: wrap; gap: 6px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 9px; }
  .grid.large { grid-template-columns: 1fr; }
  .drawer { width: 100vw; max-width: 100vw; }
  .lib { width: 100vw; height: 100dvh; }
  .login-card { padding: 22px 18px 18px; }
  .toasts { width: calc(100vw - 24px); }
  .toast { max-width: 100%; text-align: center; }
  .pickbar { width: calc(100vw - 16px); left: 8px; transform: none; bottom: 10px; padding-left: 12px; gap: 4px; }
  .pickbar .pk-sep { display: none; }
  .pickbar button { padding: 0 8px; font-size: 11.5px; }
  body.picking .toasts { bottom: 96px; }
  .guest-bar { flex-wrap: wrap; }
  .guest-bar .btn { width: 100%; justify-content: center; }
  .f-grid { grid-template-columns: 1fr; }
  .ua-row input { min-width: 0; flex: 1 1 100%; }
  .ua-row .btn { width: 100%; justify-content: center; }
  .perm-grid { grid-template-columns: 1fr; }
  .user-add { padding: 12px; }
  .net-bar { flex-wrap: wrap; }
  .net-bar .btn { width: 100%; justify-content: center; }
  .dr-photo .tools { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 480px) {
  .brand-txt { display: none; }
  .actions #btnImgSearch { width: 32px; padding: 0; font-size: 0; gap: 0; justify-content: center; }
  .actions #btnImgSearch .ic { width: 16px; height: 16px; }
  .actions #btnUpload { padding: 0 9px; }
  .toolbar .crumb { width: 100%; }
}

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

/* 未登录时没有可筛选的内容，移动端菜单入口也一并隐藏 */
body.is-guest .side-toggle { display: none !important; }

/* 手机端侧栏顶部：标题 + 关闭 */
.side-mhead { display: none; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.side-mhead b { font-size: 13px; letter-spacing: .3px; }
.side-mhead button {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 17px; line-height: 1;
}
@media (max-width: 1080px) {
  body.side-open .side-mhead { display: flex; }
}

/* ---------------------------- 资料库 · 系统状态 ---------------------------- */

.sys-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.sys-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.sys-card b { font-size: 11.5px; color: var(--muted); font-weight: 500; letter-spacing: .2px; }
.sys-card span { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.sys-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.sys-result {
  border-radius: var(--r-md);
  padding: 11px 13px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.3px;
}
.sys-result.ok { border-color: #cfe6da; background: var(--ok-soft); }
.sys-result.bad { border-color: #f0d3d3; background: #fdf1f1; }
.sys-result b { font-size: 12.5px; }
.sys-result.ok b { color: var(--ok); }
.sys-result.bad b { color: var(--accent); }
.sys-result em { color: var(--muted); font-style: normal; font-size: 11.5px; }
.sys-list { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 11.8px; }
.sys-list li { line-height: 1.7; overflow-wrap: anywhere; }

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

/* ---------------- 批量编辑 / 操作记录筛选 / 站点设置 ---------------- */

.pickbar button[disabled] { opacity: .4; pointer-events: none; }
.pickbar button.locked { opacity: .6; }

.batch-form { display: flex; flex-direction: column; gap: 14px; }
.bf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.bf-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); }
.bf-grid input {
  height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  padding: 0 9px; font-size: 12.5px; color: var(--text); font-family: inherit; width: 100%;
}
.bf-grid input:focus, .sys-setting input:focus, .log-filter select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.bf-cats { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; }
.bf-cats legend { font-size: 11.5px; color: var(--muted); padding: 0 6px; }
.bf-modes { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.bf-modes label, .bf-cat-list label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.bf-cat-list { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12.2px; color: var(--text-2); }
.bf-actions { display: flex; justify-content: flex-end; gap: 8px; }

.log-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.log-filter select {
  height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  padding: 0 9px; font-size: 12.5px; color: var(--text); font-family: inherit; min-width: 110px;
}
.log-filter .pr-hint { margin-left: auto; }

.sys-setting {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 14px; font-size: 12px; color: var(--text-2);
}
.sys-setting label { display: inline-flex; align-items: center; gap: 8px; }
.sys-setting input {
  width: 92px; height: 32px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); padding: 0 9px; font-size: 12.5px; color: var(--text); font-family: inherit;
}

@media (max-width: 720px) {
  .bf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log-filter .pr-hint { margin-left: 0; }
}
@media (max-width: 480px) {
  .bf-grid { grid-template-columns: 1fr; }
  .log-filter select { flex: 1 1 45%; min-width: 0; }
}

/* 弹窗/资料库打开时，手机上的提示条移到顶部，避免盖住操作按钮 */
@media (max-width: 720px) {
  body.dialog-open .toasts { top: calc(var(--top) + 10px); bottom: auto; }
}
