/* ==========================================================================
   Enterprise Memory — Prototype V2
   Design tokens + layout + components. Zero build, single stylesheet.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f5f1ea;
  --surface-3: #efeae1;
  --overlay: rgba(23, 35, 46, .38);

  /* ink */
  --ink: #17232e;
  --ink-2: #47586a;
  --ink-3: #7c8b99;
  --ink-4: #a4b0ba;

  /* lines */
  --line: #e8e1d7;
  --line-2: #d8cfc2;

  /* brand */
  --primary: #1d4e6b;
  --primary-hover: #163e56;
  --primary-soft: #e9f0f4;
  --primary-line: #c2d6e0;

  /* status (never color-only: always paired with a glyph + label) */
  --ok: #2e7357;
  --ok-soft: #e6f1ec;
  --warn: #9c5f1c;
  --warn-soft: #f7eddf;
  --risk: #a9452f;
  --risk-soft: #f8e9e5;
  --info: #3b6076;
  --info-soft: #e9eff3;
  --neutral: #6b7783;
  --neutral-soft: #eef0f2;
  --private: #6a4b86;
  --private-soft: #f0ebf5;

  /* geometry */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --sp: 8px;
  --shadow-1: 0 1px 2px rgba(23, 35, 46, .05), 0 1px 3px rgba(23, 35, 46, .04);
  --shadow-2: 0 4px 16px rgba(23, 35, 46, .08);
  --shadow-3: 0 18px 48px rgba(23, 35, 46, .18);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* ---------------------------------------------------------------------
     尺寸档位。同一套界面要在 17 / 24 / 27 / 32 寸上都成立：
     小屏不能挤，大屏不能出现一片空地加一行超长的字。
     字号、边距、栏宽、行长一起放大，比例才不会走形。
     --------------------------------------------------------------------- */
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs: 14px;
  --fs-lg: 15.5px;
  --fs-h2: 18px;
  --fs-h1: 24px;
  --fs-stat: 21px;
  --fs-stat-lg: 26px;

  --sidebar-w: 236px;
  --rail-w: 68px;
  --topbar-h: 60px;
  --content-max: 1240px;
  --content-narrow: 940px;
  --content-pad: 26px;
  --side-col: 320px;
  --ask-max: 560px;
  --field-h: 300px;
  --pad-card: 18px;
  --pad-row: 13px;
  --gap: 16px;
  /* 正文一行最多多少字，超过就该换行了，跟屏幕多宽无关 */
  --measure: 74ch;
  --modal-w: 640px;
}

/* 17 寸笔电 / 1600 宽以上 */
@media (min-width: 1560px) {
  :root {
    --fs-xs: 12.5px; --fs-sm: 13.5px; --fs: 15px; --fs-lg: 16.5px;
    --fs-h2: 20px; --fs-h1: 27px; --fs-stat: 24px; --fs-stat-lg: 30px;
    --sidebar-w: 262px; --topbar-h: 66px;
    --content-max: 1460px; --content-narrow: 1060px; --content-pad: 32px;
    --side-col: 360px; --ask-max: 640px; --field-h: 340px;
    --pad-card: 21px; --pad-row: 15px; --gap: 18px; --modal-w: 720px;
  }
}

/* 24 寸 1920 */
@media (min-width: 1840px) {
  :root {
    --fs-xs: 13.5px; --fs-sm: 14.5px; --fs: 16px; --fs-lg: 17.5px;
    --fs-h2: 22px; --fs-h1: 30px; --fs-stat: 27px; --fs-stat-lg: 34px;
    --sidebar-w: 288px; --topbar-h: 72px;
    --content-max: 1700px; --content-narrow: 1180px; --content-pad: 40px;
    --side-col: 400px; --ask-max: 720px; --field-h: 380px;
    --pad-card: 24px; --pad-row: 17px; --gap: 20px; --modal-w: 800px;
  }
}

/* 27 / 32 寸 2560 及以上 */
@media (min-width: 2400px) {
  :root {
    --fs-xs: 15px; --fs-sm: 16px; --fs: 17.5px; --fs-lg: 19.5px;
    --fs-h2: 25px; --fs-h1: 34px; --fs-stat: 31px; --fs-stat-lg: 39px;
    --sidebar-w: 320px; --topbar-h: 80px;
    --content-max: 2000px; --content-narrow: 1340px; --content-pad: 52px;
    --side-col: 460px; --ask-max: 820px; --field-h: 440px;
    --pad-card: 28px; --pad-row: 20px; --gap: 24px; --modal-w: 900px;
  }
}

/* 4K 全屏 */
@media (min-width: 3200px) {
  :root {
    --fs-xs: 17px; --fs-sm: 18.5px; --fs: 20px; --fs-lg: 22px;
    --fs-h2: 28px; --fs-h1: 39px; --fs-stat: 35px; --fs-stat-lg: 45px;
    --sidebar-w: 380px; --topbar-h: 92px;
    --content-max: 2440px; --content-narrow: 1560px; --content-pad: 64px;
    --side-col: 540px; --ask-max: 960px; --field-h: 520px;
    --pad-card: 34px; --pad-row: 24px; --gap: 28px; --modal-w: 1040px;
  }
}

