:root {
  color-scheme: light;

  /* ── 中性色 ──
     不是纯灰。每一档都朝主色的青绿方向偏了一点点——纯中性灰看起来
     像没调过，带一点主色偏移才像是选出来的。 */
  --bg:            #f1f4f2;
  --surface:       #ffffff;
  --surface-sunk:  #f6f9f7;
  --surface-raise: #ffffff;

  --ink:           #131c1b;
  --ink-2:         #3b4a47;
  --muted:         #5d6c68;
  --faint:         #616e6a;

  --line:          #e3eae6;
  --line-strong:   #cedad5;

  /* ── 语义色 ──
     统一到相近的彩度。原来的橙偏烫、蓝偏灰，彼此不在一个色彩空间里。 */
  --accent:        #0f766e;
  --accent-strong: #0a5d56;
  --accent-soft:   #dff1ed;
  --accent-line:   #a8d8d0;

  --warn:          #8d5f0e;
  --warn-soft:     #fbf0da;
  --danger:        #a3342a;
  --danger-soft:   #fbe9e6;
  --blue:          #2c5e8e;
  --blue-soft:     #e4edf6;
  --violet:        #614a8c;
  --violet-soft:   #ece7f5;

  /* ── 间距刻度 ──
     4px 基数。之前全是随手写的数字，卡片内外的间距没有关系。 */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 22px;
  --s6: 32px;
  --s7: 48px;

  /* ── 字号刻度 ──
     从 13 档收到 8 档。原来 29px 和 30px 并存，层级根本读不出来。 */
  --t-xs:   11.5px;
  --t-sm:   12.5px;
  --t-base: 13.5px;
  --t-md:   15px;
  --t-lg:   17px;
  --t-xl:   21px;
  --t-2xl:  28px;
  --t-num:  32px;

  /* ── 圆角 ──
     从 7 种收到 3 种 + 药丸。混用的圆角是廉价感的第一来源。 */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-pill: 999px;

  /* ── 阴影 ──
     多层柔和叠加，光源统一自上方。单层大模糊会显得"糊"，
     贴地的一层加上扩散的一层才有实体感。 */
  --sh-1: 0 1px 2px rgba(19, 28, 27, .04),
          0 1px 3px rgba(19, 28, 27, .03);
  --sh-2: 0 1px 2px rgba(19, 28, 27, .04),
          0 4px 10px rgba(19, 28, 27, .045),
          0 12px 28px rgba(19, 28, 27, .04);
  --sh-pop: 0 2px 6px rgba(19, 28, 27, .07),
            0 12px 28px rgba(19, 28, 27, .10),
            0 32px 64px rgba(19, 28, 27, .10);

  /* ── 动效 ──
     一档时长、一条缓动曲线。多了就杂。 */
  --dur:  150ms;
  --ease: cubic-bezier(.2, .6, .3, 1);

  /* 兼容旧变量名，避免遗漏处失色 */
  --panel: var(--surface);
  --shadow: var(--sh-2);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 1ms; }
}

/* 侧栏是唯一一块"本来就是深色"的区域。浅色模式下它靠深底和页面区分；
   深色模式下页面也变深了，所以它得再压暗一档，否则两者糊在一起。 */
:root {
  --rail:        #162325;
  --rail-ink:    #f4fbf8;
  --rail-muted:  #c7dbd6;
  --rail-faint:  #adc6c0;
  --rail-active: #223638;
}

/* ══════════════════════════════════════════════════════════
   深色模式
   三态：跟随系统（不打标记）、显式浅色、显式深色。
   媒体查询要排除显式浅色，否则用户在深色系统下选"浅色"会失效。

   语义色不能直接搬。上一轮好不容易调达标的对比度，
   原样放到深底上会全线掉到 2 点几——每个值都是重新算过的。
   ══════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg:            #0f1615;
    --surface:       #17201f;
    --surface-sunk:  #131b1a;
    --surface-raise: #1c2625;

    --ink:           #e4ebe8;
    --ink-2:         #b3c1bd;
    --muted:         #94a49f;
    --faint:         #8a9a95;

    --line:          #26312f;
    --line-strong:   #35423f;

    --accent:        #4fb3a7;
    --accent-strong: #6cc9bd;
    --accent-soft:   #12302d;
    --accent-line:   #2f6b64;

    --warn:          #d9a94e;
    --warn-soft:     #2c2410;
    --danger:        #e08379;
    --danger-soft:   #2f1a17;
    --blue:          #7fb0dd;
    --blue-soft:     #16232f;
    --violet:        #a893d4;
    --violet-soft:   #221c30;

    --rail:          #131d1c;
    --rail-ink:      #e8f1ee;
    --rail-muted:    #9fb5b0;
    --rail-faint:    #7f9591;
    --rail-active:   #1f2e2c;

    /* 深色下阴影几乎看不见，改用更强的边框承担分层。 */
    --sh-1: 0 1px 2px rgba(0, 0, 0, .30);
    --sh-2: 0 1px 2px rgba(0, 0, 0, .30),
            0 6px 16px rgba(0, 0, 0, .28);
    --sh-pop: 0 2px 8px rgba(0, 0, 0, .40),
              0 16px 40px rgba(0, 0, 0, .45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #0f1615;
  --surface:       #17201f;
  --surface-sunk:  #131b1a;
  --surface-raise: #1c2625;

  --ink:           #e4ebe8;
  --ink-2:         #b3c1bd;
  --muted:         #94a49f;
  --faint:         #8a9a95;

  --line:          #26312f;
  --line-strong:   #35423f;

  --accent:        #4fb3a7;
  --accent-strong: #6cc9bd;
  --accent-soft:   #12302d;
  --accent-line:   #2f6b64;

  --warn:          #d9a94e;
  --warn-soft:     #2c2410;
  --danger:        #e08379;
  --danger-soft:   #2f1a17;
  --blue:          #7fb0dd;
  --blue-soft:     #16232f;
  --violet:        #a893d4;
  --violet-soft:   #221c30;

  --rail:          #131d1c;
  --rail-ink:      #e8f1ee;
  --rail-muted:    #9fb5b0;
  --rail-faint:    #7f9591;
  --rail-active:   #1f2e2c;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .30);
  --sh-2: 0 1px 2px rgba(0, 0, 0, .30),
          0 6px 16px rgba(0, 0, 0, .28);
  --sh-pop: 0 2px 8px rgba(0, 0, 0, .40),
            0 16px 40px rgba(0, 0, 0, .45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
    "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    system-ui, sans-serif;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: 0;
}

.intro-splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(22, 35, 37, 0.98), rgba(15, 55, 59, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 72px);
  color: #f6fffb;
}

