/* ===== 小七淘图 · 后台设计系统（创作者端 + 管理端共用，响应式） ===== */
:root {
  --green: #22a45d;
  --green-dark: #1a8550;
  --green-light: #e8f6ee;
  --ink: #1c2333;
  --ink-2: #5b6472;
  --ink-3: #8b94a3;
  --line: #e6e9ee;
  --bg: #f4f6f5;
  --card: #ffffff;
  --red: #e5484d;
  --orange: #f5a623;
  --blue: #3b82f6;
  --sidebar-w: 216px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 40, 30, .06), 0 8px 24px rgba(20, 40, 30, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ===== 布局骨架 ===== */
.app { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #18201c;
  color: #c9d4cd;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  color: #fff; font-size: 17px; font-weight: 700;
}
.sidebar .brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  object-fit: cover; display: inline-block;
}
.sidebar .nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.sidebar .nav .nav-group { margin: 14px 8px 6px; font-size: 11px; color: #7d8b83; letter-spacing: .08em; }
.sidebar .nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: 8px; color: #c9d4cd; font-size: 13.5px;
}
.sidebar .nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar .nav a.active { background: var(--green); color: #fff; font-weight: 600; }
.sidebar .nav a .ic { width: 18px; text-align: center; opacity: .85; }
.sidebar .foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7d8b83; }

/* 主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none;
  align-items: center; gap: 12px;
  padding: 10px 16px; background: #18201c; color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.topbar .menu-btn { background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; padding: 4px 8px; }
.content { padding: 24px; max-width: 1180px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head .sub { color: var(--ink-2); font-size: 13px; margin-top: 4px; }

/* 移动端顶栏 + 抽屉侧栏 */
@media (max-width: 768px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 30;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,.2);
  }
  .sidebar.open { transform: translateX(0); }
  .mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; display: none; }
  .mask.show { display: block; }
  .content { padding: 16px; }
}