* { box-sizing: border-box; }

/* 图标跟着字号走。写死 px 的话，32 寸上字大了图标还是小的，比例立刻散架。
   U.icon 出来的 svg 带 width/height 属性，这里用 em 覆盖掉。 */
.nav-ico svg { width: 1.32em; height: 1.32em; }
.btn svg, .chip svg, .topbar svg, .cite svg { width: 1.08em; height: 1.08em; }
.card-head > svg, .banner > svg, .list-item > span > svg,
.page-head svg, .empty svg { width: 1.26em; height: 1.26em; }
.space-btn .si svg, .space-strip .space-ico svg { width: 1.25em; height: 1.25em; }
.mnav-item svg { width: 1.45em; height: 1.45em; }

/* 行长有上限。屏幕再宽，一行字也不该横跨整个显示器。 */
.card-pad > p, .space-strip .space-text span, .compare .raw { max-width: var(--measure); }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: var(--fs-h1); line-height: 1.3; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 10px; }
ul { margin: 0; padding-left: 18px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #ddd5c9; border-radius: 6px; border: 3px solid var(--bg); }

/* ------------------------------------------------------------------ shell */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 2.15em; height: 2.15em; border-radius: .55em; flex: 0 0 2.15em;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: var(--fs); font-weight: 700;
}
.brand-name { font-weight: 650; font-size: var(--fs); letter-spacing: -.01em; }
.brand-sub { font-size: var(--fs-xs); color: var(--ink-3); margin-top: -2px; }

.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-group-label {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-4); padding: 14px 10px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); cursor: pointer; position: relative;
  font-size: var(--fs); width: 100%; background: none; border: 0; text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.nav-item.active .nav-ico { color: var(--primary); }
.nav-ico { width: 1.32em; flex: 0 0 1.32em; display: grid; place-items: center; color: var(--ink-3); }
.nav-count {
  margin-left: auto; font-size: var(--fs-xs); font-weight: 600;
  background: var(--surface-3); color: var(--ink-2);
  padding: 1px 7px; border-radius: var(--r-pill);
}
.nav-item.active .nav-count { background: var(--primary-soft); color: var(--primary); }
.nav-count.alert { background: var(--warn-soft); color: var(--warn); }

.who { border-top: 1px solid var(--line); padding: 12px; }
.who-card {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1);
  width: 100%; border: 0; cursor: pointer; text-align: left;
}
.avatar {
  width: 2.62em; height: 2.62em; border-radius: 50%; flex: 0 0 2.62em;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  font-size: var(--fs-xs); font-weight: 700;
}
.avatar.editor { background: #6a7a54; }
.who-name { font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; }
.who-role { font-size: var(--fs-xs); color: var(--ink-3); }

/* main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 var(--content-pad); border-bottom: 1px solid var(--line);
  background: rgba(250, 247, 242, .88); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-back {
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: var(--r-sm); padding: 4px 10px; cursor: pointer; font-size: var(--fs-sm);
  color: var(--ink-2);
}
.ask-bar {
  flex: 1; max-width: var(--ask-max); display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-pill); padding: 7px 14px; cursor: text;
  color: var(--ink-3); font-size: var(--fs-sm); box-shadow: var(--shadow-1);
}
.ask-bar:hover { border-color: var(--primary-line); }
.ask-bar input { border: 0; outline: 0; background: none; flex: 1; font: inherit; color: var(--ink); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content {
  padding: var(--content-pad);
  max-width: var(--content-max);
  width: 100%;
  margin-inline: auto;   /* 少了这行，2560 以上整块会贴在左边 */
}
.content.narrow { max-width: var(--content-narrow); }

.page-head { margin-bottom: 18px; }
.page-head .eyebrow {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-4); font-weight: 600; margin-bottom: 4px;
}
.page-head .sub { color: var(--ink-2); font-size: var(--fs); margin-top: 6px; max-width: var(--measure); }

/* ------------------------------------------------------------- components */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--pad-card); }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--pad-card) * .78) var(--pad-card); border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { flex: 1; min-width: 0; }
.card-foot { padding: calc(var(--pad-card) * .67) var(--pad-card); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.grid { display: grid; gap: var(--gap); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) var(--side-col); align-items: start; }
.g-main { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  padding: 7px 13px; border-radius: var(--r-sm); cursor: pointer;
  font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--risk); border-color: #e3c6bf; }
.btn.sm { padding: 4px 9px; font-size: var(--fs-xs); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: var(--fs-xs); color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--primary-line); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.chip .n { opacity: .65; font-size: var(--fs-xs); }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
  background: var(--neutral-soft); color: var(--neutral);
}
.tag .glyph { font-size: var(--fs-xs); line-height: 1; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.risk { background: var(--risk-soft); color: var(--risk); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.private { background: var(--private-soft); color: var(--private); }
.tag.plain { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; font-size: var(--fs-sm); }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; gap: 12px; padding: var(--pad-row) var(--pad-card);
  border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start;
  background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 600; font-size: var(--fs); margin-bottom: 3px; }
.li-sub { color: var(--ink-3); font-size: var(--fs-sm); }
.li-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 7px; align-items: center; }
.li-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.stat { padding: 14px 16px; }
.stat .n { font-size: var(--fs-stat-lg); font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 3px; }

