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

:root {
  /* —— 底与面：背景比卡片深一档，卡片才浮得起来 —— */
  --bg: #EDF0F6;
  --bg-2: #E4E9F2;
  --panel: #FFFFFF;
  --panel-2: #F5F7FC;
  --hover: #F2F5FC;
  --line: #E1E6F0;
  --line-2: #C9D2E0;

  /* —— 文字：三级灰阶，标题与正文拉开对比 —— */
  --text: #0F172A;
  --text-2: #48566B;
  --text-3: #8794A8;

  /* —— 主色：靛蓝（沉稳、可信，避开浏览器默认蓝）—— */
  --accent: #2C46C8;
  --accent-hi: #2340B8;
  --accent-2: #5B78F0;
  --accent-soft: #E8ECFB;
  --accent-ring: rgba(44, 70, 200, .18);

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

  /* —— 形状与阴影 —— */
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-hover: 0 4px 14px rgba(15, 23, 42, .09), 0 12px 30px rgba(15, 23, 42, .07);
  --shadow-pop: 0 8px 24px rgba(15, 23, 42, .14), 0 24px 56px rgba(15, 23, 42, .12);

  /* —— 节奏 —— */
  --gap: 16px;
  --pad: 18px 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1117;
    --bg-2: #171B24;
    --panel: #1A1F29;
    --panel-2: #141821;
    --hover: #202631;
    --line: #2A3140;
    --line-2: #3D4557;
    --text: #EDF1F7;
    --text-2: #A7B2C3;
    --text-3: #75808F;
    --accent: #7C93F5;
    --accent-hi: #93A6F8;
    --accent-2: #A9B8FA;
    --accent-soft: #212944;
    --accent-ring: rgba(124, 147, 245, .25);
    --red: #F08C86;
    --red-soft: #37201F;
    --amber: #EDAE4B;
    --amber-soft: #362B14;
    --green: #46C79E;
    --green-soft: #102E26;
    --violet: #AB9CF0;
    --violet-soft: #251F42;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .24);
    --shadow-hover: 0 6px 18px rgba(0, 0, 0, .42), 0 14px 34px rgba(0, 0, 0, .3);
    --shadow-pop: 0 10px 32px rgba(0, 0, 0, .55), 0 28px 64px rgba(0, 0, 0, .45);
  }
}

* { 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);
  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; }
.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); }

/* ---------- 导航：分段控件（segmented）---------- */
/* 吸顶导航：半透明 + 毛玻璃，滚动压住内容时不出现突兀的实心灰带 */
.tabsbar {
  position: sticky; top: var(--topbar-h, 0px); z-index: 19;
  padding: 14px 22px 6px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(10px) saturate(1.25);
  -webkit-backdrop-filter: blur(10px) saturate(1.25);
  overflow-x: auto; scrollbar-width: none;
}
.tabsbar::-webkit-scrollbar { display: none; }
.tabs {
  display: flex; gap: 2px; width: max-content;
  padding: 4px; border-radius: 13px;
  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: 7px 16px; border-radius: 9px; cursor: pointer; white-space: nowrap;
  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); color: #fff; font-weight: 600;
  box-shadow: 0 1px 3px var(--accent-ring), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.tabs button.on:hover { background: var(--accent-hi); }
@media (prefers-color-scheme: dark) { .tabs button.on { color: #0B0E14; } }

main { padding: 18px 22px 64px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--pad);
  margin-bottom: var(--gap);
  box-shadow: var(--shadow);
}
/* 浅色下给卡片加一道顶部高光，边缘更立体；暗色不需要，会变成突兀的亮线 */
@media (prefers-color-scheme: light) {
  .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)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 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); }
.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; }

/* 视图切换动效 */
#view > * { 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 > * { 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; }
@media (prefers-color-scheme: dark) { .seg button.on { color: #0B0E14; } }

/* ---------- 周期切换条：标签 + 小号分段 + 自定义日期，与主导航拉开层级 ---------- */
.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 td.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); }

/* ---------- 素材详情（只读弹窗） ---------- */
.tview { display: grid; gap: 12px; }
.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-block > span { display: block; color: var(--text-3); font-size: 12px; margin-bottom: 4px; }
.tv-body {
  font-size: 13px; color: var(--text); line-height: 1.68; white-space: pre-wrap;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px; max-height: 220px; overflow: auto;
}

/* ---------- 表单 ---------- */
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;
}
@media (prefers-color-scheme: dark) {
  select {
    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='%2375808F' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  }
}
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); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0B0E14; } .btn.primary:hover { background: var(--accent-hi); } }

/* ---------- 灯 / 标签 ---------- */
.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; }
.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; }
.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; }

/* ---------- 弹窗 ---------- */
.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;
  backdrop-filter: blur(2px);
}
.mask.on { display: flex; }
.modal {
  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 h3 { margin: 0 0 15px; font-size: 15px; font-weight: 600; }
.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; }

/* ---------- 折线趋势图 ---------- */
.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; }
@media (prefers-color-scheme: dark) { .l-area { opacity: .38; } }

/* ---------- 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;
}
.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; }
@media (prefers-color-scheme: dark) { .colmenu button.on { color: #0B0E14; } }