.intro-splash.hidden {
  display: none;
}

.intro-splash.leaving {
  animation: introFadeOut 420ms ease forwards;
}

.intro-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  width: min(1080px, calc(100vw - 40px));
  min-height: min(650px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid rgba(211, 231, 226, 0.22);
  border-radius: var(--r-md);
  background: rgba(17, 30, 33, 0.78);
  box-shadow: var(--sh-pop);
}

.intro-topline {
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px;
}

.intro-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #f8fffc;
  font-weight: 700;
}

.intro-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, #1aa89a, #2f5f98);
}

.intro-brand-mark svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: #f8fffc;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.intro-skip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(232, 246, 242, 0.34);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fffc;
}

.intro-skip:hover {
  background: rgba(255, 255, 255, 0.16);
}

.intro-stage {
  position: relative;
  min-height: 430px;
}

.intro-scene {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
  gap: 36px;
  align-items: center;
  padding: 22px 58px 44px;
  opacity: 0;
  transform: translateY(16px);
  animation: introScene 2.1s ease both;
}

.scene-lab {
  animation-delay: 0s;
}

.scene-progress {
  animation-delay: 2.1s;
}

.scene-evidence {
  animation-delay: 4.2s;
}

.scene-ready {
  animation-delay: 6.3s;
}

.intro-copy {
  display: grid;
  gap: 12px;
  align-content: center;
}

.intro-copy span {
  color: #9ee2d9;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.intro-copy h2 {
  max-width: 520px;
  color: #ffffff;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.08;
}

.intro-copy p {
  max-width: 520px;
  color: #c5d9d5;
  font-size: 16px;
  line-height: 1.7;
}

.lab-board,
.evidence-panel {
  justify-self: stretch;
  display: grid;
  gap: 16px;
  min-height: 300px;
  border: 1px solid rgba(213, 235, 229, 0.22);
  border-radius: var(--r-md);
  background: rgba(249, 252, 250, 0.08);
  padding: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.board-row {
  height: 54px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, rgba(158, 226, 217, 0.32), rgba(47, 95, 152, 0.22));
  transform-origin: left;
  animation: introGrow 1.4s ease both;
}

.board-row.wide {
  width: 88%;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.board-grid span {
  min-height: 84px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.1);
}

.progress-lane {
  position: relative;
  display: grid;
  gap: 18px;
  padding-left: 34px;
}

.progress-lane::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 12px;
  width: 3px;
  border-radius: var(--r-pill);
  background: linear-gradient(#9ee2d9, #f4b860, #8fb5e4);
}

.progress-lane span {
  position: relative;
  display: block;
  min-height: 58px;
  border: 1px solid rgba(213, 235, 229, 0.22);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.09);
  padding: 18px 20px;
  color: #f8fffc;
  font-weight: 700;
}

.progress-lane span::before {
  content: "";
  position: absolute;
  top: 22px;
  left: -29px;
  width: 14px;
  height: 14px;
  border: 3px solid #142527;
  border-radius: 50%;
  background: #9ee2d9;
}

.chart-bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  align-items: end;
  gap: 18px;
  min-height: 190px;
}

.chart-bars i {
  display: block;
  border-radius: var(--r-sm) var(--r-sm) 2px 2px;
  background: linear-gradient(180deg, #f4b860, #1aa89a);
  animation: introBar 1.6s ease both;
}

.chart-bars i:nth-child(1) {
  height: 46%;
}

.chart-bars i:nth-child(2) {
  height: 72%;
  animation-delay: 120ms;
}

.chart-bars i:nth-child(3) {
  height: 58%;
  animation-delay: 220ms;
}

.chart-bars i:nth-child(4) {
  height: 88%;
  animation-delay: 320ms;
}

.evidence-lines {
  display: grid;
  gap: 10px;
}

.evidence-lines span {
  height: 12px;
  border-radius: var(--r-pill);
  background: rgba(232, 246, 242, 0.24);
}

.evidence-lines span:nth-child(1) {
  width: 92%;
}

.evidence-lines span:nth-child(2) {
  width: 72%;
}

.evidence-lines span:nth-child(3) {
  width: 82%;
}

.ready-mark {
  justify-self: center;
  display: grid;
  place-items: center;
  width: min(300px, 44vw);
  aspect-ratio: 1;
  border: 1px solid rgba(158, 226, 217, 0.35);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26, 168, 154, 0.22), rgba(47, 95, 152, 0.1) 62%, transparent 63%);
}

.ready-mark svg {
  width: 48%;
  fill: none;
  stroke: #9ee2d9;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: introCheck 1.2s ease both;
}

.intro-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
}

.intro-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #9ee2d9, #f4b860, #8fb5e4);
  transform-origin: left;
  animation: introProgress 8.4s linear both;
}

@keyframes introScene {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  12%,
  78% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-14px);
  }
}

@keyframes introProgress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes introGrow {
  from {
    transform: scaleX(0.2);
    opacity: 0.2;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes introBar {
  from {
    transform: scaleY(0.15);
    opacity: 0.2;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes introCheck {
  from {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
  }
  to {
    stroke-dasharray: 120;
    stroke-dashoffset: 0;
  }
}

@keyframes introFadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 22px 16px;
  background: var(--rail);
  color: var(--rail-ink);
}

/* 宽屏下侧栏自己占满一屏并固定，导航区内部滚动。
   导航有 16 项，内容高度 1592px，光靠 min-height:100vh 会把
   语言切换和主题按钮顶到折叠线以下，够到它们得滚整页。
   窄屏走 860 断点的横排方案，这里不参与。 */
@media (min-width: 861px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 0;
  }

  /* min-height:0 是必需的：flex 子项默认 min-height:auto，
     不解开的话 overflow 不会生效，nav 仍旧把侧栏撑高。 */
  .nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .sidebar-foot { flex: 0 0 auto; }

  /* 底部邻居（语言切换、开启提醒）都是通栏，主题按钮不跟就会
     是一个对不齐的小胶囊。只在宽屏通栏，窄屏走横排。 */
  .theme-toggle { width: 100%; }
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, #1aa89a, #2f5f98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 18px rgba(0, 0, 0, 0.18);
}

.cloud-icon {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: #f4fffb;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.16));
}

.cloud-icon path {
  fill: none;
  stroke: #f4fffb;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--rail-faint);
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--rail-muted);
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: var(--rail-active);
  color: var(--rail-ink);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 8px 4px;
  color: #a6bdb7;
  font-size: 13px;
  line-height: 1.5;
}

.lang-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 10px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.06);
}