.empty {
  padding: 44px 20px; text-align: center; color: var(--ink-3);
  border: 1px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface-2);
}
.empty .big { font-size: var(--fs-lg); color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }

.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%; animation: sh 1.3s ease infinite; border-radius: var(--r-sm); height: 12px; }
@keyframes sh { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.banner {
  display: flex; gap: 11px; padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface-2); font-size: var(--fs-sm); align-items: flex-start;
}
.banner.warn { background: var(--warn-soft); border-color: #e8d2b2; color: #6d4413; }
.banner.risk { background: var(--risk-soft); border-color: #e7c8c0; color: #7d3323; }
.banner.info { background: var(--info-soft); border-color: var(--primary-line); color: #2a4a5d; }
.banner.private { background: var(--private-soft); border-color: #ddd0e8; color: #503868; }
.banner b { font-weight: 650; }

.pipeline { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pipe-col { flex: 1 0 200px; min-width: 200px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.pipe-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.pipe-head .t { font-size: var(--fs-sm); font-weight: 650; }
.pipe-head .c { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3); }
.pipe-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; }
.pipe-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px; cursor: pointer; text-align: left; width: 100%;
}
.pipe-card:hover { border-color: var(--primary-line); box-shadow: var(--shadow-1); }
.pipe-card .t { font-size: var(--fs-sm); font-weight: 600; line-height: 1.35; }
.pipe-card .s { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 4px; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.compare > div { padding: 16px; min-width: 0; }
.compare > div:first-child { border-right: 1px solid var(--line); background: var(--surface-2); }
.compare .lbl { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); font-weight: 600; margin-bottom: 8px; }
.compare .raw { font-size: var(--fs-sm); color: var(--ink-2); white-space: pre-wrap; line-height: 1.7; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line-2); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--primary);
}
.tl-item.muted::before { border-color: var(--ink-4); }
.tl-date { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--mono); }
.tl-title { font-weight: 600; font-size: var(--fs); margin: 2px 0 3px; }
.tl-body { font-size: var(--fs-sm); color: var(--ink-2); }

.chain { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-sm); }
.chain-node { padding: 5px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
.chain-node.current { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chain-sep { color: var(--ink-4); }

.cite {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: baseline;
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-line);
  border-radius: var(--r-sm); padding: 1px 7px; font-size: var(--fs-xs); cursor: pointer; font-weight: 600;
}
.cite:hover { background: #dbe7ee; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 14px; border: 0; background: none; cursor: pointer;
  font-size: var(--fs); color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--primary); font-weight: 600; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface);
  border-radius: var(--r-sm); padding: 8px 11px; font: inherit; font-size: var(--fs); color: var(--ink);
}
.input:focus { outline: 2px solid var(--primary-line); outline-offset: -1px; border-color: var(--primary); }
textarea.input { min-height: 92px; resize: vertical; line-height: 1.6; }

.switch { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--surface-2); padding: 2px; }
.switch button { border: 0; background: none; padding: 5px 13px; border-radius: var(--r-pill); cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2); }
.switch button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }

.modal-back {
  position: fixed; inset: 0; background: var(--overlay); z-index: 90;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  width: min(var(--modal-w), 100%); max-height: 86vh; overflow: auto;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 9px 16px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); box-shadow: var(--shadow-2); animation: rise .22s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.progress { height: 5px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: var(--r-pill); }

.bar-row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); margin-bottom: 7px; }
.bar-row .lab { width: 130px; flex: 0 0 130px; color: var(--ink-2); }
.bar-row .bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--primary); }
.bar-row .val { width: 42px; text-align: right; color: var(--ink-3); font-family: var(--mono); font-size: var(--fs-xs); }

.mini-graph { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-node {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-pill);
  padding: 4px 11px; font-size: var(--fs-xs); cursor: pointer;
}
.mini-node:hover { border-color: var(--primary-line); background: var(--primary-soft); }

.hint { font-size: var(--fs-xs); color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: var(--fs-xs); }
.muted { color: var(--ink-3); }
.tr { text-align: right; }
.nowrap { white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.tbl th {
  text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-4); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr.clickable { cursor: pointer; }
table.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; }

/* ------------------------------------------------------- 企业 / 个人空间 */
.space-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px;
}
.space-btn {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 13px 15px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface);
  box-shadow: var(--shadow-1);
}
.space-btn .si {
  width: 2.7em; height: 2.7em; flex: 0 0 2.7em; border-radius: .62em;
  display: grid; place-items: center; color: #fff; background: var(--ink-4);
}
.space-btn .st { display: flex; flex-direction: column; min-width: 0; }
.space-btn .st b { font-size: var(--fs); font-weight: 650; }
.space-btn .st span { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 1px; }

.space-btn.is-company .si { background: var(--primary); }
.space-btn.is-private .si { background: var(--private); }
.space-btn.is-locked { cursor: not-allowed; opacity: .6; background: var(--surface-2); }
.space-btn.is-locked .si { background: var(--ink-4); }

