/* ============ 竞品 H5 分析台 · Apple 深色主题 ============ */
:root {
  --bg: #000000;
  --panel: #1d1d1f;
  --panel2: #2c2c2e;
  --border: #38383a;
  --hairline: #48484a;
  --text: #f5f5f7;
  --muted: #86868b;
  --accent: #2997ff;
  --accent-weak: rgba(41, 151, 255, 0.16);
  --danger: #ff453a;
  --radius: 18px;
  --radius-s: 12px;
  --line: rgba(255, 255, 255, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h3, h4, h5 { margin: 0 0 12px; font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }

/* ---------- 顶部：大标题居中 + 导航居中（Cartier 式） ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
}
.site-title {
  text-align: center;
  font-size: 32px; font-weight: 700; letter-spacing: 0.02em;
  padding: 30px 20px 12px;
}
.topbar { display: flex; justify-content: center; align-items: center; height: 46px; position: relative; padding: 0 28px; }
.topbar nav { display: flex; gap: 34px; }
.topbar nav a {
  padding: 4px 2px; color: var(--text); font-size: 15px; font-weight: 500;
  border-bottom: 2px solid transparent; transition: border-color 0.15s, color 0.15s;
}
.topbar nav a.active { border-bottom-color: var(--accent); }
.topbar nav a:hover { color: var(--accent); }
.topbar #logoutBtn { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); }

/* ---------- 布局 ---------- */
.layout { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 118px); }
.sidebar {
  border-right: 1px solid var(--border);
  padding: 20px; overflow-y: auto;
  max-height: calc(100vh - 118px);
  display: flex; flex-direction: column; gap: 16px;
}
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.stage { padding: 24px; overflow-x: auto; }

/* ---------- 控件 ---------- */
.btn {
  border: none; background: var(--panel2); color: var(--text);
  padding: 9px 20px; border-radius: 980px; cursor: pointer; font-size: 14px;
  transition: all 0.15s; font-weight: 500;
}
.btn:hover { background: #3a3a3c; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #40a9ff; }
.btn.primary:disabled { opacity: 0.4; cursor: wait; }
.btn.ghost { background: transparent; border: 1px solid var(--hairline); }
.btn.ghost:hover { border-color: var(--muted); background: transparent; }
.btn.small { padding: 4px 14px; font-size: 12px; }
.check, .radio { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; font-size: 14px; }
.check input, .radio input { accent-color: var(--accent); width: 15px; height: 15px; }
.muted { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; line-height: 1.55; }
.field { display: block; margin-bottom: 14px; font-size: 13px; color: var(--text); font-weight: 500; }
.field input, .field select {
  display: block; width: 100%; margin-top: 6px;
  background: #000; border: 1px solid var(--hairline); color: var(--text);
  padding: 9px 14px; border-radius: var(--radius-s); font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder { color: #6e6e73; }
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(41, 151, 255, 0.22);
}
.brand-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; }
pre {
  background: #0d0d0e; border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 14px; font-size: 12px; overflow-x: auto; color: var(--text);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
}

/* ---------- 对比页 ---------- */
.empty { color: var(--muted); padding: 80px 20px; text-align: center; font-size: 15px; }
.columns { display: flex; gap: 20px; align-items: flex-start; }
.col {
  flex: none; width: 390px; max-width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.col-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--panel); position: sticky; top: 0; z-index: 2;
}
.col-head strong { font-size: 15px; }
.col-head select {
  background: var(--panel2); color: var(--text); border: none;
  border-radius: 980px; padding: 4px 12px; font-size: 12px; cursor: pointer;
}
.col-head .note { flex-basis: 100%; }
.col-body { height: calc(100vh - 200px); overflow-y: auto; background: #0d0d0e; }
.col-body img.page-img { display: block; width: 390px; }

/* 叠加模式 */
.overlay-wrap { width: 440px; }
.overlay-stage { position: relative; width: 390px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.overlay-stage img { display: block; width: 390px; }
.overlay-stage img + img { position: absolute; top: 0; left: 0; }
.overlay-ctrl { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.overlay-ctrl input[type="range"] { flex: 1; accent-color: var(--accent); }

/* ---------- 上传页 ---------- */
.dropzone {
  border: 1.5px dashed var(--hairline); border-radius: var(--radius);
  padding: 44px 20px; text-align: center; color: var(--muted);
  background: var(--panel); margin-bottom: 20px; transition: all 0.15s;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-weak); }
.queue { display: flex; flex-direction: column; gap: 8px; }
.queue-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 16px;
}
.queue-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.rec-item .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-item button { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; }

/* ---------- 报告页 ---------- */
.report { max-width: 900px; }
.report-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 36px; margin-bottom: 20px;
}
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.report-head h3 { font-size: 24px; font-weight: 700; letter-spacing: -0.015em; }
.report-card h4 {
  margin: 30px 0 14px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -0.01em;
}
.report-card h5.sub-head { color: var(--muted); font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.report-card table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.report-card th, .report-card td {
  border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top;
}
.report-card th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.report-card .li {
  background: var(--panel2); border-radius: var(--radius-s);
  padding: 12px 16px; margin-bottom: 10px; font-size: 13.5px;
}
.report-card .li .k { color: var(--muted); margin-right: 8px; }
.report-card .li strong { display: block; margin-bottom: 4px; }
.report-card .li-row { padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.report-card .li-row:last-child { border-bottom: none; }
.report-card .li-row .k { color: var(--muted); margin-right: 8px; }
.report-card pre { white-space: pre-wrap; }
.hist-item {
  display: block; padding: 10px 12px; border-radius: var(--radius-s); color: var(--text);
  font-size: 13px; line-height: 1.5; cursor: pointer; transition: background 0.15s;
}
.hist-item:hover { background: var(--panel2); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, 0.25); }

/* ---------- 登录浮层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(20px) saturate(180%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 36px 32px; text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.login-card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.login-card input[type="password"] {
  width: 100%; margin: 18px 0; padding: 11px 16px;
  background: #000; border: 1px solid var(--hairline); color: var(--text);
  border-radius: var(--radius-s); font-size: 15px;
}
.login-card input[type="password"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(41, 151, 255, 0.22); }
.login-card .btn { width: 100%; }
.login-card .err { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 6px; }
.login-card #tsBox { display: flex; justify-content: center; }
.login-card .hint { margin-top: 0; }

/* ---------- 标签 ---------- */
.tag {
  font-size: 11px; color: var(--accent); background: var(--accent-weak);
  border-radius: 980px; padding: 2px 10px; font-weight: 500;
}

/* ---------- 品牌分组 ---------- */
.group-box {
  border-radius: var(--radius-s);
  padding: 12px 14px; margin-bottom: 10px;
  background: var(--panel2);
}
.group-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.group-name { font-weight: 600; font-size: 13px; }
.x-btn {
  margin-left: auto; background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 8px; border-radius: 980px;
  transition: all 0.15s;
}
.x-btn:hover { color: var(--danger); background: rgba(255, 69, 58, 0.12); }
.brand-row { display: flex; align-items: center; gap: 4px; }
.brand-row .check { flex: 1; min-width: 0; }
.brand-block { display: block; padding: 2px 0; }
.brand-subhead { display: flex; align-items: center; font-size: 13px; padding: 3px 0; }
.add-brand-sel {
  width: 100%; margin-top: 6px; font-size: 12px; color: var(--muted);
  background: #000; border: 1px dashed var(--hairline); border-radius: var(--radius-s); padding: 6px 10px;
}
.group-add-btn { width: 100%; margin-top: 4px; }
.group-add-form { display: flex; gap: 6px; margin-top: 4px; }
.group-add-form .group-name-input {
  flex: 1; min-width: 0; font-size: 13px; color: var(--text);
  background: #000; border: 1px solid var(--hairline); border-radius: var(--radius-s); padding: 6px 10px;
}
.group-add-form .group-name-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(41, 151, 255, 0.2); }
.rec-indent { margin-left: 16px; }
.report-actions { display: flex; gap: 8px; }

/* 报告页：顶部横向（筛选+选择条目）+ 底部左右（历史 | 报告） */
.report-page { display: flex; flex-direction: column; min-height: calc(100vh - 118px); }
.report-side { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 16px; }
.report-controls { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.report-controls .field { flex: 1; min-width: 240px; margin: 0; }
.report-controls .btn { flex: none; height: 40px; }
.report-controls .hint { flex-basis: 100%; margin: 0; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.group-grid .group-add-btn { grid-column: 1 / -1; }
.report-bottom { display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 0 20px 20px; align-items: start; flex: 1; }
.history-panel {
  position: sticky; top: 118px;
  max-height: calc(100vh - 138px); overflow-y: auto;
}
@media (max-width: 900px) {
  .report-bottom { grid-template-columns: 1fr; }
  .history-panel { position: static; }
}

/* ---------- 页面库（上传页瀑布流） ---------- */
.gal-panel { padding: 26px; }
.gal-date { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.gal-date select { width: 260px; margin-top: 0; flex: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip {
  border: none; background: var(--panel2); color: var(--text);
  border-radius: 980px; padding: 5px 16px; font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { background: #3a3a3c; }
.chip.active { background: var(--text); color: #000; }
.masonry { columns: 4; column-gap: 18px; margin-top: 14px; }
@media (max-width: 1280px) { .masonry { columns: 3; } }
@media (max-width: 960px) { .masonry { columns: 2; } }
@media (max-width: 640px) { .masonry { columns: 1; } }
.gal-card {
  break-inside: avoid; margin-bottom: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.gal-card:hover { transform: translateY(-2px); border-color: var(--hairline); }
.gal-body { position: relative; overflow: hidden; cursor: zoom-in; background: #0d0d0e; }
.gal-body img { display: block; width: 100%; }
.gal-card:hover .gal-body { overflow-y: auto; }
.gal-hint {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px;
  background: rgba(0, 0, 0, 0.75); color: #fff; font-size: 11px;
  padding: 4px 12px; border-radius: 980px; opacity: 0; transition: opacity 0.15s;
  pointer-events: none; white-space: nowrap; backdrop-filter: blur(4px);
}
.gal-card:hover .gal-hint { opacity: 1; }
.gal-info { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12.5px; }
.gal-info .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* ---------- 大图弹窗 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lb-box {
  width: min(680px, 94vw); max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.lb-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.lb-body { overflow-y: auto; background: #0d0d0e; }
.lb-body img { display: block; width: 100%; }