.lang-switch button {
  min-height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: #a6bdb7;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-switch button:hover {
  color: #ffffff;
}

.lang-switch button.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.ghost-button {
  width: 100%;
  min-height: 38px;
  border: 1px solid #385052;
  border-radius: var(--r-sm);
  background: transparent;
  color: #f3faf8;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

.topbar p {
  margin-top: 7px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions button,
.primary-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: white;
  white-space: nowrap;
}

.top-actions button:hover,
.primary-button:hover {
  background: var(--accent-strong);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  align-items: start;
}

.three-col {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.card,
.panel,
.list-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.card {
  padding: 16px;
}

.panel {
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 18px;
}

.kpi strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.kpi span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar input,
.toolbar select,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
}

.toolbar input {
  max-width: 320px;
}

.list {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.row-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.row-head h3 {
  font-size: 16px;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-size: 12px;
}

.tag.ok {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tag.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.tag.violet {
  background: var(--violet-soft);
  color: var(--violet);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.small-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  color: var(--ink);
}

.paper-link {
  text-decoration: none;
}

.paper-summary {
  margin-top: 8px;
}

.paper-note {
  margin-top: 6px;
  color: var(--muted);
}

.icon-button {
  width: 32px;
  padding: 0;
}

.small-button:hover,
.icon-button:hover {
  background: #dde8e1;
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
}

.issue-list {
  display: grid;
  gap: 10px;
}

.today-list {
  display: grid;
  gap: 8px;
}

.today-item,
.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  padding: 10px;
}

.today-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.backup-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.backup-row {
  grid-template-columns: minmax(150px, 0.5fr) minmax(0, 1fr) auto;
  font-size: 13px;
}

.issue {
  border-left: 4px solid var(--warn);
  padding: 10px 12px;
  background: var(--warn-soft);
  border-radius: var(--r-sm);
}

.issue.high {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.issue strong {
  display: block;
  margin-bottom: 4px;
}

.issue p {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--ink-2);
  font-size: 13px;
}

.field.full {
  grid-column: 1 / -1;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 16, 18, 0.42);
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-panel {
  width: min(780px, 100%);
  max-height: min(820px, 92vh);
  overflow: auto;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  padding: 18px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cdd7cf;
  border-radius: var(--r-md);
  background: var(--surface-sunk);
}

.empty-state strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.table th,
.table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  vertical-align: top;
}

.table th {
  color: var(--ink-2);
  background: var(--surface-sunk);
  font-size: 13px;
}

.table tr:last-child td {
  border-bottom: 0;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.textarea-export {
  width: 100%;
  min-height: 220px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.discussion-band {
  overflow: hidden;
}

.mechanism-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

.mechanism-viewer {
  display: grid;
  grid-template-columns: minmax(190px, 0.3fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.mechanism-thumbs {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: min(720px, 68vh);
  overflow: auto;
  padding-right: 2px;
}

.mechanism-card,
.suggestion-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  padding: 12px;
}

.mechanism-card {
  width: 100%;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mechanism-card:hover,
.mechanism-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.mechanism-card.active-mechanism {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mechanism-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.mechanism-placeholder {
  display: grid;
  place-items: center;
  min-height: 130px;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.mechanism-placeholder span {
  font-size: 12px;
}

.mechanism-placeholder.large {
  min-height: 480px;
  padding: 24px;
}

.mechanism-preview {
  display: grid;
  grid-template-rows: auto minmax(480px, 1fr);
  gap: 12px;
  min-height: 560px;
}

.mechanism-preview-stage {
  display: grid;
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  overflow: hidden;
}

.mechanism-preview img {
  width: 100%;
  height: min(68vh, 720px);
  min-height: 480px;
  object-fit: contain;
  background: var(--surface);
}

.mechanism-card h3,
.suggestion-card h3 {
  font-size: 16px;
}

.mechanism-card p,
.suggestion-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.graph-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.active-tab {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.knowledge-graph {
  position: relative;
  height: 430px;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background:
    radial-gradient(circle at center, rgba(75, 128, 99, 0.1), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #f7faf7 100%);
  overflow: hidden;
}

.knowledge-graph svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.knowledge-graph line {
  stroke: rgba(79, 93, 98, 0.28);
  stroke-width: 0.28;
}

.graph-node {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 112px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(75, 128, 99, 0.34);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-2);
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
  cursor: default;
}

.graph-node.central {
  max-width: 130px;
  min-height: 44px;
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.mini-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 12px;
}

/* ── 成果展板 ── */

.achievement-board {
  overflow: hidden;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.achievement-card {
  display: grid;
  gap: 12px;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbf7 100%);
  padding: 14px;
}

.achievement-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.achievement-card h3 {
  font-size: 17px;
}

.achievement-card p,
.rank-row p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.achievement-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: var(--r-pill);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.achievement-badge.has-sci {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.achievement-badge.moving {
  background: var(--warn-soft);
  color: var(--warn);
}

.achievement-badge.empty {
  background: var(--danger-soft);
  color: var(--danger);
}

.achievement-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
}

.achievement-score strong {
  color: var(--accent-strong);
  font-size: 34px;
  line-height: 1;
}

.achievement-score span {
  color: var(--muted);
  font-size: 13px;
}

.rank-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  padding: 10px;
}

.rank-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

/* ── 经费投入与毕业学生 ── */

.finance-note {
  display: grid;
  gap: 6px;
  border-left: 4px solid var(--accent);
}

.finance-note p {
  color: var(--muted);
  line-height: 1.65;
}

.finance-bar {
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.alumni-note {
  display: grid;
  gap: 6px;
  border-left: 4px solid var(--blue);
}

.alumni-note p {
  color: var(--muted);
  line-height: 1.65;
}

/* ── 备份提醒 ── */

.backup-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
}

.backup-alert.ok {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.backup-alert.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.backup-alert.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.backup-alert strong {
  font-weight: 700;
}

/* ── 关联文件 ── */

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg);
  padding: 3px 10px;
  font-size: 12px;
  color: var(--muted);
}

.attachment-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
  color: var(--ink);
  font-weight: 600;
}

.attachment-chip button {
  border: 0;
  background: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
}

/* ── 科研自动化 ── */

.automation-intro {
  overflow-x: auto;
}

.automation-template,
.automation-steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  gap: 8px;
}

.template-step,
.automation-step {
  display: grid;
  gap: 7px;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  padding: 10px;
  text-align: left;
}

.template-step span,
.step-index,
.workflow-steps > div > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.automation-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  padding: 16px;
}

.automation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.automation-summary > div {
  border-left: 3px solid var(--blue);
  background: var(--bg);
  padding: 10px 12px;
}

.automation-summary p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.automation-step {
  cursor: pointer;
  color: var(--ink);
}

.automation-step em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.automation-step.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.automation-step.done {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.automation-step.rework {
  border-color: var(--warn);
  background: var(--warn-soft);
}

/* ── NATURE Skills ── */

.nature-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.7fr);
  gap: 16px;
  align-items: stretch;
}

.nature-hero h2 {
  margin: 12px 0 8px;
  font-size: 26px;
}

.nature-hero p,
.nature-card p,
.nature-workflow p {
  color: var(--muted);
  line-height: 1.65;
}

.nature-source,
.command-card,
.nature-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  padding: 14px;
}

.nature-source {
  align-content: center;
}

.nature-source a {
  color: var(--blue);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.nature-source span {
  color: var(--muted);
  font-size: 13px;
}

.command-card + .command-card {
  margin-top: 10px;
}

.command-card code {
  display: block;
  overflow-x: auto;
  border-radius: var(--r-sm);
  background: var(--bg);
  padding: 10px;
  color: var(--ink);
  line-height: 1.55;
}

.nature-card h3 {
  margin: 4px 0 0;
}

.nature-card strong {
  font-size: 13px;
  line-height: 1.55;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.workflow-steps > div {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
}

@media (max-width: 920px) {
  .intro-shell {
    width: min(100vw - 24px, 720px);
    min-height: min(760px, calc(100vh - 24px));
  }

  .intro-stage {
    min-height: 600px;
  }

  .intro-scene {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 22px;
    padding: 14px 28px 34px;
  }

  .intro-copy h2 {
    font-size: 34px;
  }

  .intro-copy p {
    font-size: 15px;
  }

  .lab-board,
  .evidence-panel {
    min-height: 230px;
  }

  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .toolbar {
    display: grid;
  }

  .kpi-grid,
  .two-col,
  .three-col,
  .mechanism-grid,
  .mechanism-viewer,
  .suggestion-grid,
  .achievement-grid,
  .automation-summary,
  .nature-hero,
  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .automation-template,
  .automation-steps {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .today-item,
  .backup-row,
  .rank-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .knowledge-graph {
    height: 380px;
  }

  .mechanism-thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
  }

  .mechanism-preview {
    min-height: 420px;
    grid-template-rows: auto minmax(360px, 1fr);
  }

  .mechanism-preview-stage,
  .mechanism-placeholder.large,
  .mechanism-preview img {
    min-height: 360px;
  }
}

@media (max-width: 620px) {
  .intro-shell {
    width: 100vw;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .intro-topline {
    padding: 16px;
  }

  .intro-stage {
    min-height: 620px;
  }

  .intro-scene {
    padding: 10px 18px 28px;
  }

  .intro-copy h2 {
    font-size: 29px;
  }

  .intro-copy p {
    font-size: 14px;
  }

  .lab-board,
  .evidence-panel {
    min-height: 210px;
    padding: 16px;
  }

  .progress-lane span {
    min-height: 52px;
    padding: 15px 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .row-head {
    display: grid;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .graph-node {
    max-width: 94px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .automation-template,
  .automation-steps {
    grid-template-columns: 1fr;
  }

  .mechanism-thumbs {
    grid-template-columns: 1fr;
  }

  .mechanism-preview {
    min-height: 340px;
    grid-template-rows: auto minmax(280px, 1fr);
  }

  .mechanism-preview-stage,
  .mechanism-placeholder.large,
  .mechanism-preview img {
    min-height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-scene,
  .intro-progress span,
  .board-row,
  .chart-bars i,
  .ready-mark svg,
  .intro-splash.leaving {
    animation-duration: 1ms;
    animation-iteration-count: 1;
  }

  .intro-scene {
    opacity: 0;
  }

  .scene-ready {
    opacity: 1;
    transform: none;
  }
}

/* ── 登录遮罩 ── */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg, #f4f6f5);
}

.auth-gate.hidden { display: none; }

.auth-card {
  width: min(380px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-2);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-size: 15px;
}

.auth-brand .brand-mark { width: 30px; height: 30px; }

.auth-form h2 { margin: 0 0 14px; font-size: 17px; }

.auth-form label {
  display: block;
  margin: 12px 0 5px;
  font-size: 13px;
  color: var(--muted);
}

.auth-form input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14px;
  background: var(--surface);
}

.auth-form input:focus {
  outline: 2px solid var(--accent, #2f6f4f);
  outline-offset: -1px;
}

.auth-form .primary-button {
  width: 100%;
  margin-top: 18px;
  justify-content: center;
}

.auth-form.hidden { display: none; }

.auth-error {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.auth-error.hidden { display: none; }

.auth-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ── 身份与同步状态 ── */

.whoami {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
}

.whoami.hidden { display: none; }
.whoami #whoamiName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sync-status {
  display: inline-block;
  margin-left: 12px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  vertical-align: middle;
}

.sync-status.hidden { display: none; }
.sync-status.pending { background: var(--surface-sunk); color: var(--muted); }
.sync-status.ok { background: var(--accent-soft); color: var(--accent-strong); }
.sync-status.error { background: var(--danger-soft); color: var(--danger); }

.nav-item.hidden { display: none; }

/* ── 文件上传控件 ── */

.upload-field {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  background: var(--panel, #fff);
}

.upload-preview {
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  overflow: hidden;
  margin-bottom: 10px;
}

.upload-preview img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

.upload-empty { color: var(--muted); font-size: 13px; }

.upload-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

#mechanismUploadHint { margin: 0; line-height: 1.6; }

.attachment-chip.stored a {
  color: var(--accent-strong, #0b5d56);
  text-decoration: none;
}
.attachment-chip.stored a:hover { text-decoration: underline; }
.attachment-chip.stored a:focus-visible {
  outline: 2px solid var(--accent, #0f766e);
  outline-offset: 1px;
  border-radius: var(--r-sm);
}

/* ── 周计划条目关联目标 ── */

.plan-items li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.plan-items li > label { flex: 1 1 auto; min-width: 180px; }

.plan-goal-select {
  flex: 0 0 auto;
  max-width: 220px;
  padding: 3px 7px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
}

.plan-goal-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.plan-goal-summary { margin: 8px 0 0; }

/* ══════════════════════════════════════════════════════════
   精修层
   把上面归一后的 token 落到具体组件上。这一层只调质感，
   不改结构和行为。
   ══════════════════════════════════════════════════════════ */

/* ── 排版基线 ──
   中文界面里的"高级感"主要靠这三件事：字重克制在 400/500/600，
   大字收紧字距、小字放开，行高按用途分档。 */

body {
  font-size: var(--t-base);
  line-height: 1.65;
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -.012em;   /* 大字负字距；中文不受影响，拉丁数字变紧致 */
  line-height: 1.28;
  text-wrap: balance;
}

/* 数字要对齐。KPI、金额、天数这些列在一起时不等宽会显得松垮。 */
.kpi strong, .rank-number, .metric-value, .table td,
.progress-track + *, .achievement-badge {
  font-variant-numeric: tabular-nums;
}

/* ── 侧边栏 ──
   原来 17 项撑得很满。收紧行高、降低非激活项的对比、
   给激活项一个明确但安静的标记。 */

.nav-item {
  border-radius: var(--r-sm);
  padding: 7px var(--s3);
  font-size: var(--t-base);
  font-weight: 500;
  letter-spacing: .002em;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease);
}

.nav-item:hover { background: rgba(255, 255, 255, .07); }

.nav-item.active {
  background: rgba(255, 255, 255, .11);
  font-weight: 600;
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}

/* ── 顶栏 ──
   标题与副标题原来贴得太近，层级靠字号硬撑。
   拉开距离、副标题降饱和，层级自然读出来。 */

.topbar h1 {
  font-size: var(--t-2xl);
  letter-spacing: -.02em;
  margin-bottom: 2px;
}

.topbar p {
  font-size: var(--t-base);
  color: var(--muted);
  line-height: 1.55;
}

/* ── 面板 ──
   统一内边距与圆角；边框比阴影更重要——
   1px 的准确边框比一坨阴影更显精致。 */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--sh-1);
  transition: box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}

.panel-head {
  margin-bottom: var(--s4);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: var(--t-lg);
  letter-spacing: -.01em;
}

/* ── KPI 卡 ──
   原来 34px 数字配 12px 说明，对比过强反而廉价。
   把数字压到 28px、加负字距，说明升到 12.5px 并分两行，
   数字与文字的关系才成立。 */

.kpi {
  padding: var(--s4) var(--s5);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  transition: box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}

.kpi:hover {
  box-shadow: var(--sh-2);
  transform: translateY(-1px);
}

.kpi strong {
  font-size: var(--t-2xl);
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--ink);
}

.kpi span {
  font-size: var(--t-sm);
  color: var(--muted);
  line-height: 1.5;
}

/* ── 按钮 ──
   主按钮去掉厚重感：不用渐变、不用大阴影，靠色彩和一点点位移。 */

.primary-button,
.small-button,
.ghost-button {
  border-radius: var(--r-sm);
  font-weight: 500;
  letter-spacing: .006em;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}

.primary-button {
  padding: 8px var(--s4);
  font-size: var(--t-base);
  box-shadow: var(--sh-1);
}

.primary-button:hover { background: var(--accent-strong); }
.primary-button:active { transform: translateY(1px); }

.small-button {
  padding: 5px 11px;
  font-size: var(--t-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
}

.small-button:hover {
  border-color: var(--accent-line);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.small-button:active { transform: translateY(1px); }

.danger-button:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

:is(.primary-button, .small-button, .ghost-button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 标签 ──
   药丸形、无边框、低饱和底色。原来的标签边框和文字抢注意力。 */

.tag {
  border-radius: var(--r-pill);
  padding: 3px 9px;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: .012em;
  border: none;
  line-height: 1.5;
}

/* ── 列表行 ──
   行与行之间用发丝线而不是间隙；hover 给一点点底色，
   让"这一行是可操作的"变得明确。 */

.list-row {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s4);
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}

.list-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-1);
}

.row-head { gap: var(--s3); }

.list-row h3 {
  font-size: var(--t-md);
  letter-spacing: -.008em;
}

.meta {
  font-size: var(--t-sm);
  color: var(--muted);
  line-height: 1.6;
}

/* ── 表格 ──
   表头小写字距放开，正文行高收紧；斑马纹不要，靠发丝线分隔。 */

.table thead th {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line-strong);
}

.table td {
  padding: var(--s3) var(--s4);
  font-size: var(--t-base);
  border-bottom: 1px solid var(--line);
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--surface-sunk); }

/* ── 表单 ──
   输入框的焦点态用主色描边而不是浏览器默认的蓝框。 */

.field input,
.field select,
.field textarea {
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  padding: 8px 11px;
  font-size: var(--t-base);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field label {
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: .004em;
}

/* ── 进度条 ──
   压薄、加圆角、给填充一点点渐变让它有体积。 */

.progress-track {
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 400ms var(--ease);
}

/* ── 空状态 ──
   原来占的视觉重量太大。缩小、降饱和，让它退到背景里。 */

.empty-state {
  padding: var(--s6) var(--s5);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  border: 1px dashed var(--line-strong);
  text-align: center;
}

.empty-state strong {
  font-size: var(--t-base);
  font-weight: 600;
  color: var(--ink-2);
}

.empty-state p {
  font-size: var(--t-sm);
  color: var(--faint);
  margin: var(--s1) 0 0;
}

/* ── 备份告警 ──
   原来整条红底太抢眼，压过了它旁边真正重要的数据。
   改成左侧色条 + 极淡底色。 */

.backup-alert {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  background: var(--surface-sunk);
  padding: var(--s3) var(--s4);
  font-size: var(--t-base);
  box-shadow: none;
}

.backup-alert.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.backup-alert.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.backup-alert.ok { border-left-color: var(--accent); background: var(--accent-soft); }

/* ── 弹窗 ──
   更强的阴影 + 背景模糊，让它真的"浮"起来。 */

#modal > .modal-card,
.modal-card {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  border: 1px solid var(--line);
}

/* ── 登录页 ──
   这是别人见到软件的第一屏，值得单独收拾。 */

.auth-card {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: var(--s6);
}

.auth-form h2 {
  font-size: var(--t-xl);
  letter-spacing: -.015em;
}

.auth-form input {
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  padding: 9px 12px;
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-hint { font-size: var(--t-sm); line-height: 1.7; }

/* ══════════════════════════════════════════════════════════
   精修层 · 二轮：节奏与层次
   第一轮统一了 token，但列表行内部四层间距几乎相同——
   没有东西在领读。这一轮解决"看哪里"的问题。
   ══════════════════════════════════════════════════════════ */

/* ── 工具栏 ──
   搜索框和主按钮原来只是并排，没有对齐关系。
   让搜索框吃掉剩余宽度，按钮贴右，高度对齐。 */

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}

.toolbar input[type="search"],
.toolbar select {
  flex: 1 1 220px;
  min-width: 0;
  height: 36px;
  padding: 0 var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: var(--t-base);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}

.toolbar input[type="search"]:focus,
.toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.toolbar .primary-button,
.toolbar .small-button {
  height: 36px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: 0 0 auto;
}

/* ── 列表行的内部节奏 ──
   姓名领读、meta 退后、正文独立成段。
   靠的是间距的疏密对比，不是字号堆叠。 */

.list-row {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
}

.list-row .row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
}

.list-row h3 {
  margin: 0 0 5px;
  font-size: var(--t-md);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}

/* meta 行：分隔点代替换行，一行说完 */
.list-row .meta {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin: 0;
  font-size: var(--t-sm);
  color: var(--muted);
}

.list-row .meta > span:not(.tag) + span:not(.tag)::before {
  content: "·";
  margin-right: var(--s2);
  color: var(--line-strong);
}

.list-row p {
  margin: 0;
  font-size: var(--t-base);
  line-height: 1.7;
  color: var(--ink-2);
}

.list-row p strong { color: var(--ink); font-weight: 600; }

/* ── 行内操作：渐进披露 ──
   默认降到 55% 不透明度，指针进入该行才完全显现。
   按钮一直在原位、可点、可聚焦——只是安静下来，
   让内容而不是操作占据注意力。
   触屏没有 hover，所以那边保持全显。 */

.row-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (hover: hover) and (pointer: fine) {
  .list-row .row-actions,
  .table tbody tr .small-button {
    opacity: .55;
    transition: opacity var(--dur) var(--ease);
  }

  .list-row:hover .row-actions,
  .list-row:focus-within .row-actions,
  .table tbody tr:hover .small-button,
  .table tbody tr:focus-within .small-button {
    opacity: 1;
  }
}

/* ── 标签 ──
   原来太淡，在白底上几乎读不出来。加深文字、给底色一点存在感。 */

.tag {
  background: var(--surface-sunk);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.tag.ok      { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.tag.blue    { background: var(--blue-soft);   color: var(--blue);          border-color: transparent; }
.tag.violet  { background: var(--violet-soft); color: var(--violet);        border-color: transparent; }
.tag.warn    { background: var(--warn-soft);   color: var(--warn);          border-color: transparent; }
.tag.danger  { background: var(--danger-soft); color: var(--danger);        border-color: transparent; }

/* ── 面板的重量分级 ──
   原来每块面板视觉重量完全相同，整页读起来像一张网格。
   主内容区保持实体感，侧栏面板退半档。 */

.grid.two-col > .panel:last-child,
.grid.three-col > .panel:last-child {
  background: var(--surface-sunk);
  box-shadow: none;
}

/* ── 空状态再降一档 ──
   它是"这里暂时没东西"，不该和真实内容抢重量。 */

.empty-state {
  padding: var(--s5) var(--s4);
  border-style: dashed;
  border-color: var(--line);
  background: transparent;
}

.empty-state strong { font-weight: 500; color: var(--muted); }
.empty-state p { color: var(--faint); font-size: var(--t-sm); }

/* ── 侧边栏收尾 ──
   品牌区与导航之间加一条发丝线；底部区域压暗，
   让 17 个导航项不再是一列等重的文字。 */

.brand {
  padding-bottom: var(--s4);
  margin-bottom: var(--s3);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand strong {
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: -.01em;
}

.brand small {
  font-size: var(--t-xs);
  opacity: .62;
  letter-spacing: .02em;
}

.nav { display: flex; flex-direction: column; gap: 1px; }

.sidebar-foot {
  padding-top: var(--s4);
  margin-top: var(--s4);
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-foot p {
  font-size: var(--t-xs);
  opacity: .5;
  line-height: 1.6;
}

/* ── KPI 内部节奏 ──
   数字和说明之间的距离，比卡片内边距更能决定它是否"讲清楚了"。 */

.kpi { gap: 2px; padding: var(--s4) var(--s5) var(--s5); }
.kpi strong { line-height: 1.05; }
.kpi span { letter-spacing: .008em; }

/* ── 今日待办与风险条目 ──
   这两块是首页真正要看的东西，给它们比其他面板更实的存在感。 */

.issue {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease);
}

.issue:hover { border-color: var(--line-strong); }

.issue.high {
  border-left: 3px solid var(--danger);
  background: var(--surface);
}

.issue strong { font-size: var(--t-base); font-weight: 600; }
.issue p { margin: 3px 0 0; font-size: var(--t-sm); color: var(--muted); }

.issue-list { display: flex; flex-direction: column; gap: var(--s2); }
.today-list { display: flex; flex-direction: column; gap: var(--s2); }

/* ══════════════════════════════════════════════════════════
   精修层 · 三轮：修实际用起来才发现的问题
   ══════════════════════════════════════════════════════════ */

/* ── 工具栏：只有直接子元素参与伸缩 ──
   上一轮写成 .toolbar select 会连 .toolbar-actions 里嵌套的下拉
   一起撑开，导致整行折成两行、对齐全乱。 */

.toolbar > input[type="search"] { flex: 1 1 240px; }

.toolbar > select,
.toolbar-actions select,
.toolbar-actions input {
  flex: 0 0 auto;
  width: auto;
  min-width: 130px;
  height: 36px;
  padding: 0 var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: var(--t-base);
  color: var(--ink);
}

.toolbar-actions { margin-left: auto; }

/* ── 表格放进卡片 ──
   原来表格直接浮在页面背景上，没有容器，边界靠猜。 */

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-1);
}

.table thead th { background: var(--surface-sunk); }

/* 数字列右对齐并等宽。左对齐的数字列在视觉上是散的。 */
.table td:nth-child(n+5):nth-child(-n+6),
.table th:nth-child(n+5):nth-child(-n+6) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 操作列贴右，不参与文字对齐 */
.table td:last-child,
.table th:last-child { text-align: right; white-space: nowrap; }

/* ── 科研自动化 ──
   七个节点的编号是真实顺序，保留编号是对的；
   但圆圈原来太大太亮，抢过了节点名称本身。 */

.automation-template > div > span,
.workflow-steps > div > span {
  width: 20px;
  height: 20px;
  font-size: var(--t-xs);
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  flex: 0 0 auto;
}

.automation-template > div,
.workflow-steps > div {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s3);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.automation-template > div strong,
.workflow-steps > div strong {
  font-size: var(--t-base);
  font-weight: 600;
}

.automation-template > div p,
.workflow-steps > div p {
  margin: 0;
  font-size: var(--t-sm);
  color: var(--muted);
  line-height: 1.6;
}

/* 流程卡里的三栏原来各带一条不同颜色的左边框，颜色不统一。
   统一成同一条发丝线，用标题字重区分而不是颜色。 */
.automation-facts > div,
.automation-meta > div {
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent-line);
  border-radius: var(--r-sm);
  padding: var(--s3);
  background: var(--surface-sunk);
}

/* ── 弹窗 ──
   遮罩加一点模糊，卡片给足内边距。这是用得最频繁的界面之一。 */

#modal {
  background: rgba(19, 28, 27, .32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

#modal > div {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  padding: var(--s6);
}

#modalTitle {
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -.015em;
  margin-bottom: var(--s5);
}

.form-grid { gap: var(--s4); }
.form-actions { margin-top: var(--s3); gap: var(--s2); }

/* ── 同步状态 ──
   它出现在标题旁边，不该抢标题的注意力。 */

.sync-status {
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: .01em;
  border-radius: var(--r-pill);
  padding: 3px 10px;
}

/* ── 滚动条 ──
   默认滚动条在浅色界面里很突兀。收细、降对比。 */

@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: var(--r-pill);
    border: 3px solid var(--bg);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--faint); }
}