.space-btn.is-company.on { border-color: var(--primary); background: var(--primary-soft); }
.space-btn.is-private.on { border-color: var(--private); background: var(--private-soft); }
.space-btn:not(.on):not(.is-locked):hover { border-color: var(--primary-line); }

/* 两个空间之间唯一的通道，说清它是单向的 */
.space-bridge {
  display: flex; align-items: flex-start; gap: 8px;
  margin: -8px 0 18px; padding: 9px 12px;
  border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px dashed var(--line-2);
  font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.6;
}
.space-bridge svg { flex: 0 0 auto; margin-top: 2px; color: var(--private); }
.space-bridge b { color: var(--ink-2); }

/* 知识详情顶部的归属条 */
.space-strip {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 14px; border-radius: var(--r); margin-bottom: 14px;
  border: 1px solid var(--line-2); background: var(--surface-2);
}
.space-strip .space-ico {
  width: 2.2em; height: 2.2em; flex: 0 0 2.2em; border-radius: .55em;
  display: grid; place-items: center; color: #fff;
}
.space-strip .space-text { display: flex; flex-direction: column; min-width: 0; }
.space-strip .space-text b { font-size: var(--fs); font-weight: 650; }
.space-strip .space-text span { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }

.space-strip.is-company { border-color: var(--primary-line); background: var(--primary-soft); }
.space-strip.is-company .space-ico { background: var(--primary); }
.space-strip.is-private { border-color: #ddd0e8; background: var(--private-soft); }
.space-strip.is-private .space-ico { background: var(--private); }

/* 个人空间的条目在列表里也要一眼看出来 */
.list-item.priv { border-left: 3px solid var(--private); background: rgba(240, 235, 245, .38); }

@media (max-width: 620px) {
  .space-switch { grid-template-columns: 1fr; gap: 8px; }
}

/* ------------------------------------------------------------ hero field */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 44%);
  overflow: hidden;
}
.hero-left { padding: 24px 24px 22px; min-width: 0; }
.hero-left .eyebrow {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-4); font-weight: 600;
}