/* ===== 组件 ===== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px;
}
.card .card-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; transition: all .15s; white-space: nowrap;
  background: #fff; color: var(--ink); border-color: var(--line);
}
.btn:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn-danger { background: #fff; color: var(--red); border-color: #f3c1c2; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.7;
}
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-orange { background: #fdf1dc; color: #b57a12; }
.badge-red { background: #fdeaea; color: var(--red); }
.badge-gray { background: #eef0f2; color: var(--ink-3); }
.badge-blue { background: #e8f0fe; color: #2563eb; }
/* 兼容写法：部分页面用 class="badge green"（空格分隔），补齐同款配色 */
.badge.green { background: var(--green-light); color: var(--green-dark); }
.badge.orange { background: #fdf1dc; color: #b57a12; }
.badge.red { background: #fdeaea; color: var(--red); }
.badge.gray { background: #eef0f2; color: var(--ink-3); }
.badge.blue { background: #e8f0fe; color: #2563eb; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12.5px; color: var(--ink-2); }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .value small { font-size: 13px; color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.stat .trend { font-size: 12px; margin-top: 2px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .stat { padding: 12px 14px; } }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl, table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td, .table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th, .table th { color: var(--ink-2); font-weight: 600; font-size: 12.5px; background: #fafbfa; }
.tbl tbody tr:hover, .table tbody tr:hover { background: #fafcfa; }
.tbl .thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; display: block; }
.tbl .empty { text-align: center; color: var(--ink-3); padding: 40px 0; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.form-item input[type=text], .form-item input[type=password], .form-item input[type=number],
.form-item input[type=url], .form-item select, .form-item textarea {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
  outline: none; width: 100%;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,164,93,.12); }
.form-item textarea { min-height: 90px; resize: vertical; }
.form-item .hint { font-size: 12px; color: var(--ink-3); }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* 网格（作品/专辑） */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.item-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s;
}
.item-card:hover { transform: translateY(-2px); }
.item-card .cover { aspect-ratio: 3/4; background: #eef1ef; }
.item-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-card .meta { padding: 10px 12px; }
.item-card .meta .t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-card .meta .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.item-card .ops { display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap; }
/* 图片审核页：卡片略宽，保证「通过/驳回/下架」三按钮同一行 */
.grid-images { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.grid-images .item-card .ops { flex-wrap: nowrap; }
.grid-images .item-card .ops .btn { flex: 1; padding: 4px 4px; }
/* 创作者作品管理：下架/删除按钮同一行 */
#worksGrid .item-card .ops { flex-wrap: nowrap; }
#worksGrid .item-card .ops .btn { flex: 1; padding: 4px 4px; }

/* 上传区 */
.dropzone {
  border: 2px dashed #c8d3cc; border-radius: var(--radius);
  padding: 40px 20px; text-align: center; color: var(--ink-2);
  background: #fafcfa; cursor: pointer; transition: all .15s;
}
.dropzone.drag { border-color: var(--green); background: var(--green-light); }
.dropzone .big { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.upload-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; position: relative; }
.upload-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.upload-item .state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); color: #fff; font-size: 13px; }
.upload-item .state.ok { background: rgba(26,133,80,.7); }
.upload-item .state.fail { background: rgba(229,72,77,.75); }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; color: var(--ink-2); font-size: 13px; }

/* 登录页 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(150deg, #16211b 0%, #1c2a22 55%, #1f4a33 100%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 34px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-card .brand .logo {
  width: 40px; height: 40px; border-radius: 10px;
  object-fit: cover; display: inline-block;
}
.login-card h1 { margin: 10px 0 4px; font-size: 20px; }
.login-card .sub { color: var(--ink-2); font-size: 13px; margin-bottom: 24px; }
.login-card .form-item { margin-bottom: 16px; }
.login-card .btn { width: 100%; padding: 11px; font-size: 15px; margin-top: 6px; }
.login-card .tip { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 16px; }
.login-err { background: #fdeaea; color: var(--red); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; display: none; }

/* Toast */
#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast-item { background: #1c2333; color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: toastIn .2s ease; max-width: 90vw; }
.toast-item.err { background: var(--red); }
.toast-item.ok { background: var(--green-dark); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,18,.5); z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 440px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal .ops { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 空态 */
.empty-box { text-align: center; padding: 50px 20px; color: var(--ink-3); }
.empty-box .ic { font-size: 40px; margin-bottom: 10px; opacity: .5; }

/* 落地页 */
.landing { min-height: 100vh; background: linear-gradient(160deg, #16211b, #1f4a33 70%, #27674a); color: #fff; display: flex; flex-direction: column; }
.landing .hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; }
.landing .logo-big { width: 76px; height: 76px; border-radius: 20px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 20px; box-shadow: 0 12px 40px rgba(52,201,123,.4); }
.landing .logo-big img { width: 100%; height: 100%; object-fit: cover; }
.landing h1 { font-size: 30px; margin: 0 0 10px; }
.landing .desc { color: #cfe3d7; margin-bottom: 34px; max-width: 480px; }
.landing .entry { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.landing .entry a {
  display: inline-block; padding: 12px 26px; border-radius: 10px; font-size: 15px;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
}
.landing .entry a.primary { background: var(--green); border-color: var(--green); font-weight: 600; }
.landing .entry a:hover { text-decoration: none; background: rgba(255,255,255,.2); }
.landing .foot { text-align: center; padding: 18px; color: #93b3a1; font-size: 12.5px; }

/* 其他 */
.muted { color: var(--ink-3); }
.money { font-weight: 700; color: var(--green-dark); }
.flex { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; }
.text-right { text-align: right; }
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; outline: none; }
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--green); }
/* 管理端统计条 + 批量操作条 */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-card { flex: 1; min-width: 110px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; transition: all .15s; }
.stat-card:hover { border-color: var(--green); }
.stat-card.active { border-color: var(--green); background: var(--green-light); }
.stat-card .n { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat-card .l { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.batch-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--green-light); border: 1px solid var(--green); border-radius: 10px; padding: 8px 12px; margin-bottom: 16px; }
.batch-bar #batchCount { font-size: 13px; font-weight: 600; margin-right: 6px; }
.thumb-check { position: absolute; top: 8px; left: 8px; width: 18px; height: 18px; z-index: 2; cursor: pointer; accent-color: var(--green); }
.item-card { position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--green-light); color: var(--green-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* 图片下载排行 */
.rank-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.rank-item { width: 132px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; transition: box-shadow .15s; }
.rank-item:hover { box-shadow: 0 6px 18px rgba(0,0,0,.10); }
.rank-thumb { position: relative; aspect-ratio: 3/4; background: #f3f4f6; }
.rank-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rank-badge { position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.rank-badge.top { background: #ff9f43; }
.rank-dl { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.rank-meta { padding: 8px 10px; font-size: 12px; color: var(--ink-2, #666); line-height: 1.5; }
.rank-meta .t { font-size: 13px; color: var(--ink-1, #111); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 排行/收入查询 */
.rank-summary { margin: 10px 0 12px; padding: 10px 14px; background: #f0faf4; border: 1px solid #d4ecdd; border-radius: 8px; font-size: 13px; color: #333; }
.inc-summary .inc-cards { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.inc-summary .inc-cards .stat-card { flex: 1 1 150px; min-width: 140px; }
.inc-summary > div:first-child { font-size: 14px; margin-bottom: 2px; }

/* 结算管理 */
.batch-tip { margin: 0 0 12px; padding: 8px 14px; background: #fff8e6; border: 1px solid #f5e0a3; border-radius: 8px; font-size: 13px; }
.batch-tip a { color: var(--green); }
.btn-warning { background: #ff9f43; color: #fff; }
.btn-warning:hover { background: #f2912e; }
.btn-success { background: #34c97b; color: #fff; }
.btn-success:hover { background: #2bb36c; }
.timeline { border-left: 2px solid #e5e7eb; margin: 4px 0 0 6px; padding-left: 14px; }
.tl-item { position: relative; padding: 6px 0; }
.tl-dot { position: absolute; left: -19px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.kv span { color: var(--ink-2); flex-shrink: 0; }

/* ===== 列表页表格卡片化（plans / users） ===== */
.table-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-x: auto;
}
.table-card table { min-width: 720px; }
.table-card tbody tr:last-child td { border-bottom: none; }
.table-card td { vertical-align: middle; }

/* 用户列：头像圆标 + 昵称/ID 两行 */
.u-cell { display: flex; align-items: center; gap: 10px; }
.u-cell .avatar { flex-shrink: 0; }
.u-cell .u-name { font-weight: 600; line-height: 1.35; }
.u-cell .u-sub { font-size: 12px; color: var(--ink-3); line-height: 1.35; }

/* OpenID 长串截断 */
.openid-cell { max-width: 150px; overflow: hidden; text-overflow: ellipsis; cursor: default; }

/* 套餐列：名称 + 编码子行 */
.plan-cell .p-name { font-weight: 600; line-height: 1.35; }
.plan-cell .p-sub { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.price-cell { font-weight: 700; color: var(--green-dark); font-size: 15px; }

/* 弹窗内两列表单 */
.modal .form-grid { margin-top: 2px; }
.modal .form-grid .form-item.full { grid-column: 1 / -1; }
