/* ============================================================
   ARGUS · 商业情报中心  全站样式（唯一色源）
   浅色风（2026-07-20 改版，参考 market.appradar.top）。
   设计 tokens 见 :root。通用组件类供各模块直接复用。
   ============================================================ */

:root {
  /* --- 设计 tokens（全站唯一色源） --- */
  --bg: #eef0f5;
  --panel: #ffffff;
  --panel2: #f7f8fb;
  --border: #e7e9f2;
  --text: #111827;
  --text2: #4b5563;
  --muted: #98a1b2;
  --grid: #e6e8ef;
  --accent: #5a4fe0;
  --accent-weak: #eef0ff;
  --good: #1d7a2e;
  --warn: #b26a00;
  --serious: #c2410c;
  --crit: #c02626;

  /* 图表系列色（浅底校验过的顺序，勿循环） */
  --series-1: #2a78d6;
  --series-2: #008300;
  --series-3: #e87ba4;
  --series-4: #eda100;
  --series-5: #1baf7a;
  --series-6: #eb6834;
  --series-7: #4a3aa7;
  --series-8: #e34948;

  /* 商店徽章：浅底 + 深字 */
  --store-googleplay-bg: #e8f5e9;
  --store-googleplay: #1d7a2e;
  --store-appstore-bg: #e8f0fe;
  --store-appstore: #1a5fd0;
  --store-taptap-bg: #fff1e8;
  --store-taptap: #c2410c;
  --store-other-bg: #f1f2f6;
  --store-other: #4b5563;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-login: 0 8px 28px rgba(16, 24, 40, .08), 0 2px 8px rgba(16, 24, 40, .04);
  --sidebar-w: 220px;
  --content-max: 1200px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --tl-line: #e3e6f0;
  --row-hover: #f7f8ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 600; line-height: 1.25; color: var(--text); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

p { margin: 0 0 1em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ============================================================
   布局：左侧固定侧栏 + 居中内容
   ============================================================ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  z-index: 20;
}

.brand {
  display: flex;
  flex-direction: column;
  padding: 0 22px 20px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent);
}
.brand-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 4px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  color: var(--text2);
  font-size: 14px;
  transition: background .12s, color .12s;
}
.nav-item:hover {
  background: var(--panel2);
  color: var(--text);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 600;
  box-shadow: none;
}
.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grid);
  flex: none;
}
.nav-item.active .nav-dot { background: var(--accent); }

.sidebar-foot {
  padding: 14px 16px 4px;
  border-top: 1px solid var(--border);
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.who-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.who-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.who-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
}
.logout:hover { color: var(--serious); }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg);
}
.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 32px 64px;
}

/* 页头 */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; color: var(--text); }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ============================================================
   卡片
   ============================================================ */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* 统计块 */
.stat {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* ============================================================
   表格
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-card);
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th, .table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.table thead th {
  background: var(--panel2);
  color: var(--text2);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}
.table tbody tr { background: var(--panel); }
.table tbody tr:hover { background: var(--row-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table td.num, .table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   表单
   ============================================================ */

.form { display: flex; flex-direction: column; gap: 16px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--text2); }

.input, .select, .textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90, 79, 224, .15);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
select.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2398a1b2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.field-hint { font-size: 12px; color: var(--muted); }

/* ============================================================
   按钮
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s, box-shadow .12s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--panel2);
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #4a3fd0;
  border-color: #4a3fd0;
  color: #fff;
}
.btn-danger {
  border-color: #f0c4c4;
  color: var(--crit);
  background: var(--panel);
}
.btn-danger:hover { background: #fef2f2; }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text2);
}
.btn-ghost:hover {
  background: var(--panel2);
  color: var(--text);
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   徽章（一律浅底 + 深字）
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
  color: var(--text2);
  background: var(--panel2);
  white-space: nowrap;
}

/* 商店徽章 */
.badge-store::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge-googleplay {
  color: var(--store-googleplay);
  background: var(--store-googleplay-bg);
  border-color: transparent;
}
.badge-appstore {
  color: var(--store-appstore);
  background: var(--store-appstore-bg);
  border-color: transparent;
}
.badge-taptap {
  color: var(--store-taptap);
  background: var(--store-taptap-bg);
  border-color: transparent;
}
.badge-other {
  color: var(--store-other);
  background: var(--store-other-bg);
  border-color: transparent;
}