.hero-stats {
  display: flex; gap: 26px; margin-top: 18px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b {
  font-size: var(--fs-stat); font-weight: 650; letter-spacing: -.02em;
  line-height: 1.15; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hero-stats span { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; }

.hero-field {
  position: relative; min-height: var(--field-h);
  border-left: 1px solid var(--line);
  background:
    radial-gradient(120% 100% at 78% 18%, #f1ece2 0%, rgba(241, 236, 226, 0) 62%),
    var(--surface-2);
}
/* 绝对定位：画布不参与父容器高度计算，否则 JS 设高会和 height:100% 形成反馈循环 */
.hero-field canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.field-tip {
  position: absolute; z-index: 3; pointer-events: none;
  background: var(--ink); color: #fff;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); line-height: 1.4; max-width: 190px;
  box-shadow: var(--shadow-2);
}
.field-tip b { display: block; font-weight: 600; }
.field-tip span { opacity: .7; font-size: var(--fs-xs); }

.field-legend {
  position: absolute; top: 12px; left: 14px; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: var(--fs-xs); color: var(--ink-3);
}
.field-legend span { display: inline-flex; align-items: center; gap: 5px; }
.field-legend i { width: 7px; height: 7px; border-radius: 50%; display: block; }

/* 底部渐隐，避免说明文字压在节点上读不清 */
.hero-field::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 52px;
  background: linear-gradient(to top, var(--surface-2) 34%, rgba(245, 241, 234, 0));
  pointer-events: none; z-index: 1;
}

.field-cap {
  position: absolute; left: 14px; right: 14px; bottom: 11px; z-index: 2;
  font-size: var(--fs-xs); color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-field {
    min-height: 210px;
    border-left: 0; border-top: 1px solid var(--line);
  }
}
@media (max-width: 620px) {
  .hero-left { padding: 18px 16px 16px; }
  .hero-stats { gap: 18px; margin-top: 14px; padding-top: 12px; }
  .hero-stats b { font-size: var(--fs-h2); }
  .hero-field { min-height: 180px; }
}

/* ------------------------------------------------------ 公开知识包页面 */
/* 唯一一个给陌生人看的页面。排版按「一份小报告」做，不是后台列表。 */
.pub-wrap {
  max-width: 680px; margin: 0 auto; padding: 0 20px 60px;
  font-size: var(--fs);
}
.pub-note {
  margin: 14px 0 0; padding: 7px 11px; border-radius: var(--r-sm);
  background: var(--warn-soft); color: #6d4413;
  font-size: var(--fs-xs); text-align: center;
}
.pub-head { padding: 44px 0 26px; border-bottom: 1px solid var(--line); }
.pub-kicker {
  font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-4); font-weight: 600; margin-bottom: 10px;
}
.pub-head h1 {
  font-size: calc(var(--fs-h1) * 1.22); line-height: 1.25; letter-spacing: -.02em;
}
.pub-intro {
  margin: 14px 0 0; color: var(--ink-2); font-size: var(--fs-lg);
  line-height: 1.7; max-width: 40ch;
}
.pub-facts {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 20px;
  font-size: var(--fs-xs); color: var(--ink-3);
}
.pub-facts b { color: var(--ink); font-size: var(--fs-sm); }

.pub-items { padding: 8px 0; }
.pub-item {
  display: flex; gap: 18px; padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.pub-num {
  flex: 0 0 auto; width: 1.9em; height: 1.9em; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center;
  font-size: var(--fs-sm); font-weight: 700; margin-top: 2px;
}
.pub-body { min-width: 0; }
.pub-body h3 { font-size: var(--fs-lg); line-height: 1.4; margin-bottom: 9px; }
.pub-statement { margin: 0 0 10px; line-height: 1.75; color: var(--ink); }
.pub-why {
  margin: 0; line-height: 1.7; color: var(--ink-2); font-size: var(--fs-sm);
  padding-left: 12px; border-left: 2px solid var(--line-2);
}
.pub-why b {
  display: block; font-size: var(--fs-xs); color: var(--ink-4);
  letter-spacing: .06em; margin-bottom: 3px;
}
.pub-meta {
  display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 13px;
  font-size: var(--fs-xs); color: var(--ink-3);
}

.pub-cta {
  margin-top: 34px; padding: 32px 28px; border-radius: var(--r-lg);
  background: var(--primary); color: #fff; text-align: center;
}
.pub-cta h2 { font-size: var(--fs-h2); line-height: 1.35; margin-bottom: 10px; }
.pub-cta p {
  margin: 0 auto 20px; max-width: 44ch; line-height: 1.75;
  color: rgba(255, 255, 255, .82); font-size: var(--fs-sm);
}
.pub-btn {
  border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: #fff; color: var(--primary);
  padding: 11px 26px; font-size: var(--fs); font-weight: 650;
}
.pub-btn:hover { background: #f2ece1; }
.pub-btn.ghost {
  background: rgba(255, 255, 255, .14); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .38);
}
.pub-fine {
  margin-top: 14px; font-size: var(--fs-xs);
  color: rgba(255, 255, 255, .62); max-width: 40ch; margin-inline: auto;
}
.pub-cta-done svg { margin: 0 auto 8px; display: block; }

.pub-foot {
  margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pub-brand { display: flex; align-items: center; gap: 9px; font-weight: 650; }
.pub-mark {
  width: 1.9em; height: 1.9em; border-radius: .5em; background: var(--primary);
  color: #fff; display: grid; place-items: center;
  font-size: var(--fs-sm); font-weight: 700;
}
.pub-foot .hint { margin-left: auto; }

@media (max-width: 620px) {
  .pub-wrap { padding: 0 16px 48px; }
  .pub-head { padding: 28px 0 20px; }
  .pub-item { gap: 12px; padding: 22px 0; }
  .pub-cta { padding: 26px 18px; }
  .pub-foot .hint { margin-left: 0; width: 100%; }
}

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 20% -10%, #f2ece1 0%, transparent 60%), var(--bg); }
.login-card { width: min(420px, 100%); }
.role-pick { display: flex; flex-direction: column; gap: 10px; }
.role-btn {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r);
  padding: 14px; cursor: pointer;
}
.role-btn:hover { border-color: var(--primary); box-shadow: var(--shadow-1); }

/* mobile bottom nav */
.mobile-nav { display: none; }

/* 全局随手记：固定在工作流之外，任何页面都能先把想法接住。 */
.quick-capture-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  min-height: 48px; padding: 0 17px; border: 0; border-radius: var(--r-pill);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  color: #fff; background: var(--primary); box-shadow: 0 10px 30px rgba(23, 35, 46, .24);
  font-weight: 650; letter-spacing: .01em;
}
.quick-capture-fab:hover { background: var(--primary-hover); transform: translateY(-1px); }
.quick-capture-fab:focus-visible { outline: 3px solid var(--primary-line); outline-offset: 3px; }

.mobile-menu-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mobile-menu-item {
  min-width: 0; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r); padding: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 9px; text-align: left;
}
.mobile-menu-item:hover { border-color: var(--primary-line); background: var(--primary-soft); }
.mobile-menu-item > span:nth-child(2) { flex: 1; font-weight: 600; }
.mobile-menu-ico { color: var(--primary); }

