/* 短剧经营中心 · 后台面板皮肤
   参考飞书低代码应用：深色侧栏、灰底白卡、暖灰棕图表、语义色标签。
   重点数据靠字号/字重/颜色三层区分：页面标题 20、卡片标题 14、表单主体 13、辅助 12/11.5。 */
:root {
  --ink: #1f2329;
  --ink-2: #4e5969;
  --ink-3: #646a73;
  --ink-4: #8f959e;
  --ink-5: #a9aeb8;
  --line: #e5e6eb;
  --line-soft: #f0f1f3;
  --line-strong: #d0d3d9;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f7f8fa;
  --sidebar: #26282c;
  --sidebar-2: #202226;
  --sidebar-hover: #323438;
  --sidebar-active: #3a3d42;
  --sidebar-text: #c9cdd4;
  --sidebar-text-strong: #ffffff;
  --blue: #3370ff;
  --blue-soft: #eef3ff;
  --green: #00a870;
  --green-soft: #e8f8f2;
  --orange: #ff7d00;
  --orange-soft: #fff3e8;
  --red: #f54a45;
  --red-soft: #fdecec;
  --purple: #7b61ff;
  --purple-soft: #f0edff;
  --gold: #b58a3d;
  --gold-soft: #fff7e0;
  --taupe: #b3a08b;
  --brown: #8a7764;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-float: 0 8px 28px rgba(31, 35, 41, .14);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: none; }
button { cursor: pointer; }
h1, h2, h3, h4, p, dl, dd, dt { margin: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================ 侧栏 ============================ */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex: 0 0 224px;
  flex-direction: column;
  width: 224px;
  height: 100vh;
  padding: 14px 12px 12px;
  overflow-y: auto;
  background: var(--sidebar);
  color: var(--sidebar-text);
  transition: flex-basis .18s ease, width .18s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 2px 4px 14px;
}
.brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #fff;
  color: #26282c;
  font-size: 13px;
  font-weight: 600;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-text strong { color: #fff; font-size: 13.5px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.brand-text small { color: #83888f; font-size: 10.5px; line-height: 14px; }
.sidebar-toggle {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #83888f;
  transition: background .15s, color .15s, transform .18s;
}
.sidebar-toggle:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar.is-collapsed { flex-basis: 64px; width: 64px; }
.sidebar.is-collapsed .sidebar-toggle { transform: rotate(180deg); }
.sidebar.is-collapsed .brand-text,
.sidebar.is-collapsed .nav-item span,
.sidebar.is-collapsed .nav-group-title span,
.sidebar.is-collapsed .nav-group-title svg,
.sidebar.is-collapsed .side-user-text,
.sidebar.is-collapsed .side-link { display: none; }
.sidebar.is-collapsed .sidebar-brand {
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-height: 0;
  padding: 2px 0 10px;
}
.sidebar.is-collapsed .sidebar-toggle { position: static; margin: 0 auto; }
.sidebar.is-collapsed .nav-item { justify-content: center; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--sidebar-text);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item[aria-current="page"] { background: var(--sidebar-active); color: var(--sidebar-text-strong); font-weight: 500; }
.nav-icon { flex: none; opacity: .82; }
.nav-item[aria-current="page"] .nav-icon { opacity: 1; }
.nav-group { margin-top: 12px; }
.nav-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 10px 6px;
  border: 0;
  background: transparent;
  color: #7c8087;
  font-size: 11.5px;
  line-height: 1;
  letter-spacing: .02em;
}
.nav-group-title svg { transition: transform .16s; }
.nav-group.is-collapsed .nav-group-title svg { transform: rotate(-90deg); }
.nav-group.is-collapsed .nav-group-items { display: none; }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot { margin-top: auto; padding: 16px 4px 2px; }
.side-user { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 6px; border-radius: 8px; }
.side-user:hover { background: var(--sidebar-hover); }
.side-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #3a3d42;
  color: #e5e6eb;
  font-size: 11px;
}
.side-user-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.side-user-text strong { color: #e5e6eb; font-size: 12px; font-weight: 500; line-height: 16px; }
.side-user-text span { color: #83888f; font-size: 10.5px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-link { display: block; margin: 6px 6px 0; color: #83888f; font-size: 11.5px; line-height: 18px; }
.side-link:hover { color: #fff; }

/* ============================ 主区域 ============================ */
.app-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.workspace.page { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 18px 24px 52px; scroll-margin-top: 64px; }
.workspace-inner { width: 100%; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 2px 0 16px;
}
.page-heading h1 { color: var(--ink); font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.2px; }
.page-sub { margin-top: 5px; color: var(--ink-4); font-size: 12px; line-height: 1.5; }
.page-head-side { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding-bottom: 2px; font-size: 12px; color: var(--ink-4); }
.head-stats { font-variant-numeric: tabular-nums; }
.head-stats b { color: var(--ink); font-weight: 600; }
.snapshot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 5px;
  background: #e9eaee;
  color: var(--ink-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.snapshot-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.text-link { color: var(--blue); font-size: 12px; }
.text-link:hover { color: #245bdb; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--blue); font-size: 12px; }
.text-button:hover { color: #245bdb; }

/* ============================ KPI ============================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.kpi-grid.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 15px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.kpi-card:hover { border-color: var(--line-strong); box-shadow: 0 3px 12px rgba(31, 35, 41, .07); }
.kpi-label { display: flex; align-items: center; gap: 6px; color: var(--ink-4); font-size: 12px; line-height: 18px; }
.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  color: var(--ink);
  font-size: 29px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.8px;
  font-variant-numeric: tabular-nums;
}
.kpi-value small { color: var(--ink-4); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.kpi-value.is-small { font-size: 16px; font-weight: 600; letter-spacing: 0; line-height: 1.4; }
.kpi-card.is-warn .kpi-value { color: var(--orange); }
.kpi-card.is-danger .kpi-value { color: var(--red); }
.kpi-card.is-good .kpi-value { color: var(--green); }
.kpi-note { color: var(--ink-4); font-size: 11.5px; line-height: 17px; overflow-wrap: anywhere; }
.kpi-note b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-note .is-up { color: var(--red); font-weight: 600; }
.kpi-note .is-down { color: var(--green); font-weight: 600; }

/* 重点提示条 */
.focus-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 12px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.focus-title { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.focus-title::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.focus-list { display: flex; flex-wrap: wrap; gap: 8px; }
.focus-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 20px;
  text-align: left;
}
.focus-item:hover { background: #eef0f3; }
.focus-item b { color: var(--ink); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.focus-item.is-danger b { color: var(--red); }
.focus-item.is-warn b { color: var(--orange); }
.focus-item.is-info b { color: var(--blue); }
.focus-item.is-muted b { color: var(--ink-3); }
.focus-item .focus-arrow { color: var(--ink-5); font-size: 11px; }
.focus-empty { color: var(--ink-4); font-size: 12px; }

/* ============================ 卡片与网格 ============================ */
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.chart-card { min-width: 0; padding: 15px 18px 13px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.card-head h2 { color: var(--ink); font-size: 14px; font-weight: 600; line-height: 20px; }
.card-sub { margin-top: 3px; color: var(--ink-4); font-size: 11.5px; line-height: 17px; }
.card-side { flex: none; color: var(--ink-4); font-size: 11.5px; line-height: 20px; font-variant-numeric: tabular-nums; }
.card-link { flex: none; color: var(--blue); font-size: 12px; line-height: 20px; white-space: nowrap; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 366px; gap: 14px; align-items: start; margin-top: 14px; }
.category-charts { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 14px; align-items: stretch; margin-top: 14px; }
.category-charts .chart-card { display: flex; flex-direction: column; height: 100%; }
.category-charts .chart-card { min-height: 280px; }
.category-charts .donut-wrap { min-height: 250px; }
.home-main, .home-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.grid-2col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.chart { min-width: 0; }
.chart svg { display: block; width: 100%; overflow: visible; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 208px; }
.rank-wrap { min-width: 0; }
.change-list { display: flex; flex-direction: column; gap: 2px; }
.change-item { display: flex; flex-direction: column; gap: 2px; padding: 7px 6px; border-radius: 6px; color: var(--ink-2); }
.change-item:hover { background: var(--surface-3); }
.change-name { color: var(--ink); font-size: 12.5px; font-weight: 500; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.change-note { color: var(--ink-4); font-size: 11px; line-height: 16px; }
.change-list .history-empty { padding: 12px 4px; }

/* ============================ 图表通用 ============================ */
.chart-bar { transition: opacity .12s; }
.chart-band { pointer-events: all; }
.chart-h-label, .chart-h-value { pointer-events: none; }
.donut-seg { transition: stroke-width .14s, opacity .14s; cursor: pointer; outline: none; }
.donut-wrap .chart-legend { margin-top: 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; padding: 6px 0 2px; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 11.5px; line-height: 18px; }
.chart-legend-item i { width: 7px; height: 7px; border-radius: 2px; }
.rank-list { display: flex; flex-direction: column; gap: 1px; }
.rank-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
}
.rank-item.has-avatar { grid-template-columns: 22px 24px minmax(0, 1fr) auto; }
.rank-avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #384252; font-size: 11px; }
.rank-name-wrap { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rank-item:hover { background: var(--surface-3); }
.rank-no {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #f2f3f5;
  color: var(--ink-4);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rank-item.is-top-1 .rank-no { background: var(--gold-soft); color: #a87300; }
.rank-item.is-top-2 .rank-no { background: #f0f2f5; color: #5d6b7a; }
.rank-item.is-top-3 .rank-no { background: #fbf0e6; color: #a45f2a; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 12.5px; font-weight: 500; }
.rank-sub { color: var(--ink-4); font-size: 10.5px; line-height: 14px; }
.rank-value { color: var(--ink); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-empty { padding: 18px 6px; color: var(--ink-4); font-size: 12px; text-align: center; }
.chart-tip {
  position: fixed;
  z-index: 90;
  min-width: 150px;
  max-width: 280px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-float);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}
.chart-tip-title { margin-bottom: 5px; color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.chart-tip-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.chart-tip-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.chart-tip-name { margin-right: auto; color: var(--ink-3); }
.chart-tip-value { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip-note { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); color: var(--ink-4); font-size: 11px; line-height: 1.55; white-space: pre-line; }

/* ============================ 筛选 / 标签页 ============================ */
.filter-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 12px;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 142px; }
.filter-field > span { color: var(--ink-4); font-size: 11.5px; line-height: 16px; }
.filter-field select, .select-compact {
  height: 32px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f959e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.filter-field select:hover, .select-compact:hover { border-color: var(--line-strong); }
.filter-field select:focus-visible, .select-compact:focus-visible, .search-box:focus-within { outline: 2px solid rgba(51, 112, 255, .25); outline-offset: 1px; border-color: var(--blue); }
.filter-tools { display: flex; flex: 1; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; min-width: 280px; }
.select-compact { min-width: 96px; }
.search-box {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-4);
}
.search-box input { width: 200px; padding: 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 12.5px; }
.search-box input::placeholder { color: var(--ink-5); }
.list-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 18px;
  margin-bottom: 10px;
}
.tabs { display: flex; flex-wrap: wrap; gap: 22px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0 9px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; border-radius: 2px; background: var(--ink); }
.tab-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 8px;
  background: #f2f3f5;
  color: var(--ink-4);
  font-size: 11px;
  font-weight: 400;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tab[aria-selected="true"] .tab-count { background: #eef0f3; color: var(--ink-2); }
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink-2); }
.chip.is-active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================ 表格 ============================ */
.data-card { overflow: hidden; }
.table-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-3);
  font-size: 12px;
}
.table-headline b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.table-headline-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.active-filters { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.table-headline .muted { color: var(--ink-4); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-4);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 20px;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.is-clickable { cursor: pointer; }
.data-table tbody tr.is-clickable:hover td { background: var(--surface-3); }
.data-table th.num, .data-table td.num, .data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table th.operation { text-align: right; }
.data-table .is-empty { color: var(--ink-5); }
.data-table .is-good { color: var(--green); font-weight: 600; }
.data-table .is-danger { color: var(--red); font-weight: 600; }
.data-table .is-muted { color: var(--ink-4); }
.data-table tr.is-risk td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.data-table tr.is-warn td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.data-table tr.group-row td {
  padding: 8px 16px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}
.data-table tr.group-row .group-meta { margin-left: 10px; color: var(--ink-4); font-weight: 400; font-variant-numeric: tabular-nums; }
.data-table tr.empty-row td { padding: 42px 16px; }
.empty-cell { display: block; color: var(--ink-4); font-size: 12.5px; text-align: center; }
.data-table .link { color: var(--blue); font-size: 12px; }
.data-table .link:hover { color: #245bdb; }

.project-table { min-width: 980px; }
.project-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.project-name { color: var(--ink); font-size: 13.5px; font-weight: 600; line-height: 19px; overflow-wrap: anywhere; }
.project-sub { color: var(--ink-4); font-size: 11px; line-height: 15px; }
.owner-cell { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.owner-name { color: var(--ink-2); font-size: 12.5px; }
.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #384252;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}
.roi-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.ratio-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 90px; }
.ratio-track { width: 54px; height: 5px; border-radius: 3px; background: #f0f1f3; overflow: hidden; }
.ratio-fill { display: block; height: 100%; border-radius: 3px; background: var(--taupe); }
.operation-cell { color: var(--blue); font-size: 12px; white-space: nowrap; }

/* 标签：语义色，让状态/评级/风险一眼可辨 */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}
.tag.is-blue { background: var(--blue-soft); color: var(--blue); }
.tag.is-green { background: var(--green-soft); color: #00875a; }
.tag.is-orange { background: var(--orange-soft); color: #d25f00; }
.tag.is-danger { background: var(--red-soft); color: #d83931; }
.tag.is-purple { background: var(--purple-soft); color: #6b4df6; }
.tag.is-gold { background: var(--gold-soft); color: #a87300; }
.tag.is-neutral { background: #f2f3f5; color: var(--ink-2); }
.tag.is-muted { background: #f2f3f5; color: var(--ink-4); }
.tag-mini { height: 18px; padding: 0 6px; font-size: 11px; }
.tag + .tag { margin-left: 4px; }

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 11px 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-4);
  font-size: 12px;
}
.pager { display: flex; align-items: center; gap: 6px; }
.page-btn {
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
}
.page-btn:hover:not(:disabled) { border-color: var(--line-strong); }
.page-btn:disabled { color: var(--ink-5); cursor: default; background: var(--surface-2); }
.page-numbers { display: flex; align-items: center; gap: 4px; }
.page-number {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.page-number:hover { background: var(--surface-3); }
.page-number.is-active { border-color: var(--line); background: var(--surface-3); color: var(--ink); font-weight: 600; }
.page-ellipsis { color: var(--ink-5); padding: 0 2px; }
.empty-state { padding: 48px 16px; color: var(--ink-4); font-size: 12.5px; text-align: center; }

/* ============================ 变更记录 ============================ */
.status-moves { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 16px; }
.status-move { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 12px; }
.status-move b { color: var(--ink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.move-arrow { color: var(--ink-5); font-size: 12px; }
.field-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.history-empty { padding: 14px 2px; color: var(--ink-4); font-size: 12px; line-height: 1.7; }
.empty-card { padding: 28px 24px; }
.changes-empty { display: flex; gap: 16px; align-items: flex-start; }
.empty-badge { display: grid; flex: none; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--surface-3); color: var(--ink-3); font-size: 20px; }
.empty-body { min-width: 0; }
.empty-steps { margin: 12px 0 0; padding-left: 18px; color: var(--ink-3); font-size: 12px; line-height: 1.9; }
.empty-steps li::marker { color: var(--ink-5); }
.empty-card h3 { color: var(--ink); font-size: 15px; font-weight: 600; }
.empty-card p { margin-top: 8px; color: var(--ink-3); font-size: 12.5px; line-height: 1.7; }
.muted, .muted-text { color: var(--ink-4); }
.mt-3 { margin-top: 14px; }
.page-footnote { margin-top: 14px; color: var(--ink-4); font-size: 11.5px; line-height: 1.7; }

/* ============================ 响应式 ============================ */
@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid .kpi-card:nth-child(4), .kpi-grid .kpi-card:nth-child(5) { min-width: 0; }
  .home-grid { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1180px) {
  .kpi-grid.kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-charts { grid-template-columns: minmax(0, 1fr); }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .home-side .card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .kpi-grid.kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    overflow: visible;
  }
  .sidebar-brand { flex: none; padding: 0; min-height: 32px; }
  .brand-text small { display: none; }
  .sidebar-toggle { display: none; }
  .sidebar-nav { flex-direction: row; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-group { margin-top: 0; display: flex; align-items: center; }
  .nav-group-title { display: none; }
  .nav-group-items { flex-direction: row; gap: 2px; }
  .nav-item { min-height: 30px; padding: 0 9px; font-size: 12px; }
  .nav-icon { display: none; }
  .sidebar-foot { display: none; }
  .sidebar.is-collapsed { width: 100%; flex-basis: auto; }
  .sidebar.is-collapsed .brand-text,
  .sidebar.is-collapsed .nav-item span { display: inline; }
  .sidebar.is-collapsed .sidebar-brand { flex-direction: row; gap: 9px; padding: 0; }
  .sidebar.is-collapsed .sidebar-toggle { display: none; }
  .workspace.page { padding: 14px 14px 40px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 25px; }
  .grid-2col, .home-side { grid-template-columns: minmax(0, 1fr); }
  .filter-tools { justify-content: flex-start; min-width: 0; }
  .search-box input { width: 150px; }
  .page-head { align-items: flex-start; }
  .tabs { gap: 16px; overflow-x: auto; flex-wrap: nowrap; }
}
@media (max-width: 620px) {
  .kpi-grid, .kpi-grid.kpi-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 24px; }
  .list-tabs { flex-direction: column; align-items: stretch; }
  .tabs { border-bottom: 1px solid var(--line); padding-bottom: 0; }
  .filter-field { flex: 1 1 100%; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .card-head { flex-direction: column; gap: 4px; }
  .pagination { justify-content: flex-start; }
}

/* ============================ 数据对比页 ============================ */
.compare-filters { align-items: flex-end; }
.compare-field { min-width: 186px; }
.compare-arrow { align-self: center; padding-bottom: 7px; color: var(--ink-4); font-size: 13px; }
.check-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.check-toggle input { width: 13px; height: 13px; margin: 0; accent-color: var(--blue); }
.check-toggle:hover { border-color: var(--line-strong); }
.compare-table { width: 100%; min-width: 1294px; table-layout: fixed; }
.compare-table td { vertical-align: top; padding-top: 13px; padding-bottom: 13px; }
.compare-table th:nth-child(1), .compare-table td:nth-child(1) { width: 220px; }
.compare-table th:nth-child(2), .compare-table td:nth-child(2) { width: 152px; }
.compare-table th:nth-child(3), .compare-table td:nth-child(3),
.compare-table th:nth-child(5), .compare-table td:nth-child(5),
.compare-table th:nth-child(6), .compare-table td:nth-child(6) { width: 150px; }
.compare-table th:nth-child(4), .compare-table td:nth-child(4) { width: 168px; }
.compare-table th:nth-child(7), .compare-table td:nth-child(7) { width: 100px; }
.compare-table th:nth-child(8), .compare-table td:nth-child(8) { width: 128px; }
.compare-table .operation { white-space: nowrap; width: 76px; }
.compare-table .operation .link { white-space: nowrap; }
.compare-table th:nth-child(n + 3):nth-child(-n + 6) { min-width: 150px; }
.compare-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.compare-values { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.compare-before { color: var(--ink-4); font-size: 12.5px; }
.compare-arrow-mini { color: var(--ink-5); font-size: 11px; }
.compare-after { color: var(--ink); font-size: 13.5px; font-weight: 600; }
.compare-same { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.compare-delta { font-size: 11px; line-height: 16px; font-variant-numeric: tabular-nums; }
.compare-delta.is-good { color: var(--green); }
.compare-delta.is-danger { color: var(--red); }
.compare-delta.is-warn { color: var(--orange); }
.compare-delta.is-muted { color: var(--ink-4); }
.compare-status { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; }
.compare-subline { color: var(--ink-4); font-size: 11px; line-height: 15px; white-space: normal; overflow-wrap: anywhere; }
.compare-other { display: flex; flex-wrap: wrap; gap: 4px; max-width: 160px; }
.compare-totals td:first-child { color: var(--ink); font-weight: 500; }
.compare-totals .compare-delta { font-size: 12px; }
.compare-totals tr.is-average td:first-child { color: var(--ink-2); }
@media (max-width: 1180px) {
  .compare-table { width: 100%; min-width: 1294px; table-layout: fixed; }
}
@media (max-width: 980px) {
  .compare-field { flex: 1 1 100%; }
  .compare-arrow { display: none; }
  .compare-filters .filter-tools { margin-top: 2px; }
}

/* ============================ 单个剧本详细对比抽屉 ============================ */
body.drawer-open { overflow: hidden; }
.drawer-backdrop {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--vp-width, 100vw);
  z-index: 70;
  display: flex;
  justify-content: flex-end;
  background: rgba(31, 35, 41, .34);
  backdrop-filter: blur(1px);
}
.drawer-panel {
  display: flex;
  flex-direction: column;
  width: min(780px, var(--vp-width, 94vw));
  height: 100%;
  background: var(--surface);
  box-shadow: -12px 0 36px rgba(31, 35, 41, .18);
  animation: drawer-in .2s ease;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--line);
}
.drawer-title-block { min-width: 0; }
.drawer-eyebrow { color: var(--ink-4); font-size: 10.5px; letter-spacing: .12em; line-height: 1.5; }
.drawer-title { margin: 2px 0 0; color: var(--ink); font-size: 20px; font-weight: 600; line-height: 1.35; letter-spacing: -.2px; overflow-wrap: anywhere; }
.drawer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 7px; color: var(--ink-3); font-size: 12px; }
.drawer-close {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 22px;
  line-height: 1;
}
.drawer-close:hover { background: var(--surface-3); color: var(--ink); }
.drawer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 9px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-size: 12px;
}
.drawer-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 22px 32px; }
.drawer-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.drawer-kpi { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.drawer-kpi dt { color: var(--ink-4); font-size: 11px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-kpi dd { margin: 3px 0 0; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.drawer-kpi .compare-delta { margin-top: 1px; }
.drawer-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.drawer-section-title span { color: var(--ink-4); font-size: 11px; font-weight: 400; }
.compare-detail-table { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.compare-detail-table th {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-4);
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
}
.compare-detail-table th:nth-child(1) { width: 122px; }
.compare-detail-table th:nth-child(4) { width: 66px; }
.compare-detail-table td { padding: 8px 9px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); vertical-align: top; overflow-wrap: anywhere; }
.compare-detail-table td:first-child { color: var(--ink-4); font-size: 11.5px; }
.compare-detail-table td.before { color: var(--ink-4); white-space: pre-wrap; }
.compare-detail-table td.after { color: var(--ink); font-weight: 500; white-space: pre-wrap; }
.compare-detail-table tr.is-changed td:first-child { box-shadow: inset 3px 0 0 var(--orange); padding-left: 12px; }
.compare-detail-table tr.is-changed td.after { color: var(--ink); }
.compare-detail-table .change-label { font-size: 11px; color: var(--ink-5); white-space: nowrap; }
.compare-detail-table tr.is-changed .change-label { color: var(--orange); font-weight: 500; }
.compare-detail-table .change-label.is-added { color: var(--green); }
.compare-detail-table .change-label.is-removed { color: var(--red); }
.drawer-empty { padding: 26px 0; color: var(--ink-4); font-size: 12px; text-align: center; }
.compare-detail-table .project-tags { gap: 4px; }
.compare-detail-table .project-tag { height: 20px; font-size: 11px; }
@media (max-width: 900px) {
  .drawer-panel { width: 100%; }
  .drawer-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-head { padding: 14px 16px 10px; }
  .drawer-toolbar, .drawer-body { padding-left: 16px; padding-right: 16px; }
}