/* ── 选中态 ──
   默认的蓝色选中在青绿界面里是外来色。 */

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

/* ══════════════════════════════════════════════════════════
   精修层 · 四轮：垂直密度
   前三轮解决了"好不好看"，这轮解决"一屏能看到多少"。
   课题组的人一天要开好几次，滚动成本是真实成本。
   ══════════════════════════════════════════════════════════ */

/* 空态收到最小可用尺寸。它传达的信息只有一句"这里还没有东西"，
   不该占掉半屏。 */
.empty-state {
  padding: var(--s4) var(--s4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.empty-state strong { font-size: var(--t-base); }
.empty-state p { margin: 0; }

/* 面板内容之间的间隙统一，不再依赖模板里写死的 margin。 */
.panel > * + * { margin-top: 0; }
.panel .list,
.panel .issue-list,
.panel .today-list { display: flex; flex-direction: column; gap: var(--s2); }

/* 列表行之间靠间隙区分即可，不需要每行都投影。 */
.list { display: flex; flex-direction: column; gap: var(--s3); }

/* KPI 一行四个时压低高度——它是概览，不是主角。 */
.kpi-grid { gap: var(--s3); }
.kpi { padding: var(--s4) var(--s4) var(--s4) var(--s5); }
.kpi strong { font-size: var(--t-xl); }

/* 顶栏压缩一档，把垂直空间还给内容。 */
.topbar { padding-bottom: var(--s4); margin-bottom: var(--s4); }
.topbar h1 { font-size: 26px; }

/* 表格行高收紧，一屏多看两三行。 */
.table td { padding: 10px var(--s4); }
.table thead th { padding: 9px var(--s4); }

/* ══════════════════════════════════════════════════════════
   精修层 · 五轮：手机端导航
   之前侧边栏在窄屏下不折叠，17 个导航项占满整屏，
   内容被推到第二屏——学生用手机打开等于什么都看不到。
   改成顶部横向滚动条：所有入口仍然可达，但只占一行。
   ══════════════════════════════════════════════════════════ */

@media (max-width: 860px) {
  #app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    min-height: 0;
    padding: var(--s3) var(--s4) 0;
    position: sticky;
    top: 0;
    z-index: 20;
    gap: var(--s3);
  }

  /* 品牌区收成一行，不再占用竖向空间 */
  .brand {
    padding-bottom: var(--s3);
    margin-bottom: 0;
    gap: var(--s3);
  }

  .brand small { display: none; }

  /* 导航横向滚动。所有 17 项仍在，只是改为左右滑动。 */
  .nav {
    flex-direction: row;
    gap: var(--s1);
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: var(--s3);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .nav::-webkit-scrollbar { display: none; }

  .nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 7px var(--s3);
    scroll-snap-align: start;
  }

  /* 底部的语言切换和退出移到导航同层，不再单独占一段 */
  .sidebar-foot {
    display: flex;          /* 基础样式是 block，只设 flex-direction 不生效 */
    flex-direction: row;
    align-items: center;
    gap: var(--s2);
    padding: 0 0 var(--s3);
    margin-top: 0;
    border-top: none;
    flex-wrap: wrap;
  }

  .sidebar-foot p { display: none; }

  /* 底部这几件在窄屏里必须全部压进一行：
     语言切换、提醒按钮、身份与退出。竖排的话光这一段就吃掉 134px。 */
  /* 基础样式给这些元素设了 width:100%，flex-basis:auto 会取到它，
     于是三个元素各占一行。必须显式改回 auto。 */
  .sidebar-foot > * { flex: 0 0 auto; margin: 0; width: auto; }

  .sidebar-foot .lang-switch { order: 1; }
  .sidebar-foot .theme-toggle { order: 1; }
  .sidebar-foot #notifyBtn { order: 2; padding: 5px 10px; font-size: var(--t-xs); }

  .whoami {
    order: 3;
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    font-size: var(--t-xs);
  }

  .whoami #whoamiName { max-width: 9em; }

  /* .sidebar-foot > * 只作用于直接子元素，够不到 .whoami 里面的
     退出按钮，它仍带着基础样式的 width:100%，会把整行吃掉。 */
  .whoami .ghost-button { width: auto; flex: 0 0 auto; }
  .lang-switch button { padding: 4px 9px; font-size: var(--t-xs); }

  .main { padding: var(--s4); }

  /* 顶栏的操作按钮在窄屏容易挤，允许换行并靠左 */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s3);
  }

  .topbar-actions { width: 100%; flex-wrap: wrap; }

  /* 多列网格一律单列 */
  .grid.two-col,
  .grid.three-col { grid-template-columns: minmax(0, 1fr); }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* 表格在窄屏里横向滚动，不撑破页面 */
  .table { display: block; overflow-x: auto; white-space: nowrap; }

  /* 行内操作换行到下方，不和标题挤 */
  .list-row .row-head { flex-direction: column; align-items: flex-start; }
  .row-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .main { padding: var(--s3); }
  .panel { padding: var(--s4); }
  .topbar h1 { font-size: 22px; }
}

/* ══════════════════════════════════════════════════════════
   精修层 · 六轮：体检查出来的问题
   ══════════════════════════════════════════════════════════ */

/* ── 长串文本兜底 ──
   DOI、URL、Windows 文件路径这类没有断点的长串会顶破容器。
   中文和普通英文不受影响（break-word 只在真的放不下时才断）。 */

.list-row p,
.meta,
.issue p,
.empty-state p,
.gain p,
.table td,
.attachment-chip,
.annotation p {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* 明确要保留完整、可复制的地方不断行——路径断了就没法复制粘贴。 */
code, .command-card code, .mono { overflow-wrap: normal; word-break: normal; }
.table-scroll, .command-card { overflow-x: auto; }

/* ── 首次使用 ──
   全新部署时四个 0 加一条警告，是很差的第一印象。
   给空的 KPI 一个更安静的样子，让引导性的文案成为焦点。 */

.kpi:has(strong:not(:empty)) { transition: box-shadow var(--dur) var(--ease); }

/* ── 焦点在容器内时抬升整块 ──
   键盘操作的人需要知道"我现在在哪一块"。 */

.panel:focus-within { border-color: var(--accent-line); }

/* ── 表格内的标签垂直居中 ──
   状态列里的标签原来贴着上边，和同行文字不齐。 */

.table td .tag { vertical-align: middle; }

/* ── 禁用态 ──
   之前没有定义过。提交中的按钮必须看起来不可点，
   否则用户会连点导致重复提交。 */

button:disabled,
button[disabled] {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── 打印 ──
   导师会打印成果清单和经费明细拿去报账。
   默认打印会把深色侧边栏整片印出来，非常费墨。 */

@media print {
  .sidebar,
  .topbar-actions,
  .toolbar,
  .row-actions,
  .backup-alert,
  #modal { display: none !important; }

  #app { grid-template-columns: 1fr; }
  .main { padding: 0; }

  body { background: var(--surface); font-size: 11pt; }

  .panel,
  .list-row,
  .table {
    box-shadow: none;
    border: 1px solid #bbb;
    break-inside: avoid;
  }

  .view:not(.active-view) { display: none; }
  a[href^="/api/"]::after { content: ""; }   /* 内部链接不打印 URL */
}

/* ══════════════════════════════════════════════════════════
   深色模式的组件修正
   变量换完不等于就对了——有几处颜色关系在深底上会反过来。
   ══════════════════════════════════════════════════════════ */

/* 主按钮：浅色模式是深青底配白字（5.47）；深色模式如果照搬亮青底配白字
   只有 2.52，严重不达标。深色下改成亮青底配近黑字（7.28）。 */
:root[data-theme="dark"] .primary-button,
:root[data-theme="dark"] .toolbar .primary-button,
:root[data-theme="dark"] .top-actions button,
:root[data-theme="dark"] .graph-node.central {
  background: var(--accent);
  color: #0f1615;
  border-color: transparent;
}

:root[data-theme="dark"] .primary-button:hover,
:root[data-theme="dark"] .top-actions button:hover {
  background: var(--accent-strong);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .primary-button,
  :root:not([data-theme="light"]) .toolbar .primary-button,
  :root:not([data-theme="light"]) .top-actions button,
  :root:not([data-theme="light"]) .graph-node.central {
    background: var(--accent);
    color: #0f1615;
    border-color: transparent;
  }

  :root:not([data-theme="light"]) .primary-button:hover,
  :root:not([data-theme="light"]) .top-actions button:hover {
    background: var(--accent-strong);
  }
}

/* 输入框在深底上必须有明确边界，否则和卡片糊成一片 */
:root[data-theme="dark"] :is(.field input, .field select, .field textarea,
  .toolbar input, .toolbar select, .auth-form input, .textarea-export),
:root[data-theme="dark"] .toolbar-actions :is(select, input) {
  background: var(--surface-sunk);
  border-color: var(--line-strong);
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.field input, .field select, .field textarea,
    .toolbar input, .toolbar select, .auth-form input, .textarea-export),
  :root:not([data-theme="light"]) .toolbar-actions :is(select, input) {
    background: var(--surface-sunk);
    border-color: var(--line-strong);
    color: var(--ink);
  }
}

/* 悬停底色：浅色模式用变淡，深色模式必须用变亮，方向是反的 */
:root[data-theme="dark"] .table tbody tr:hover { background: var(--surface-raise); }
:root[data-theme="dark"] .nav-item:hover { background: rgba(255, 255, 255, .05); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .table tbody tr:hover { background: var(--surface-raise); }
  :root:not([data-theme="light"]) .nav-item:hover { background: rgba(255, 255, 255, .05); }
}

/* 弹窗遮罩在深色下要更黑，否则和卡片分不开 */
:root[data-theme="dark"] #modal { background: rgba(0, 0, 0, .62); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #modal { background: rgba(0, 0, 0, .62); }
}

/* 空态的虚线在深底上几乎看不见 */
:root[data-theme="dark"] .empty-state { border-color: var(--line-strong); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .empty-state { border-color: var(--line-strong); }
}

/* ── 主题切换按钮 ── */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .14);
  background: transparent;
  color: var(--rail-muted);
  font-size: var(--t-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, .07);
  color: var(--rail-ink);
  border-color: rgba(255, 255, 255, .24);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 图标按当前主题切换：跟随系统时显示当前实际生效的那个 */
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.theme-toggle .theme-label { white-space: nowrap; }