.quick-capture-panel { display: grid; gap: 18px; }
.quick-capture-simple { display: grid; gap: 14px; }
.quick-capture-simple-lead { display: flex; gap: 11px; align-items: flex-start; padding: 13px; background: var(--primary-soft); border: 1px solid var(--primary-line); border-radius: var(--r); }
.quick-capture-simple-lead p { margin: 4px 0 0; color: var(--ink-2); font-size: var(--fs-sm); }
.quick-capture-simple-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: var(--primary); background: #fff; flex: 0 0 auto; }
.quick-capture-simple-input { min-height: 150px; font-size: var(--fs-lg); }
.quick-capture-simple-status { color: var(--ink-3); font-size: var(--fs-sm); }
.quick-capture-simple-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick-capture-simple-spacer { flex: 1; }
.voice-button { color: var(--primary); border-color: var(--primary-line); }
.voice-button.on { color: #fff; background: var(--primary); border-color: var(--primary); }
@media (max-width: 620px) { .quick-capture-simple-actions > button { flex: 1 1 100%; } .quick-capture-simple-spacer { display: none; } }
.quick-capture-section { display: grid; gap: 11px; }
.wechat-ime-card { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--primary-line); background: var(--primary-soft); border-radius: var(--r); }
.wechat-ime-card .quick-capture-kicker { color: var(--primary); }
.wechat-ime-card .prototype-note { color: var(--ink-2); }
.quick-capture-kicker { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.quick-capture-kicker svg { color: var(--primary); }
.quick-capture-actions { justify-content: space-between; align-items: center; }
.quick-capture-or { display: flex; align-items: center; gap: 10px; color: var(--ink-4); font-size: var(--fs-xs); }
.quick-capture-or::before, .quick-capture-or::after { content: ''; height: 1px; background: var(--line); flex: 1; }
.recording-card { padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.recording-state { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; color: var(--ink-2); }
.recording-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-4); }
.recording-pulse.on { background: var(--risk); animation: recording-pulse 1.15s ease-in-out infinite; }
.recording-time { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.recording-preview-slot audio { display: block; width: 100%; height: 38px; }
.recording-actions { gap: 8px; }
.prototype-note { margin: 0; color: var(--ink-3); font-size: var(--fs-xs); line-height: 1.55; }
@keyframes recording-pulse { 50% { transform: scale(1.55); box-shadow: 0 0 0 5px rgba(169, 69, 47, .12); } }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1120px) {
  .g-side { grid-template-columns: minmax(0, 1fr); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: var(--rail-w); }
  .sidebar { align-items: center; }
  .brand { padding: 16px 0; justify-content: center; }
  .brand-text { display: none; }
  .nav { padding: 10px 8px; width: 100%; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-label, .nav-count, .nav-group-label { display: none; }
  .who { width: 100%; display: flex; justify-content: center; }
  .who-card { justify-content: center; padding: 6px; }
  .who-text { display: none; }
  .content { padding: 18px; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compare { grid-template-columns: 1fr; }
  .compare > div:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .sidebar { display: none; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-actions .hide-sm { display: none; }
  .content { padding: 14px 14px 84px; }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: var(--fs-stat); }
  .kv { grid-template-columns: 104px minmax(0, 1fr); font-size: var(--fs-sm); }
  .list-item { padding: 12px 14px; }
  .card-head, .card-foot { padding: 12px 14px; }
  .card-pad { padding: 14px; }
  .pipe-col { flex: 1 0 82vw; min-width: 82vw; }

  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(8px);
  }
  .mnav-item {
    flex: 1; border: 0; background: none; cursor: pointer; padding: 5px 2px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: var(--fs-xs); color: var(--ink-3); position: relative;
  }
  .mnav-item.active { color: var(--primary); font-weight: 600; }
  .mnav-dot {
    position: absolute; top: 3px; right: 50%; margin-right: -16px;
    width: 7px; height: 7px; border-radius: 50%; background: var(--warn);
    border: 1.5px solid #fff;
  }
  .quick-capture-fab {
    right: 14px; bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    width: 54px; min-width: 54px; height: 54px; padding: 0; justify-content: center;
  }
  .quick-capture-fab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mobile-menu-panel { grid-template-columns: minmax(0, 1fr); }
  .quick-capture-actions { align-items: stretch; flex-direction: column; }
  .quick-capture-actions .btn { width: 100%; }
  .modal { max-height: 92vh; border-radius: var(--r-lg) var(--r-lg) 0 0; align-self: end; }
  .modal-back { padding: 0; align-items: end; }
}

@media print { .sidebar, .topbar, .mobile-nav, .quick-capture-fab { display: none; } }

/* 分享列表右侧的三个数字 */
.pack-stats {
  flex-direction: row !important; align-items: baseline; gap: 4px 6px;
  flex-wrap: wrap; justify-content: flex-end; max-width: 190px;
}
.pack-stats b { font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums; }
.pack-stats span { font-size: var(--fs-xs); color: var(--ink-3); margin-right: 6px; }

/* 问答页：答案块与结构化标记 */
.qa-q {
  font-size: var(--fs-lg); font-weight: 650; line-height: 1.45;
  padding-bottom: 11px; margin-bottom: 13px; border-bottom: 1px solid var(--line);
}
.qa-a { font-size: var(--fs-lg); line-height: 1.75; margin: 0; max-width: var(--measure); }
.qa-code {
  margin: 0; padding: 13px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: var(--fs-xs); line-height: 1.6;
  overflow-x: auto; white-space: pre;
}

/* 每页底部的品牌落款 */
.app-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 22px var(--content-pad) 30px;
  max-width: var(--content-max); margin-inline: auto; width: 100%;
  border-top: 1px solid var(--line); margin-top: 10px;
  font-size: var(--fs-xs); color: var(--ink-3); letter-spacing: .02em;
}
.app-foot .hint { margin-left: auto; }
@media (max-width: 620px) {
  .app-foot { padding-bottom: 88px; }
  .app-foot .hint { margin-left: 0; width: 100%; }
}

