:root {
  --bg: #0b1020;
  --panel: #121a2e;
  --panel-2: #151f35;
  --line: #26334e;
  --muted: #91a0ba;
  --txt: #edf3ff;
  --blue: #78a7ff;
  --green: #4dd6a2;
  --red: #ff7777;
  --amber: #ffc861;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1000px 500px at 80% -10%, #1b2b4d 0%, transparent 60%), var(--bg);
  color: var(--txt);
  font: 15px/1.55 system-ui, "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: #9cc0ff; }

.layout { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #10182a, #0d1424);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { font-size: 18px; font-weight: 750; margin-bottom: 4px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: #c5d1e5;
  margin-bottom: 4px;
}
.nav-link:hover { background: #1a2942; color: #fff; }
.nav-link.active { background: linear-gradient(135deg, #6d9cff, #4975db); color: #071226; font-weight: 600; }
.nav-section { color: var(--muted); font-size: 12px; margin: 16px 12px 6px; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: rgba(13, 20, 36, .8); position: sticky; top: 0; z-index: 10;
}
.topbar .user { display: flex; align-items: center; gap: 14px; }
.balance-pill { border: 1px solid var(--line); border-radius: 30px; padding: 6px 12px; color: var(--muted); font-size: 13px; }
.balance-pill b { color: var(--green); }

.content { padding: 26px; max-width: 1280px; }

.card {
  background: linear-gradient(160deg, var(--panel-2), #10182a);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 20px;
}
.card h2 { margin: 0 0 16px; font-size: 17px; color:#fff;}

.field { margin: 14px 0; }
.field label { display: block; font-size: 13px; color: #c5d1e5; margin-bottom: 7px; }

input, select, textarea {
  width: 100%; background: #0c1425; border: 1px solid #2a3958; border-radius: 10px;
  padding: 11px 12px; color: var(--txt); font: inherit; outline: none;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input[type="checkbox"] { width: auto; }

.btn { border-radius: 10px; padding: 10px 18px; font-weight: 600; border: 1px solid transparent; }
.btn-primary { background: linear-gradient(135deg, #6d9cff, #4975db); color: #071226; }
.btn-primary:hover { filter: brightness(1.1); color: #071226; }
.btn-outline { background: #1a2942; color: #dbe8ff; border: 1px solid #344866; }
.btn-danger { background: #5a2330; color: #ffd7d7; border: 1px solid #7a3040; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.table { color: var(--txt); }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table td, .table th { border-color: var(--line); }

.badge { border-radius: 6px; padding: 4px 9px; font-size: 12px; }
.badge-status { background: #1c2b45; color: #b7ccf1; }
.badge-ok { background: #123d2e; color: var(--green); }
.badge-err { background: #4a1d26; color: var(--red); }
.badge-warn { background: #4a3817; color: var(--amber); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.stat-card { background: #0c1425; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat-card .num { font-size: 26px; font-weight: 750; }
.stat-card .label { color: var(--muted); font-size: 13px; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.asset-card { background: #0c1425; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.asset-card video, .asset-card img { width: 100%; height: 200px; object-fit: contain; background: #000; }
.asset-card .body { padding: 12px 14px; }
.asset-card .title { font-weight: 600; margin-bottom: 4px; color:#fff; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.asset-card .title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card .title .badge { flex-shrink: 0; }
.asset-card--downloaded { border-color: rgba(77, 214, 162, .45); background: linear-gradient(160deg, #142b26, #10182a); }
.asset-card .meta { color: var(--muted); font-size: 12px; }

.upload-box { border: 1px dashed #496184; border-radius: 13px; padding: 22px; text-align: center; background: #0d1729; }
.upload-box.dragover { border-color: var(--blue); background: #12203a; }
.preview-img { max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 10px;object-fit: contain; }

/* ---------- 多图参考列表 ---------- */
.file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.file-card { background: #0c1425; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.file-card img { width: 100%; height: 110px; object-fit: contain; background: #000; display: block; }
.file-card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.file-name { font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card-body select { padding: 7px 8px; font-size: 13px; }
.file-del { align-self: flex-start; }

.muted { color: var(--muted); font-size: 13px; }
.log-box { max-height: 300px; overflow: auto; font: 12px/1.8 ui-monospace, monospace; color: #b6c7e4; white-space: pre-wrap; }

.alert { border-radius: 10px; }
.announcement { margin-bottom: 12px; }
.announcement-body { white-space: pre-line; margin-top: 4px; }

/* ---------- 经营报表 ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 22px; }
.day-switch { display: flex; gap: 8px; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.metric-grid--sm { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.metric-card { display: flex; gap: 13px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px; transition: border-color .15s, transform .15s; }
.metric-card:hover { border-color: #38507a; transform: translateY(-1px); }
.metric-icon { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.metric-svg { width: 24px; height: 24px; }
.metric-body { min-width: 0; }
.metric-label { color: var(--muted); font-size: 12.5px; margin-bottom: 3px; }
.metric-value { font-size: 22px; font-weight: 750; letter-spacing: -.01em; color: #fff; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric-unit { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.metric-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.metric--neutral .metric-icon { background: #1c2b45; color: var(--blue); }
.metric--blue .metric-icon { background: #16294d; color: var(--blue); }
.metric--green .metric-icon { background: #123d2e; color: var(--green); }
.metric--red .metric-icon { background: #4a1d26; color: var(--red); }
.metric--amber .metric-icon { background: #4a3817; color: var(--amber); }
.metric--green .metric-value { color: var(--green); }
.metric--red .metric-value { color: var(--red); }

.platform-grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin: 18px 0; }
.platform-block { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 18px; }
.pb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.pb-head h2 { margin: 0; font-size: 16px; color: #fff; }
.pb-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pb-tag { margin-left: auto; font-size: 12px; color: var(--muted); background: #16233a; border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; }
.pb-chart { margin-top: 14px; }

.pb--douyin { border-left: 3px solid #ff4d64; }
.pb--douyin .pb-dot { background: #ff4d64; }
.pb--qianchuan { border-left: 3px solid #3370ff; }
.pb--qianchuan .pb-dot { background: #3370ff; }
.pb--wechat { border-left: 3px solid #07c160; }
.pb--wechat .pb-dot { background: #07c160; }
.pb--adq { border-left: 3px solid #a07bff; }
.pb--adq .pb-dot { background: #a07bff; }

.mini-chart { width: 100%; }
.trend-svg { width: 100%; height: auto; display: block; }

.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 14px 130px 1fr 110px; align-items: center; gap: 12px; }
.bar-dot { width: 10px; height: 10px; border-radius: 50%; }
.bar-dot--douyin { background: #ff4d64; }
.bar-dot--qianchuan { background: #3370ff; }
.bar-dot--wechat { background: #07c160; }
.bar-dot--adq { background: #a07bff; }
.bar-label { color: #dbe8ff; font-size: 14px; }
.bar-track { background: #0c1425; border: 1px solid var(--line); border-radius: 10px; height: 22px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 10px; }
.bar-fill--douyin { background: linear-gradient(90deg, #ff7a8d, #ff4d64); }
.bar-fill--qianchuan { background: linear-gradient(90deg, #6d9cff, #3370ff); }
.bar-fill--wechat { background: linear-gradient(90deg, #4dd6a2, #07c160); }
.bar-fill--adq { background: linear-gradient(90deg, #b89bff, #a07bff); }
.bar-value { text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.platform-card { background: #0c1425; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.platform-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.platform-card .field { margin: 10px 0; }
.oauth-actions { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.oauth-actions .field { margin: 0 0 8px; width: 100%; }
.inline-form { display: inline-block; }
.text-success { color: #35c47c; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .bar-row { grid-template-columns: 12px 90px 1fr 84px; gap: 8px; }
}
#uploadHint>p{
  color: #eee;
}

/* ---------- 资产批量下载 ---------- */
.asset-card { position: relative; }
.batch-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.batch-bar label { color: #fff; }
.asset-check { position: absolute; top: 8px; left: 8px; z-index: 2; width: 38px; height: 38px;
  background: rgba(10, 18, 34, .78); border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.asset-check input { width: 20px; height: 20px; accent-color: var(--blue); cursor: pointer; }
.asset-check input:disabled { cursor: default; opacity: .55; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }
.card-actions .btn { flex: 1; text-align: center; }

/* 鼠标框选矩形 */
.selection-box { position: fixed; z-index: 9999; pointer-events: none;
  border: 1px solid var(--blue); background: rgba(51, 112, 255, .18); border-radius: 4px; }
.asset-grid.selecting { user-select: none; }

/* 预设分组标签 */
.preset-group-tag { display: inline-block; font-size: 11px; color: #9db8e6;
  background: #16233a; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.preset-item-body { gap: 6px; }

/* ---------- 预设参考图库 ---------- */
.preset-panel { margin-top: 12px; }
.preset-panel-title { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.preset-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.preset-strip .preset-item {
  flex: 0 0 96px; background: #0c1425; border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; cursor: pointer; text-align: center; transition: border-color .15s, transform .15s;
}
.preset-strip .preset-item:hover { border-color: var(--blue); transform: translateY(-1px); }
.preset-strip .preset-item img { width: 100%; height: 170px; object-fit: cover; border-radius: 8px; background: #000; display: block; }
.preset-item-name { display: block; font-size: 12px; color: #dbe8ff; margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.preset-admin { margin-top: 18px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.preset-grid .preset-item { background: #0c1425; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.preset-grid .preset-item img { width: 100%; height: 110px; object-fit: cover; background: #000; display: block; }
.preset-item-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.preset-item-title { font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }