/* ============================================================================
   同等学力申硕 · 小红书内容工作台 — 视觉层
   设计令牌：靛蓝主色体系 / 浅深双主题 / 4pt 间距节奏 / 三段字阶
   ============================================================================ */

:root {
  /* —— 底与面：背景比卡片深一档，卡片才浮得起来 —— */
  --bg: #F5F6F8;
  --bg-2: #EBEEF2;
  --panel: #FFFFFF;
  --panel-2: #F7F8FC;
  --hover: #F0F3FC;
  --line: #E3E8F1;
  --line-2: #CBD4E2;

  /* —— 文字：三级灰阶，标题与正文拉开对比 —— */
  --text: #172033;
  --text-2: #4D5B70;
  --text-3: #7D899C;

  /* —— 主色：靛蓝（沉稳、可信，避开浏览器默认蓝）—— */
  --accent: #356779;
  --accent-hi: #2D5868;
  --accent-2: #5B8B96;
  --accent-soft: #E8F2F3;
  --accent-ring: rgba(53, 103, 121, .18);

  /* —— 语义三色：灯点 / chip / 文字提示共用同一值，避免同屏两种绿 —— */
  --red: #C0302B;
  --red-soft: #FBEDEC;
  --amber: #A9660A;
  --amber-soft: #FCF3E2;
  --green: #0B7A5B;
  --green-soft: #E2F4EE;
  --violet: #6246C9;
  --violet-soft: #EDEAFA;

  /* —— 形状与阴影 —— */
  --r: 16px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 32, 51, .035), 0 2px 6px rgba(23, 32, 51, .045);
  --shadow-hover: 0 5px 16px rgba(23, 32, 51, .09), 0 14px 32px rgba(23, 32, 51, .06);
  --shadow-pop: 0 8px 24px rgba(15, 23, 42, .14), 0 24px 56px rgba(15, 23, 42, .12);

  /* —— 节奏 —— */
  --gap: 18px;
  --pad: 19px 21px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
  line-height: 1.62;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent-soft); color: var(--accent); }

/* 滚动条：跟主题走，不再是突兀的系统灰 */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 7px;
  border: 3px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 12px rgba(23, 32, 51, .035);
  padding: 13px 22px 11px;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.refresh-btn { flex: none; }
.refresh-btn:disabled { opacity: .6; cursor: default; }
.crm-link { display: inline-flex; align-items: center; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .01em; }
/* 品牌标记：圆角方块 + 高光 + 内嵌几何点，比原来的裸竖条更有识别度 */
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none; position: relative;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 2px 7px var(--accent-ring);
}
.brand .mark::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px; border-radius: 3px; background: rgba(255, 255, 255, .95);
}
/* 同步状态做成胶囊：顶栏右侧有一块明确的「系统状态区」，而不是一行散字 */
.sync {
  display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 4px 11px; white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.sync .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.sync.err { color: var(--red); background: var(--red-soft); border-color: var(--red); }
.sync.err .pulse { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* ---------- 工作区：侧边导航 + 内容区 ---------- */
.workspace {
  display: grid; grid-template-columns: 216px minmax(0, 1fr);
  align-items: stretch; gap: 12px; max-width: 1960px; margin: 0 auto;
}
/* 侧边导航吸顶：页面向下滚动时导航始终留在可视区。
   关键点：栅格项不能写 stretch——stretch 会把 aside 拉到整行高度（等于右侧正文高度），
   sticky 元素在自己的盒子内没有滑动余量，实际表现就是跟着页面滚走。
   改用 align-self:start 保持内容高度，再由 sticky 在整行空间里吸附。
   导航卡片另设高度上限，窗口很矮时在卡片内部滚动，不会顶出视口。 */
.tabsbar {
  position: sticky; top: calc(var(--topbar-h, 0px) + 14px); z-index: 19;
  align-self: start;
  padding: 14px 8px 14px 16px; overflow: visible;
}
.tabs {
  display: flex; flex-direction: column; gap: 5px; width: 100%;
  max-height: calc(100vh - var(--topbar-h, 0px) - 56px);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 10px; border-radius: 17px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.tabs button {
  border: none; background: transparent; color: var(--text-2);
  font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 11px 13px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  text-align: left;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.tabs button:hover { background: var(--hover); color: var(--text); }
.tabs button.on {
  background: var(--accent-soft); color: var(--accent); font-weight: 650;
  box-shadow: 0 1px 3px var(--accent-ring), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.tabs button.on:hover { background: #E1E6FC; }
main { width: 100%; max-width: 1720px; margin: 0; padding: 20px 24px 72px; }
@media (max-width: 900px) {
  .workspace { display: block; }
  .tabsbar {
    position: sticky; top: var(--topbar-h, 0px); z-index: 19;
    padding: 10px 14px 6px; overflow-x: auto; scrollbar-width: none;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(10px) saturate(1.25);
    -webkit-backdrop-filter: blur(10px) saturate(1.25);
  }
  .tabsbar::-webkit-scrollbar { display: none; }
  .tabs { flex-direction: row; gap: 2px; width: max-content; padding: 4px; border-radius: 13px;
    max-height: none; overflow-y: visible; }
  .tabs button { padding: 7px 16px; border-radius: 9px; text-align: center; }
  main { max-width: none; padding: 18px 16px 56px; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--pad);
  margin-bottom: var(--gap);
  box-shadow: var(--shadow);
}
/* 浅色下给卡片加一道顶部高光，边缘更立体；暗色不需要，会变成突兀的亮线 */
.card { box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .75); }
/* 卡片默认是信息容器，不做 hover 抬升；只有明确可点的卡挂 .hl */
.card.hl { cursor: pointer; transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease; }
.card.hl:hover { box-shadow: var(--shadow-hover); border-color: var(--line-2); transform: translateY(-1px); }
.card > h2 {
  margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--text);
  letter-spacing: .01em;
}
.card > h2 .sub { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 8px; }

.grid { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.grid > .card { margin-bottom: 0; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* 六列是上限而不是固定值：只有 3 张 KPI 卡时铺满 3 列，不再空掉半行 */
.g6 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1400px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1240px) { .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .g4, .g3, .g2, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) {
  .g4, .g3, .g2, .g5 { grid-template-columns: 1fr; }
  .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kpi-l { font-size: 11.5px; color: var(--text-3); font-weight: 500; letter-spacing: .04em; }
.kpi-v {
  font-size: 28px; font-weight: 600; letter-spacing: -.6px;
  margin: 4px 0 3px; font-variant-numeric: tabular-nums; color: var(--text);
}
.kpi-s { font-size: 12px; color: var(--text-2); }
.kpi-card { position: relative; overflow: hidden; }
.kpi-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); opacity: .72;
}
.kpi-card:nth-child(2)::before { background: var(--violet); }
.kpi-card:nth-child(3)::before { background: #168A78; }
.kpi-card:nth-child(4)::before { background: #D78A24; }
.kpi-card:nth-child(5)::before { background: #D65C75; }
.month-goals-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.month-goals-grid > .month-goal-card { margin-bottom: 0; }
.month-goal-card {
  border-color: #D9E5E8;
  background: linear-gradient(115deg, #FFFFFF 0%, #F4F9FA 100%);
  padding: 18px 22px;
}
.month-goal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.month-goal-count { margin-top: 3px; font-size: 25px; line-height: 1.25; font-weight: 650; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.month-goal-count span { color: var(--text-3); font-size: 14px; font-weight: 500; letter-spacing: 0; }
.month-goal-side { display: flex; align-items: center; gap: 16px; }
.month-goal-side strong { color: var(--accent); font-size: 27px; line-height: 1; font-variant-numeric: tabular-nums; }
.month-goal-track { height: 9px; margin-top: 13px; overflow: hidden; border-radius: 99px; background: #E7ECEF; }
.month-goal-track > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .35s ease; }
.month-goal-foot { margin-top: 6px; color: var(--text-3); font-size: 11.5px; }
@media (max-width: 900px) { .month-goals-grid { grid-template-columns: 1fr; } }
.muted { color: var(--text-3); }
.mini { font-size: 12px; color: var(--text-3); }

/* 键盘 / 触控板操作的焦点可见性 */
:where(button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 7px;
}
:where(input, select, textarea):focus-visible { outline: none; }

/* 视图切换动效：只在切换 tab 时播放（renderBody 更新筛选结果时不再重播，避免闪烁） */
#view.anim > * { animation: rise .26s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #view.anim > * { animation: none; } }

/* ---------- 表格 ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .sp { flex: 1; }

/* 带标签的筛选：下拉框自身说不出筛的是什么，用标签补足语义 */
.flt { display: inline-flex; align-items: center; gap: 6px; }
.flt > span { font-size: 12px; color: var(--text-3); white-space: nowrap; font-weight: 500; }

/* 分段控件：与顶栏导航同一套视觉，用于视图 / 范围切换 */
.seg {
  display: inline-flex; gap: 2px; padding: 4px;
  border-radius: 12px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.seg button {
  border: none; background: transparent; color: var(--text-2);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.seg button:hover { background: var(--hover); color: var(--text); }
.seg button.on {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 3px var(--accent-ring), inset 0 1px 0 rgba(255, 255, 255, .16);
}
/* 卡片内嵌的小号分段：凹进浅灰底，不与卡片糊在一起 */
.seg.sm { padding: 3px; border-radius: 10px; box-shadow: none; background: var(--panel-2); }
.seg.sm button { padding: 4px 11px; font-size: 12px; border-radius: 7px; }
/* ---------- 周期切换条：标签 + 小号分段 + 自定义日期，与主导航拉开层级 ---------- */
.rgbar { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rg-lbl {
  color: var(--text-3); font-size: 12px; font-weight: 600;
  letter-spacing: .04em; flex: none;
}
.rg-dash { color: var(--text-3); font-size: 12px; }
@media (max-width: 680px) { .rgbar { width: 100%; } }
.tbl-wrap { overflow-x: auto; }
/* 长表：容器内滚动 + 表头吸顶，往下翻列名不会丢 */
.tbl-wrap.tall { max-height: 68vh; overflow: auto; }
.tbl-wrap.tall table.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel-2); box-shadow: inset 0 -1px 0 var(--line-2);
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 表头带底色，和正文行分层；首尾圆角收口 */
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2); font-size: 11.5px;
  letter-spacing: .03em; padding: 8px 11px; white-space: nowrap;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
table.tbl th:first-child { border-top-left-radius: var(--r-sm); border-bottom-left-radius: var(--r-sm); }
table.tbl th:last-child { border-top-right-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); }
table.tbl td { padding: 10px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover td { background: var(--hover); }
/* 待处理行（可添加 + 未录入）：浅琥珀底 + 左侧琥珀竖条 + 「待处理」小标。
   和「不可添加」的红色系区分开——这行是要动手的，不是要忽略的。 */
table.tbl tbody tr.lp-todo > td { background: #FDF6E6; border-bottom-color: #F1E4C9; }
table.tbl tbody tr.lp-todo > td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
table.tbl tbody tr.lp-todo:hover > td { background: #F9EDD3; }
.lp-todo-flag {
  display: inline-block; margin-right: 6px; padding: 1px 6px 2px; border-radius: 6px;
  background: var(--amber); color: #fff; font-size: 10.5px; font-weight: 600;
  line-height: 1.5; vertical-align: 1px; letter-spacing: .02em; white-space: nowrap;
}
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
/* 数值列表头也右对齐：只给 td.num 加右对齐时，表头贴左、数字贴右，视觉上是错位的 */
table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.nw, table.tbl th.nw { white-space: nowrap; }
table.tbl td a { color: var(--accent); text-decoration: none; }
table.tbl td a:hover { text-decoration: underline; }
table.tbl tfoot td { padding: 9px 11px; border-top: 1px solid var(--line-2); font-size: 12px; }

/* ---------- 素材选题库：长文本单元格 ---------- */
/* 文案 / 物料内容动辄几百字，限宽 + 两行截断，完整内容交给「查看」弹窗 */
table.tbl td.c-copy { min-width: 150px; max-width: 260px; vertical-align: top; }
.clamp2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 12.5px; color: var(--text-2); line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.cell-title { font-weight: 600; color: var(--text); line-height: 1.45; }
/* 行内状态下拉：与表单控件同一套圆角与 chevron，不再用内联样式写死 */
.stsel { font-size: 12px; padding: 3px 26px 3px 8px; background-position: right 7px center; }
/* 中性标签：账户名这类信息量大、不该抢状态色的场景用它 */
.chip.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* ---------- 素材详情（只读弹窗） ---------- */
/* 详情要读全文，弹窗给宽一档；表单仍用 560px，保持录入视线集中 */
.modal.wide { max-width: 880px; }
.tview { display: grid; gap: 14px; }
.tv-row { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.tv-row > span { flex: none; width: 116px; color: var(--text-3); font-size: 12px; }
.tv-row b { font-weight: 500; overflow-wrap: anywhere; }
.tv-row b a { color: var(--accent); }
/* 内容块头：左侧标签 + 右侧复制按钮 */
.tv-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 6px;
}
.tv-head > span { color: var(--text-3); font-size: 12px; }
/* 正文完整展开，不再内嵌滚动条截断——长文案随遮罩整页滚动 */
.tv-body {
  font-size: 13.5px; color: var(--text); line-height: 1.75; white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 12px 14px;
}

/* ---------- 表头列筛选下的宽表：首列吸左，横向滚动时选题不丢 ---------- */
.tbl-wrap.topic-tbl { overflow: auto; }
.topic-tbl table.tbl th:first-child,
.topic-tbl table.tbl td:first-child {
  position: sticky; left: 0; z-index: 3; background: var(--panel);
  box-shadow: inset -1px 0 0 var(--line);
}
.topic-tbl table.tbl th:first-child { z-index: 4; background: var(--panel-2); }
.topic-tbl table.tbl tbody tr:hover td:first-child { background: var(--hover); }
/* 分组默认折叠到 30 条，底部给一个温和的展开入口 */
.group-more { display: flex; justify-content: center; padding-top: 12px; }
.group-more .mini { margin-right: 10px; }

/* ---------- 表单 ---------- */
select, input, textarea {
  font: inherit; font-size: 13px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 9px;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
/* 下拉框去掉系统原生外观，换成自绘 chevron，视觉与按钮成同一套 */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.75L6 7.75L9 4.75' fill='none' stroke='%238794A8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
textarea { width: 100%; min-height: 64px; resize: vertical; line-height: 1.58; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 4px; font-weight: 500; }
label.f input, label.f select { width: 100%; }
label.f .hint { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.crawl-in { display: flex; gap: 8px; align-items: center; }
.crawl-in input { flex: 1 1 auto; min-width: 0; }
.crawl-in .btn { flex: none; }
.crawl-note { display: none; }
.crawl-note:not(:empty) { display: block; }
.crawl-note.ok { color: var(--green); }
.crawl-note.err { color: var(--red); }
@media (max-width: 680px) { .crawl-in { flex-wrap: wrap; } .crawl-in .btn { width: 100%; } }

/* ---------- 按钮 ---------- */
.btn {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  cursor: pointer; white-space: nowrap;
  /* 主按钮是页面上唯一「发起动作」的入口，微交互只给它，避免满屏都在动 */
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.btn:hover { background: var(--hover); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 1px 2px var(--accent-ring), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn.primary:hover {
  background: var(--accent-hi); border-color: var(--accent-hi);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-ring), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn.primary:active { transform: scale(.96); }
/* 只动 transform / opacity，且尊重系统的减弱动效设置 */
@media (prefers-reduced-motion: reduce) {
  .btn.primary:hover, .btn.primary:active { transform: none; }
}
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { border-color: var(--line-2); background: var(--hover); color: var(--text); }
/* ---------- 灯 / 标签 ---------- */
.light { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.light i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.light.green i { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.light.yellow i { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.light.red i { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.chip {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
  margin: 0 4px 4px 0;
}
.chip.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.violet { background: var(--violet-soft); border-color: transparent; color: var(--violet); }
.chip.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.chip.bad { background: var(--red-soft); border-color: transparent; color: var(--red); }

/* ---------- 条形分布 ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 108px 1fr 52px; align-items: center; gap: 10px; }
.bar-row .bl {
  font-size: 12px; color: var(--text-2); text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-row .bt { height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.bar-row .bt i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .45s cubic-bezier(.4, 0, .2, 1); }
.bar-row .bn { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 人设卡 ---------- */
.pcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--pad); display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow);
}
.pcard.dup { border-color: var(--amber); }
.pcard .ph { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard .pn { font-size: 14px; font-weight: 600; }
.pcard .pt { font-size: 12px; color: var(--accent); font-weight: 500; }
.pcard dl { margin: 0; display: grid; gap: 7px; }
.pcard dt { font-size: 11px; color: var(--text-3); margin: 0; font-weight: 500; letter-spacing: .02em; }
.pcard dd { margin: 1px 0 0; font-size: 12px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.pcard .fields { display: grid; gap: 10px; }
.pcard .pa { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ---------- 账户详情档案 ---------- */
.acc-persona { margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
@media (max-width: 680px) { .acc-persona { grid-template-columns: 1fr; } }
.acc-persona dt { font-size: 11px; color: var(--text-3); margin: 0 0 2px; font-weight: 500; letter-spacing: .02em; }
.acc-persona dd { margin: 0; font-size: 13px; color: var(--text); line-height: 1.55; overflow-wrap: anywhere; }
.acc-persona dd a { color: var(--accent); word-break: break-all; }

/* ---------- 账户切换器（单账户视图顶部） ---------- */
.acc-sw { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acc-sw select { min-width: 210px; max-width: 300px; }
.acc-sw .nav {
  width: 32px; height: 30px; padding: 0; font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); flex: none;
}
.acc-sw .nav:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.acc-sw .pos {
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
  padding: 0 2px; white-space: nowrap;
}
.acc-sw .grp { color: var(--text-3); font-size: 11px; }

/* ---------- 笔记 × 线索 联动表 ---------- */
tr.note-row { cursor: pointer; }
tr.note-row:hover td { background: var(--hover); }
tr.note-row.open td { background: var(--accent-soft); }
tr.note-row.open td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.caret {
  display: inline-block; width: 12px; color: var(--text-3); font-size: 10px;
  transition: transform .18s ease; transform-origin: 50% 50%;
}
tr.note-row.open .caret { transform: rotate(90deg); color: var(--accent); }
tr.note-detail > td { background: var(--panel-2); padding: 0; border-bottom: 1px solid var(--line); }
.note-panel { padding: 13px 14px 15px 32px; display: grid; gap: 12px; }
.note-panel .np-h { font-size: 12px; color: var(--text-3); margin: 0; font-weight: 600; letter-spacing: .02em; }
.note-panel .np-link { color: var(--accent); text-decoration: none; }
.note-panel .np-link:hover { text-decoration: underline; }
.note-panel table.tbl { font-size: 12px; }
.note-panel table.tbl th { padding: 5px 8px; font-size: 11px; }
.note-panel table.tbl td { padding: 7px 8px; }
.note-panel .np-empty { font-size: 12px; color: var(--text-3); }
.note-panel .np-sum {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-2);
}
.note-panel .np-sum b { font-variant-numeric: tabular-nums; }

/* ---------- 提示条 ---------- */
.alert {
  border-radius: var(--r); padding: 11px 15px; margin-bottom: var(--gap); font-size: 13px;
  border: 1px solid var(--amber); border-left-width: 3px;
  background: var(--amber-soft); color: var(--amber);
}
.alert b { font-weight: 600; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.action-alert { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.action-alert > div { display: grid; gap: 2px; }
.action-alert > div > span { color: var(--text-2); }
.action-alert small { color: var(--text-3); font-size: 11.5px; }
.action-alert.alert-data { border-color: #D8A65F; border-left-color: #C78024; }
.action-alert.alert-pillar {
  color: var(--accent); background: var(--accent-soft);
  border-color: #C9D2F6; border-left-color: var(--accent);
}
@media (max-width: 680px) {
  .action-alert { align-items: flex-start; flex-direction: column; }
}

/* ---------- 骨架屏（首屏 / 素材正文懒加载 / 汇总加载） ---------- */
.sk {
  display: block; height: 12px; border-radius: 7px;
  background: var(--bg-2); position: relative; overflow: hidden;
}
.sk + .sk { margin-top: 12px; }
.sk-lg { height: 24px; }
.sk-sm { height: 10px; }
.sk::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
  animation: sk-shimmer 1.25s ease-in-out infinite;
}
@keyframes sk-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .46);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 50; padding: 40px 16px; overflow: auto; overscroll-behavior: contain;
  backdrop-filter: blur(2px);
}
.mask.on { display: flex; animation: mask-in .16s ease both; }
@keyframes mask-in { from { opacity: 0; } to { opacity: 1; } }
/* 弹窗打开时锁住页面滚动，滚轮只作用于遮罩本身 */
body.modal-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .mask.on { animation: none; } }
.modal {
  position: relative;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); width: 100%; max-width: 560px; padding: 20px 22px;
  box-shadow: var(--shadow-pop);
  animation: rise .22s cubic-bezier(.22, .61, .36, 1) both;
}
/* 长内容弹窗可能高过一屏，右上角固定一个关闭键，不必滚到底 */
.modal-x {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--text-3); font: inherit; font-size: 17px; line-height: 1;
  cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.modal-x:hover { background: var(--hover); border-color: var(--line); color: var(--text); }
.modal h3 {
  margin: 0 0 15px; font-size: 15px; font-weight: 600;
  padding-right: 34px; overflow-wrap: anywhere;
}
.modal .mf { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal .mf .full { grid-column: 1 / -1; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.err-msg { color: var(--red); font-size: 12px; margin: 6px 0 0; }

.empty { color: var(--text-3); font-size: 13px; padding: 34px 16px; text-align: center; }
table.tbl td.empty { padding: 34px 16px; }

/* ---------- 窄屏（手机 / 分屏）---------- */
/* 移动优先的收尾：把四周留白与卡片内边距压一档，内容横向可用宽度最大化 */
@media (max-width: 680px) {
  main { padding: 14px 14px 56px; }
  .topbar { padding: 11px 14px 9px; }
  .tabsbar { padding: 12px 14px 6px; }
  .card { padding: 15px; }
  .modal { padding: 17px 16px; }
  .modal .mf { grid-template-columns: 1fr; }
}

.pdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 5px; }

/* ---------- 折线趋势图 ---------- */
.trend-svg { display: block; width: 100%; height: auto; }
.l-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.l-area { fill: var(--accent-soft); opacity: .6; }
.l-dot { fill: var(--panel); stroke: var(--accent); stroke-width: 1.6; }
.l-dot:hover { stroke-width: 2.4; }
.l-lbl { font-size: 9.5px; fill: var(--text-3); }
.l-axis { stroke: var(--line); stroke-width: 1; }
/* ---------- Toast ---------- */
#toast-wrap {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 99;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  background: var(--panel); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 11px; padding: 9px 17px; font-size: 13px; box-shadow: var(--shadow-pop);
  animation: toast-in .22s cubic-bezier(.22, .61, .36, 1) both; max-width: 440px;
  overflow-wrap: anywhere;
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast.out { animation: toast-out .25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ---------- 素材选题库 · 表头列筛选（智能表格） ---------- */
.fth { cursor: pointer; user-select: none; white-space: nowrap; }
.fth .car { font-size: 10px; opacity: .4; margin-left: 4px; }
.fth:hover .car { opacity: .8; }
.fth.on { color: var(--accent); }
.fth.on .car { opacity: 1; }
.colmenu {
  position: fixed; z-index: 90; min-width: 176px; max-height: 300px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow-pop); padding: 6px;
}
.colmenu .cm-t { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 4px 8px 6px; }
.colmenu button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 6px 9px; border-radius: 8px; font: inherit; font-size: 13px;
  color: var(--text); cursor: pointer;
}
.colmenu button:hover { background: var(--hover); }
.colmenu button.on { background: var(--accent); color: #fff; }
/* 时间列筛选面板（在线表格式）：快捷区间做成小胶囊，自定义起止用两个日期输入并排 */
.colmenu.wide { min-width: 268px; }
.colmenu .cm-q { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 6px 8px; }
.colmenu .cm-q button {
  display: inline-block; width: auto; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2);
  font-size: 12px; line-height: 1.4;
}
.colmenu .cm-q button:hover { background: var(--hover); color: var(--text); }
.colmenu .cm-q button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.colmenu .cm-cf { display: flex; align-items: center; gap: 6px; padding: 0 6px 6px; }
.colmenu .cm-cf input {
  flex: 1 1 0; min-width: 0; padding: 4px 7px; font: inherit; font-size: 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text);
}
.colmenu .cm-cf input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.colmenu .cm-cf > span { flex: none; color: var(--text-3); font-size: 12px; }
.colmenu .cm-note { font-size: 11.5px; line-height: 1.5; color: var(--text-3); padding: 0 8px 6px; }
@media (max-width: 560px) {
  .month-goal-head { align-items: flex-start; }
  .month-goal-side { flex-direction: column; align-items: flex-end; gap: 8px; }
  .month-goal-count { font-size: 22px; }
}
@media (max-width: 520px) {
  .topbar-row { flex-wrap: wrap; }
  .top-actions { margin-left: auto; }
}

/* 顶栏登录身份（2026-11-04）：管理员 / 成员 */
.topbar .who{font-size:12px;color:var(--text-3,#8a8f98);padding:0 10px;white-space:nowrap;font-weight:500;}
@media (max-width:760px){.topbar .who{display:none;}}