/* ---------------------------------------------------------------- 驾驶舱 */
.ck-gauges {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 0;
}
.gauge {
  padding: 16px 10px 14px; text-align: center; position: relative;
  border-right: 1px solid var(--line);
}
.gauge:last-child { border-right: 0; }
.gauge svg { width: 100%; max-width: 132px; height: auto; display: block; margin: 0 auto -8px; }
.gauge-v {
  font-size: var(--fs-stat); font-weight: 650; letter-spacing: -.02em;
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.gauge-l { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 4px; font-weight: 500; }
.gauge-s { font-size: var(--fs-xs); color: var(--ink-4); margin-top: 1px; }

.chart-area svg { width: 100%; height: 150px; display: block; }
.chart-ends {
  display: flex; justify-content: space-between;
  font-size: var(--fs-xs); color: var(--ink-4); margin-top: 4px;
  font-family: var(--mono);
}

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { position: relative; flex: 0 0 auto; width: 124px; }
.donut svg { width: 124px; height: 124px; display: block; }
.donut-mid {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.donut-mid b { font-size: var(--fs-stat); font-weight: 650; letter-spacing: -.02em; }
.donut-mid span { font-size: var(--fs-xs); color: var(--ink-3); }
.donut-legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 5px; }
.dl-row {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); cursor: pointer; padding: 2px 0;
}
.dl-row:hover .dl-k { color: var(--primary); }
.dl-row i { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 9px; }
.dl-k { flex: 1; color: var(--ink-2); }
.dl-v { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.chart-bars {
  display: flex; align-items: flex-end; gap: 4px; height: 120px;
}
.cb-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; height: 100%; gap: 5px; }
.cb-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; }
.cb-col span { font-size: var(--fs-xs); color: var(--ink-4); font-family: var(--mono); height: 1em; }

