/* 拼了么 · 管理后台样式
 * 单文件、无依赖。主色沿用小程序视觉倾向（暖粉点缀 + 中性灰骨架）。
 */
:root {
  --ink: #16181d;
  --ink2: #3f4652;
  --ink3: #7a828f;
  --line: #e8eaee;
  --bg: #f5f6f8;
  --card: #fff;
  --brand: #d94f70;
  --brand-d: #bf3f5d;
  --green: #12805c;
  --red: #c0392b;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.side {
  width: 208px;
  flex: none;
  background: #1c1f26;
  color: #c9ced8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 18px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #e0607f, #c23d5c);
  color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 16px;
}
.brand-name { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: #8b93a1; margin-top: 2px; }
.side nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; }
.side nav a {
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: #b9bfca;
  transition: background .15s, color .15s;
}
.side nav a:hover { background: #262a33; color: #fff; }
.side nav a.active { background: #2d323d; color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; padding: 16px 18px; font-size: 12px; border-top: 1px solid #262a33; }
.side-foot .me { color: #dfe3ea; margin-bottom: 6px; }
.side-foot .logout { color: #8b93a1; }
.side-foot .logout:hover { color: #fff; }
.ro-badge {
  display: inline-block; margin-bottom: 10px; padding: 2px 8px; border-radius: 4px;
  background: #4a3410; color: #ffc760; font-size: 11px; font-weight: 600;
}

.main { flex: 1; min-width: 0; padding: 22px 28px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: -.2px; }
.top-actions { display: flex; gap: 8px; }

/* ---------- 基础控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink2); font-size: 13px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #cfd4dc; background: #fafbfc; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--brand-d); border-color: var(--brand-d); }
.btn-danger { color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #fdf1f0; border-color: #f0c4bf; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.w-full { width: 100%; }

.input {
  height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13.5px; background: #fff; color: var(--ink); outline: none;
  font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(217, 79, 112, .1); }
textarea.input { height: auto; padding: 9px 11px; line-height: 1.6; resize: vertical; }
select.input { padding-right: 28px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237a828f' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { min-width: 150px; }
.toolbar .spacer { flex: 1; }
.tip-inline { font-size: 12px; color: var(--ink3); }

.hint {
  background: #f0f4fb; border: 1px solid #dbe6f7; color: #34527a;
  padding: 9px 13px; border-radius: 8px; font-size: 12.5px; margin-bottom: 14px;
}
.notice {
  background: #fff8e6; border: 1px solid #f2e0b0; color: #7a5a00;
  padding: 12px 15px; border-radius: 10px; font-size: 13px; margin-top: 18px; line-height: 1.7;
}
.notice code { background: #fff; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.empty { text-align: center; color: var(--ink3); padding: 48px 0; font-size: 13.5px; }

.chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px;
  background: #f0f1f4; color: var(--ink2);
}
.tag-on { color: var(--green); font-size: 12px; font-weight: 600; }
.tag-off { color: var(--ink3); font-size: 12px; }

/* ---------- 总览 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(22, 24, 29, .07); transform: translateY(-1px); }
.stat-v { font-size: 28px; font-weight: 700; letter-spacing: -1px; color: var(--brand); }
.stat-k { font-size: 12.5px; color: var(--ink3); margin-top: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; }
.qbtn {
  padding: 10px 16px; border: 1px dashed #d8dce3; border-radius: 9px;
  font-size: 13px; color: var(--ink2); transition: all .15s;
}
.qbtn:hover { border-color: var(--brand); color: var(--brand); background: #fffafb; }

/* ---------- 列表行 ---------- */
.group-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.group-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid #f2f3f5; background: #fff; transition: background .12s;
}
.group-row:last-child { border-bottom: none; }
.group-row:hover { background: #fafbfc; }
.group-row.dragging { opacity: .4; }
.group-row.drag-over-item { box-shadow: inset 0 2px 0 var(--brand); }
.drag {
  cursor: grab; color: #b6bcc6; font-size: 15px; width: 16px; text-align: center;
  user-select: none; flex: none;
}
.drag:active { cursor: grabbing; }
.drag.ghost { visibility: hidden; }
.cb-only { flex: none; display: flex; align-items: center; }
.thumb {
  width: 52px; height: 52px; border-radius: 8px; overflow: hidden; flex: none;
  background: #f4f5f7; border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.grow { flex: 1; min-width: 0; }
.g-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-sub { font-size: 12px; color: var(--ink3); margin-top: 3px; }
.g-badges { display: flex; gap: 6px; align-items: center; flex: none; }
.no-img { display: grid; place-items: center; height: 100%; color: #b6bcc6; font-size: 11px; }
.no-img.sm { font-size: 10.5px; }

.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 16px; font-size: 12.5px; color: var(--ink3); }

/* ---------- 编辑页 ---------- */
.edit-form { display: grid; grid-template-columns: 1fr 250px; gap: 22px; align-items: start; }
.form-main { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.form-side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: sticky; top: 18px; }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 12.5px; color: var(--ink2); font-weight: 600; margin-bottom: 7px; }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tip { font-size: 11.5px; color: var(--ink3); margin-top: 5px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; font-weight: 600; }
.switch input { width: 16px; height: 16px; accent-color: var(--brand); }
.save-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.meta { margin-top: 16px; font-size: 11.5px; color: var(--ink3); line-height: 1.9; }

/* ---------- 上传控件 ---------- */
.uploader { border: 1px dashed #d8dce3; border-radius: 10px; padding: 10px; max-width: 220px; }
.uploader.drag-over, .uploader-grid.drag-over { border-color: var(--brand); background: #fffafb; }
.up-empty { height: 110px; display: grid; place-items: center; color: var(--ink3); font-size: 12.5px; cursor: pointer; }
.up-item { position: relative; border-radius: 8px; overflow: hidden; }
.up-item img { width: 100%; display: block; }
.up-del {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
}
.up-idx {
  position: absolute; bottom: 4px; left: 4px; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 10.5px; padding: 0 5px; border-radius: 4px;
}
.uploader-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px;
  border: 1px dashed #d8dce3; border-radius: 10px; padding: 12px; min-height: 120px;
}
.uploader-grid .up-item { cursor: grab; }
.uploader-grid .up-item.dragging { opacity: .4; }
.uploader-grid .up-item.drag-over-item { outline: 2px solid var(--brand); outline-offset: 2px; }
.up-add {
  display: grid; place-items: center; min-height: 110px; border-radius: 8px; background: #fafbfc;
  border: 1px solid var(--line); color: var(--ink3); font-size: 18px; cursor: pointer; text-align: center;
}
.up-add span { font-size: 11.5px; }

/* ---------- 合集卡片 ---------- */
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.collection-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  cursor: grab; transition: box-shadow .15s, transform .15s;
}
.collection-card:hover { box-shadow: 0 6px 20px rgba(22, 24, 29, .08); transform: translateY(-2px); }
.collection-card.dragging { opacity: .4; }
.collection-card.drag-over-item { outline: 2px solid var(--brand); }
.cc-cover { position: relative; aspect-ratio: 4/3; background: #f4f5f7; }
.cc-cover img { width: 100%; height: 100%; object-fit: cover; }
.cc-cover .no-img { height: 100%; }
.cc-count {
  position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 9px;
}
.cc-body { padding: 12px 14px 14px; }
.cc-title { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.cc-tags { display: flex; gap: 5px; flex-wrap: wrap; min-height: 18px; margin-bottom: 10px; }
.cc-actions { display: flex; gap: 6px; }

/* ---------- 合集详情 ---------- */
.detail-head {
  display: flex; gap: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.dh-cover { width: 130px; height: 98px; border-radius: 9px; overflow: hidden; flex: none; background: #f4f5f7; }
.dh-cover img { width: 100%; height: 100%; object-fit: cover; }
.dh-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.dh-desc { font-size: 12.5px; color: var(--ink3); line-height: 1.7; margin-bottom: 8px; }
.dh-meta { font-size: 11.5px; color: var(--ink3); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th {
  text-align: left; padding: 11px 14px; font-size: 12px; color: var(--ink3); font-weight: 600;
  background: #fafbfc; border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f2f3f5; font-size: 13px; }
.table tr:last-child td { border-bottom: none; }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form .input { min-width: 180px; }

.checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px;
  max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; padding: 12px;
}
.cb { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.cb input { accent-color: var(--brand); }

/* ---------- 弹窗 ---------- */
.dlg {
  border: none; border-radius: 14px; padding: 0; width: 440px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.dlg-wide { width: 680px; }
.dlg::backdrop { background: rgba(22, 24, 29, .45); }
.dlg form, .dlg > div { padding: 22px 24px; }
.dlg h3 { margin: 0 0 16px; font-size: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.picker-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.pk-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid #f2f3f5; cursor: pointer;
}
.pk-row:last-child { border-bottom: none; }
.pk-row:hover { background: #fafbfc; }
.pk-row input { accent-color: var(--brand); }

/* ---------- 登录 ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: #f5f6f8; }
.login-card {
  width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 34px 30px 30px; box-shadow: 0 10px 40px rgba(22, 24, 29, .07);
}
.login-logo {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #e0607f, #c23d5c); color: #fff; font-weight: 700; font-size: 20px;
  margin-bottom: 16px;
}
.login-card h2 { font-size: 17px; margin: 0 0 4px; letter-spacing: -.2px; }
.login-sub { font-size: 12.5px; color: var(--ink3); margin: 0 0 22px; }
.login-card label { display: block; font-size: 12.5px; color: var(--ink2); margin-bottom: 14px; font-weight: 600; }
.login-card input {
  width: 100%; height: 38px; margin-top: 6px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(217, 79, 112, .1); }
.login-card button {
  width: 100%; height: 40px; margin-top: 6px; border: none; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.login-card button:hover { background: var(--brand-d); }
.login-error {
  background: #fdf1f0; color: var(--red); font-size: 12.5px; padding: 8px 11px;
  border-radius: 7px; margin-bottom: 14px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  background: #1c1f26; color: #fff; padding: 10px 18px; border-radius: 9px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .22s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); z-index: 999;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #a5342a; }

@media (max-width: 900px) {
  .edit-form { grid-template-columns: 1fr; }
  .form-side { position: static; }
  .side { width: 64px; }
  .brand-name, .brand-sub, .side nav a { font-size: 0; }
  .side nav a { text-align: center; padding: 12px 0; }
  .side nav a::before { content: '·'; font-size: 18px; }
}