/* 严重度 / 状态徽章 */
.badge-good {
  color: var(--good);
  background: #e8f5e9;
  border-color: transparent;
}
.badge-warn {
  color: var(--warn);
  background: #fff8e6;
  border-color: transparent;
}
.badge-serious {
  color: var(--serious);
  background: #fff1e8;
  border-color: transparent;
}
.badge-crit {
  color: var(--crit);
  background: #fef2f2;
  border-color: transparent;
}
.badge-accent {
  color: var(--accent);
  background: var(--accent-weak);
  border-color: transparent;
}

/* 角色徽章 */
.badge-role { text-transform: uppercase; letter-spacing: .3px; }
.badge-role-admin {
  color: var(--crit);
  background: #fef2f2;
  border-color: transparent;
}
.badge-role-editor {
  color: var(--accent);
  background: var(--accent-weak);
  border-color: transparent;
}
.badge-role-viewer {
  color: var(--text2);
  background: var(--panel2);
  border-color: transparent;
}

/* ============================================================
   Tab 头（overview/reviews/social/scale/creatives/versions/aso）
   ============================================================ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  color: var(--muted);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text2); text-decoration: none; }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   时间线（竖线 + 圆点 + 日期）—— 灵魂功能
   ============================================================ */

.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--tl-line);
}
.timeline-item {
  position: relative;
  padding: 0 0 20px 0;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.timeline-item.tl-version::before { border-color: var(--series-1); }
.timeline-item.tl-aso::before { border-color: var(--warn); }
.timeline-item.tl-creative::before { border-color: var(--series-3); }
.timeline-item.tl-note::before { border-color: var(--series-5); }
.timeline-date {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.timeline-title {
  font-size: 14px;
  font-weight: 600;
  margin: 1px 0 2px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline-icon { font-size: 13px; }
.timeline-detail { font-size: 13px; color: var(--text2); }

/* ============================================================
   分页
   ============================================================ */

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.pagination a:hover {
  background: var(--panel2);
  color: var(--text);
  text-decoration: none;
}
.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ============================================================
   星级评分
   ============================================================ */

.stars {
  display: inline-flex;
  gap: 1px;
  font-size: 13px;
  line-height: 1;
  vertical-align: middle;
  --star-fill: #eda100;
}
.stars .star { color: var(--grid); }
.stars .star.on { color: var(--star-fill); }
.stars-value {
  margin-left: 6px;
  color: var(--text2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   图表容器（Chart.js v4，单轴细线）
   ============================================================ */

.chart-box {
  position: relative;
  width: 100%;
  height: 300px;
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

/* ============================================================
   杂项工具类
   ============================================================ */

.muted { color: var(--muted); }
.text2 { color: var(--text2); }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* 过滤栏 */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 18px;
}
.filters .field { gap: 4px; }

/* 空状态 */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 42px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

/* 缩略图 */
.thumb {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--panel2);
}
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

/* diff 高亮 */
.diff-changed { background: #fff8e6; }
.diff-old { color: var(--serious); }
.diff-new { color: var(--good); }

/* ============================================================
   登录页（--bg 底 + 居中白卡，参考 market）
   ============================================================ */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
}
.login-wrap {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.login-card {
  width: 100%;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: 16px;
  box-shadow: var(--shadow-login);
  border: 1px solid var(--border);
  background: var(--panel);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 6px;
}
.login-mark {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 5px;
  color: var(--accent);
}
.login-sub { font-size: 12px; color: var(--muted); letter-spacing: 2px; }
.login-error {
  background: #fef2f2;
  border: 1px solid #f0c4c4;
  color: var(--crit);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  text-align: center;
}
.login-foot { font-size: 12px; color: var(--muted); letter-spacing: 1px; }

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 780px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .brand { border-bottom: none; padding: 0 12px 0 4px; margin: 0; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; padding: 0 8px; flex: 1; }
  .nav-dot { display: none; }
  .nav-item { border-radius: var(--radius-sm); padding: 8px 12px; }
  .sidebar-foot { border-top: none; padding: 0 8px; }
  .who { margin-bottom: 0; }
  .who-meta { display: none; }
  .main { margin-left: 0; }
  .content { padding: 20px 16px 48px; }
}