.funnel { display: flex; flex-direction: column; gap: 10px; }
.fn-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.fn-row:hover .fn-k { color: var(--primary); }
.fn-k { width: 68px; flex: 0 0 68px; font-size: var(--fs-sm); color: var(--ink-2); }
.fn-track { flex: 1; height: 14px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.fn-track i { display: block; height: 100%; border-radius: var(--r-pill); }
.fn-v { width: 46px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--fs-sm); }
.fn-d { width: 42px; text-align: right; font-size: var(--fs-xs); color: var(--ink-4); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .ck-gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gauge:nth-child(2) { border-right: 0; }
  .gauge:nth-child(1), .gauge:nth-child(2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 620px) {
  .donut-wrap { gap: 14px; }
  .chart-bars { height: 92px; }
}

/* ---------------------------------------------------------------- 开场页 */
/* 全站唯一的深色界面。它只出现几秒，所以允许用力。 */
.splash {
  position: fixed; inset: 0; z-index: 200; cursor: pointer;
  background:
    radial-gradient(120% 90% at 50% 42%, #16344a 0%, #0d2231 46%, #071522 100%);
  overflow: hidden;
  animation: splash-in .5s ease both;
}
.splash.is-out { animation: splash-out .42s ease both; }
@keyframes splash-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes splash-out { to { opacity: 0; transform: scale(1.02); } }

.splash-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.splash-vig {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(58% 52% at 50% 46%, rgba(7,21,34,.82) 0%, rgba(7,21,34,0) 72%);
}

.splash-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  pointer-events: none; padding: 24px;
}
.splash-mark {
  width: 2.6em; height: 2.6em; border-radius: .7em;
  display: grid; place-items: center; margin-bottom: 18px;
  background: rgba(226,238,245,.1);
  box-shadow: inset 0 0 0 1px rgba(226,238,245,.22);
  color: #e2eef5; font-size: var(--fs-h2); font-weight: 700;
  animation: splash-rise .7s .1s ease both;
}
.splash-brand {
  color: #f2f7fa; font-size: calc(var(--fs-h1) * 1.15); letter-spacing: -.02em;
  animation: splash-rise .7s .18s ease both;
}
.splash-sub {
  color: rgba(226,238,245,.5); font-size: var(--fs-sm);
  letter-spacing: .16em; text-transform: uppercase; margin-top: 8px;
  animation: splash-rise .7s .26s ease both;
}
.splash-tag {
  color: #cfe2ee; font-size: calc(var(--fs-lg) * 1.12); line-height: 1.7;
  margin: 26px 0 0; font-weight: 300;
  animation: splash-rise .7s .34s ease both;
}
.splash-stats {
  display: flex; gap: 26px; flex-wrap: wrap; justify-content: center;
  margin-top: 30px; color: rgba(226,238,245,.52); font-size: var(--fs-xs);
  animation: splash-rise .7s .44s ease both;
}
.splash-stats b {
  display: block; color: #e2eef5; font-size: var(--fs-h2);
  font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.splash-enter {
  margin-top: 40px; color: rgba(226,238,245,.62); font-size: var(--fs-sm);
  letter-spacing: .1em;
  animation: splash-rise .7s .56s ease both, splash-blink 2.6s 1.3s ease-in-out infinite;
}
.splash-note {
  position: absolute; left: 0; right: 0; bottom: 20px; text-align: center;
  color: rgba(226,238,245,.28); font-size: var(--fs-xs); pointer-events: none;
}
@keyframes splash-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes splash-blink { 0%,100% { opacity: .62; } 50% { opacity: .28; } }

@media (max-width: 620px) {
  .splash-tag { margin-top: 20px; }
  .splash-stats { gap: 18px; margin-top: 22px; }
  .splash-enter { margin-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .splash, .splash-mark, .splash-brand, .splash-sub,
  .splash-tag, .splash-stats, .splash-enter { animation: none; }
}

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--ink-3); text-decoration: underline;
  text-underline-offset: 2px; font: inherit;
}
.linkish:hover { color: var(--primary); }

/* 标志。容器负责底色与圆角，svg 自己撑满。 */
.brand-mark { background: none !important; color: var(--primary); padding: 0; overflow: hidden; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.pub-mark { background: none !important; color: var(--primary); overflow: hidden; }
.pub-mark svg { width: 100%; height: 100%; display: block; }
.splash-mark { color: #e2eef5; }
.splash-mark svg { width: 60%; height: 60%; }

/* 品牌块是个按钮，点了回首页 */
.brand {
  width: 100%; border: 0; background: none; cursor: pointer;
  text-align: left; font: inherit; color: inherit;
  border-radius: 0;
}
.brand:hover { background: var(--surface-3); }
.brand:hover .brand-name { color: var(--primary); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name, .brand-sub { display: block; }
.brand:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* 侧栏收成图标条时品牌文字要藏起来。这条必须排在 .brand-text 的 flex 之后才生效。 */
@media (max-width: 900px) {
  .brand-text { display: none; }
  .brand { justify-content: center; padding: 16px 0; }
}

/* ---------- 派生内容：右侧抽屉 ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(20, 30, 40, .28); z-index: 90; display: flex; justify-content: flex-end; }
.drawer { width: min(820px, 100%); height: 100%; background: var(--surface); box-shadow: -8px 0 32px rgba(23, 35, 46, .16); display: flex; flex-direction: column; }
.drawer-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-head h2 { font-size: var(--fs-h2); margin: 0; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 18px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 12px 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tpl { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; text-align: left; background: var(--surface); cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 4px; }
.tpl:hover { border-color: var(--primary-line, var(--primary)); }
.tpl.on { border-color: var(--primary); background: var(--primary-soft); }
.tpl .tpl-t { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.md-preview { line-height: 1.75; font-size: var(--fs); }
.md-preview h1, .md-preview h2, .md-preview h3 { margin: 16px 0 8px; }
.md-preview h2 { font-size: var(--fs-h2); } .md-preview h3 { font-size: var(--fs-lg); }
.md-preview p { margin: 0 0 10px; } .md-preview ul, .md-preview ol { margin: 0 0 10px 20px; }
.md-preview table { border-collapse: collapse; width: 100%; margin: 8px 0 12px; font-size: var(--fs-sm); }
.md-preview th, .md-preview td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.derive-editor { width: 100%; min-height: 420px; font-family: inherit; line-height: 1.7; }
@media (max-width: 760px) { .drawer { width: 100%; } .tpl-grid { grid-template-columns: 1fr 1fr; } }

/* 首页登录：Logo、文字与表单作为一个整体居中，短屏可滚动。 */
.splash { cursor: default; overflow-y: auto; display: flex; flex-direction: column; }
.splash-center { position: relative; inset: auto; flex: 1 0 auto; width: 100%;
  min-height: calc(100% - 48px); padding: 36px 24px 20px; pointer-events: auto; }
.splash-note { position: relative; bottom: auto; flex: 0 0 auto; padding: 8px 20px 20px;
  color: rgba(226,238,245,.65); }
.splash-login { width: min(100%, 340px); margin: 26px auto 0; text-align: left; }
.splash-login .field { margin-bottom: 14px; }
.splash-login label { display: block; color: #d9e7ef; margin-bottom: 6px; font-size: 14px; }
.splash-login .input { width: 100%; min-height: 46px; font-size: 16px; color: #f2f7fa;
  background: rgba(255,255,255,.06); border: 1px solid rgba(207,226,238,.3); }
.splash-login .input::placeholder { color: #92a9b9; }
.splash-login .input:focus-visible { outline: 2px solid #a8d8f5; outline-offset: 2px; }
.splash-login .btn { width: 100%; min-height: 46px; background: #c0dfef; color: #102b3c; border-color: #c0dfef; }
.splash-login .btn:disabled { opacity: .65; cursor: wait; }
.splash-login-msg { min-height: 22px; margin: 0 0 8px; color: #ffd0bd; font-size: 14px; }
.splash-login-help { margin: 14px 0 0; color: #a6bdcb; font-size: 12px; text-align: center; line-height: 1.6; }
.splash-auth .splash-tag { margin-top: 18px; }
.splash-enter { pointer-events: auto; animation: none; }
@media (max-width: 620px), (max-height: 720px) {
  .splash-center { padding: 24px 20px 12px; }
  .splash-auth .splash-mark { margin-bottom: 12px; }
  .splash-auth .splash-tag { margin-top: 12px; }
  .splash-login { margin-top: 18px; }
}
