:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e6e8ec;
  --text: #16181d;
  --muted: #6b7280;
  --accent: #ff5c2b;
  --accent-soft: #fff1ec;
  --ok: #16a34a;
  --ok-soft: #e9f9ef;
  --warn: #b45309;
  --warn-soft: #fef6e7;
  --danger: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* hidden 属性优先级最高，避免被 display:flex 之类规则覆盖 */
[hidden] { display: none !important; }

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

button, input, textarea, select { font: inherit; color: inherit; }
code { background: #f0f1f4; padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ---------- 登录 ---------- */
.login-wrap {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 20% -10%, #ffe8df 0%, #f5f6f8 55%);
}
.login-card {
  width: 400px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 24px 60px -30px rgba(20, 22, 30, 0.25);
}
.login-brand {
  display: flex;
  align-items: center;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.5px;
}
.login-card h1 { margin: 16px 0 6px; font-size: 26px; letter-spacing: -0.4px; }
.login-tip { margin: 0 0 28px; color: var(--muted); font-size: 13px; }
.login-error { margin: 12px 0 0; color: var(--danger); font-size: 13px; min-height: 18px; }

.dot {
  width: 8px; height: 8px; margin-right: 8px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin-bottom: 8px; color: #3f4653; font-size: 13px; font-weight: 500; }
.field > span b { color: var(--accent); font-weight: 600; }
.field input, .field textarea, .field select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfbfc;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input:focus, textarea:focus, .field select:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
textarea { resize: vertical; line-height: 1.6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  background: #eef0f3; cursor: pointer;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: filter .15s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: #fff; border-color: var(--line); }
.btn-ghost:hover { background: #fafbfc; }
.btn-danger-ghost { background: #fff; border-color: #f4d4d4; color: var(--danger); }
.btn-mini { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; height: 42px; }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  height: 60px; padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; font-weight: 700; letter-spacing: 1.5px; font-size: 13px; }
.brand-sub { margin-left: 8px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.chips { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: 999px; background: #f2f3f5;
  color: #4b5563; font-size: 12px;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.ok { background: var(--ok-soft); color: #15803d; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- 布局 ---------- */
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 60px); }
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--card);
  display: flex; flex-direction: column;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 12px; color: var(--muted); font-size: 12.5px; letter-spacing: .6px;
}
.side-list { flex: 1; padding: 0 10px 18px; overflow-y: auto; }
.side-item {
  display: flex; gap: 12px; align-items: center;
  padding: 10px; margin-bottom: 4px;
  border-radius: 12px; cursor: pointer;
  border: 1px solid transparent;
}
.side-item:hover { background: #f8f9fa; }
.side-item.active { background: var(--accent-soft); border-color: #ffd9cc; }
.side-thumb {
  width: 54px; height: 36px; flex: none;
  border-radius: 8px; background: #eceef2 center/cover no-repeat;
  overflow: hidden;
}
.side-info { min-width: 0; }
.side-name {
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-sub { margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.side-sales { margin-top: 3px; color: #9aa0aa; font-size: 11px; }
.side-sales b { color: var(--accent); font-weight: 600; }
.side-foot { padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.9; }
.side-foot b { color: var(--text); font-weight: 600; }

.content { padding: 24px 28px 60px; min-width: 0; }

/* ---------- 空态 ---------- */
.empty-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 460px; color: var(--muted);
  border: 1px dashed #d9dce1; border-radius: 18px; background: #fbfbfc;
}
.empty-icon { font-size: 34px; opacity: .35; margin-bottom: 12px; }

/* ---------- 项目头 ---------- */
.project-panel { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.project-head {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 20px; margin-bottom: 20px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--card);
}
.project-cover {
  width: 168px; height: 104px; flex: none;
  border-radius: 12px; background: #eceef2 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: #b3b8c1; font-size: 12px;
}
.project-meta { flex: 1; min-width: 0; }
.project-meta h2 { margin: 2px 0 10px; font-size: 21px; letter-spacing: -0.3px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 8px;
  background: #f5f6f8; color: #4b5563; font-size: 12px;
}
.meta-pill b { color: var(--text); }
.meta-desc { margin-top: 10px; color: var(--muted); font-size: 13px; }
.project-actions { display: flex; gap: 8px; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  height: 34px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px;
}
.tab:hover { background: #eef0f3; }
.tab.active { background: var(--card); border-color: var(--line); color: var(--text); font-weight: 600; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px;
  margin-left: 4px; border-radius: 999px;
  background: #f0f1f4; color: #6b7280; font-size: 11px;
}

/* ---------- 工具条 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.toolbar-right { display: flex; gap: 8px; }
.hint { color: var(--muted); font-size: 12.5px; }

/* ---------- 表格 ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 11px 14px; text-align: left;
  background: #fafbfc; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 12px; font-weight: 500;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f1f2f4; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fbfcfd; }
.cell-cover {
  width: 76px; height: 46px; border-radius: 7px;
  background: #eceef2 center/cover no-repeat; display: block;
}
.cell-name { font-weight: 600; font-size: 13.5px; }
.cell-sub { margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.src {
  display: inline-block; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: 11.5px; font-family: ui-monospace, Menlo, monospace;
}
.price { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.price.free { color: var(--ok); }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11.5px; background: #f2f3f5; color: #4b5563;
}
.tag.ok { background: var(--ok-soft); color: #15803d; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: #fdeceb; color: #b91c1c; }
.progress { margin-top: 5px; height: 4px; border-radius: 99px; background: #eef0f3; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(18, 20, 26, .42); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; width: 520px; max-height: 88vh; overflow: auto;
  padding: 26px; border-radius: 18px; background: #fff;
  box-shadow: 0 30px 80px -30px rgba(10, 12, 18, .5);
  animation: pop .18s ease;
}
.modal-wide { width: 660px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-card h3 { margin: 0 0 18px; font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-tip { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.modal-error { margin: 4px 0 0; color: var(--danger); font-size: 12.5px; min-height: 16px; }

.cover-row { display: flex; gap: 14px; }
.cover-preview {
  width: 128px; height: 80px; flex: none;
  border-radius: 10px; border: 1px dashed #d9dce1;
  background: #fafbfc center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: #a8aeb8; font-size: 12px; overflow: hidden;
}
.cover-actions { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cover-actions input[type=text] { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fbfbfc; }

/* ---------- 数据统计 ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card);
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value {
  margin-top: 8px; font-size: 24px; font-weight: 700; letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.stat-value small { margin-left: 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-hint { margin-top: 6px; color: #9aa0aa; font-size: 11.5px; }
.stat-card.accent .stat-value { color: var(--accent); }

.panel-card {
  margin-bottom: 16px; padding: 16px 18px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; color: #3f4653; font-size: 13px; font-weight: 500;
}
.panel-head b { color: var(--muted); font-size: 12px; font-weight: 400; }
.chart {
  display: flex; align-items: flex-end; gap: 6px; height: 132px;
  padding-top: 8px; border-bottom: 1px solid var(--line);
}
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart-bar {
  width: 100%; max-width: 34px; min-height: 3px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #ff8a5c 0%, var(--accent) 100%);
  transition: height .25s ease;
}
.chart-bar.zero { background: #edeff3; }
.chart-x { color: #9aa0aa; font-size: 10.5px; white-space: nowrap; }
.chart-legend { margin-top: 8px; color: #9aa0aa; font-size: 11.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---------- 站点文案表单 ---------- */
.site-group { margin-bottom: 20px; }
.site-group h4 {
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid #f1f2f4;
  color: #3f4653; font-size: 13px; font-weight: 600;
}
.site-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.site-fields .field { margin-bottom: 14px; }
.site-fields .field.wide { grid-column: 1 / -1; }
.site-fields textarea { font-family: inherit; font-size: 13px; min-height: 62px; }
.field-hint { display: block; margin-top: 5px; color: #9aa0aa; font-size: 11.5px; }
.site-foot { align-items: center; }
.foot-gap { flex: 1; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  padding: 11px 20px; border-radius: 10px;
  background: #1f2329; color: #fff; font-size: 13px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .5);
  z-index: 90;
}
.toast.err { background: #b91c1c; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 220px 1fr; }
  .content { padding: 18px; }
  .project-cover { width: 120px; height: 76px; }
  .modal-card, .modal-wide { width: min(92vw, 660px); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .site-fields { grid-template-columns: 1fr; }
}
