/* =========================================================
   素材分发平台 · 设计系统
   ========================================================= */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --line: #e8eaf1;
  --line-strong: #d8dce8;
  --text: #171a26;
  --text-2: #5b6172;
  --text-3: #8b91a3;
  --ok: #10b981;
  --ok-bg: #ecfdf5;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(23, 26, 38, .05);
  --shadow: 0 4px 16px -6px rgba(23, 26, 38, .12), 0 1px 3px rgba(23, 26, 38, .04);
  --shadow-lg: 0 24px 60px -24px rgba(23, 26, 38, .28);
  --side-w: 236px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--brand-100); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d5d9e4; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c2c7d6; }
::-webkit-scrollbar-track { background: transparent; }

/* =========================================================
   布局
   ========================================================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #4f46e5 60%, #7c3aed);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .7);
}
.brand-text { line-height: 1.2; }
.brand-text strong { display: block; font-size: 14.5px; letter-spacing: -.01em; }
.brand-text span { font-size: 11.5px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 11px; color: var(--text-3); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .8; }
.nav-item:hover { background: #f4f5fa; color: var(--text); }
.nav-item.active { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item .count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: #eef0f6; color: var(--text-2);
  border-radius: 20px; padding: 1px 7px;
}
.nav-item.active .count { background: #fff; color: var(--brand); }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 12px; cursor: pointer;
  transition: background .15s;
}
.user-chip:hover { background: #f4f5fa; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #a5b4fc, #818cf8);
  color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 13px; flex: 0 0 32px;
}
.user-chip .u-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip .u-role { font-size: 11px; color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: 0 0 62px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  background: rgba(246, 247, 251, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 17px; }
.topbar .sub { color: var(--text-3); font-size: 12.5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.content { padding: 24px 26px 60px; max-width: 1320px; width: 100%; }

.menu-btn { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .24s cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .menu-btn {
    display: grid; place-items: center; width: 36px; height: 36px;
    border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  }
  .content { padding: 16px 14px 60px; }
  .topbar { padding: 0 14px; }
  .scrim {
    position: fixed; inset: 0; background: rgba(23, 26, 38, .35);
    z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }
}

/* =========================================================
   基础组件
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 14.5px; }
.card-head .grow { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff;
  font-weight: 500; font-size: 13.5px; cursor: pointer;
  transition: background .15s, transform .06s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: #f7f8fc; color: var(--text); }
.btn-soft { background: var(--brand-50); color: var(--brand-600); }
.btn-soft:hover { background: var(--brand-100); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-danger-ghost { background: #fff; color: var(--danger); border-color: #fbd5d5; }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14.5px; border-radius: 11px; }
.btn-icon { width: 32px; padding: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.input::placeholder { color: #b3b8c6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a3' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* 统计卡 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; gap: 14px; align-items: flex-start;
}
.stat .ico {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  display: grid; place-items: center; background: var(--brand-50); color: var(--brand);
}
.stat .ico svg { width: 19px; height: 19px; }
.stat .v { font-size: 21px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.stat .k { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat.ok .ico { background: var(--ok-bg); color: var(--ok); }
.stat.warn .ico { background: var(--warn-bg); color: var(--warn); }
.stat.danger .ico { background: var(--danger-bg); color: var(--danger); }

/* 徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500;
  background: #f1f3f9; color: var(--text-2);
  white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: #047857; }
.badge-warn { background: var(--warn-bg); color: #b45309; }
.badge-danger { background: var(--danger-bg); color: #b91c1c; }
.badge-brand { background: var(--brand-50); color: var(--brand-600); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-2);
}
table.tb td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tb tbody tr:last-child td { border-bottom: none; }
table.tb tbody tr { transition: background .12s; }
table.tb tbody tr:hover { background: #fafbfe; }
table.tb tbody tr.selected { background: var(--brand-50); }
.tb .name-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.thumb {
  width: 38px; height: 38px; border-radius: 9px; flex: 0 0 38px;
  background: #f1f3f9; display: grid; place-items: center;
  color: var(--text-3); overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 17px; height: 17px; }
.tb .fname { font-weight: 500; word-break: break-all; line-height: 1.35; }
.tb .fmeta { font-size: 11.5px; color: var(--text-3); }

/* 复选框 */
.cb {
  appearance: none; width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--line-strong); background: #fff;
  cursor: pointer; position: relative; flex: 0 0 16px; transition: all .12s;
}
.cb:checked { background: var(--brand); border-color: var(--brand); }
.cb:checked::after {
  content: ""; position: absolute; left: 4.5px; top: 1.5px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}

/* 进度条 */
.progress { height: 6px; border-radius: 6px; background: #eef0f6; overflow: hidden; }
.progress > i {
  display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #6366f1, #4f46e5);
  transition: width .25s ease;
}
.progress.ok > i { background: linear-gradient(90deg, #34d399, #10b981); }
.progress.danger > i { background: var(--danger); }

/* 空状态 */
.empty { text-align: center; padding: 54px 20px; color: var(--text-3); }
.empty .e-ico {
  width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 14px;
  background: #f4f5fa; display: grid; place-items: center;
}
.empty .e-ico svg { width: 24px; height: 24px; opacity: .55; }
.empty h4 { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.empty p { font-size: 12.5px; margin: 0 0 16px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(23, 26, 38, .42);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.985);
  transition: transform .2s cubic-bezier(.4, 0, .2, 1);
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal-mask.show .modal { transform: none; }
.modal.wide { max-width: 720px; }
.modal-head { padding: 20px 22px 0; }
.modal-head h3 { font-size: 16px; }
.modal-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--text-3); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end;
}

/* Toast */
#toasts {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #171a26; color: #fff; padding: 10px 16px; border-radius: 11px;
  font-size: 13px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  animation: toastIn .22s cubic-bezier(.4, 0, .2, 1);
  max-width: 90vw;
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #047857; }
.toast svg { width: 15px; height: 15px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* 拖拽上传区 */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2);
  padding: 40px 24px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-50); }
.dropzone .dz-ico {
  width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 12px;
  background: #fff; border: 1px solid var(--line); display: grid; place-items: center;
  color: var(--brand);
}
.dropzone .dz-ico svg { width: 24px; height: 24px; }
.dropzone h4 { font-size: 14.5px; margin-bottom: 4px; }
.dropzone p { font-size: 12.5px; color: var(--text-3); margin: 0; }

/* 上传队列 */
.queue { display: flex; flex-direction: column; }
.qitem {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
}
.qitem:last-child { border-bottom: none; }
.qitem .q-main { flex: 1; min-width: 0; }
.qitem .q-name { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.qitem .q-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .q-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.qitem .q-bar .progress { flex: 1; }
.qitem .q-pct { font-size: 11.5px; color: var(--text-3); width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.qitem .q-del {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text-3); cursor: pointer; display: grid; place-items: center;
  transition: all .14s; flex: 0 0 28px;
}
.qitem .q-del:hover { color: var(--danger); border-color: #fbd5d5; background: var(--danger-bg); }
.qitem .q-del svg { width: 14px; height: 14px; }

/* 批次卡 */
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.batch-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; transition: all .16s;
  display: flex; flex-direction: column; gap: 10px;
}
.batch-card:hover { border-color: #c7cbf0; box-shadow: var(--shadow); transform: translateY(-1px); }
.batch-card .bt { display: flex; align-items: flex-start; gap: 10px; }
.batch-card h4 { font-size: 14px; flex: 1; word-break: break-all; }
.batch-card .bmeta { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); }
.batch-card .bmeta b { color: var(--text-2); font-weight: 600; }

/* 标签页 */
.tabs { display: flex; gap: 4px; background: #eef0f6; padding: 3px; border-radius: 11px; width: fit-content; }
.tabs button {
  border: none; background: none; padding: 6px 14px; border-radius: 9px;
  font-size: 13px; color: var(--text-2); cursor: pointer; font-weight: 500;
  transition: all .15s;
}
.tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* 复制行 */
.copyrow {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 8px 7px 12px;
}
.copyrow code { flex: 1; font-size: 12.5px; color: var(--brand-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 分段选择 */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 7px 13px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }

/* 侧滑提示条 */
.banner {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(120deg, #eef2ff, #f5f3ff);
  border: 1px solid #e0e7ff; color: #3730a3;
  border-radius: var(--radius); padding: 13px 16px; margin-bottom: 18px;
  font-size: 13px;
}
.banner svg { width: 18px; height: 18px; flex: 0 0 18px; }
.banner .grow { flex: 1; }

/* 骨架 */
.skel { background: linear-gradient(90deg, #f1f3f9 25%, #e8eaf2 37%, #f1f3f9 63%); background-size: 400% 100%; animation: sk 1.3s infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 工具类 */
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-12 { margin-bottom: 12px; } .mb-20 { margin-bottom: 20px; }
.flex { display: flex; } .between { justify-content: space-between; } .center { align-items: center; }
.gap-6 { gap: 6px; } .gap-10 { gap: 10px; } .gap-16 { gap: 16px; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }
.tr { text-align: right; }

/* ================= 批次分组（管理员素材页） ================= */
.batch-group { border-bottom: 1px solid var(--line); }
.batch-group:last-child { border-bottom: none; }
.batch-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
.batch-name { font-weight: 650; font-size: 13.5px; color: var(--text); }
.batch-head .tb { border: none; }
