/* ============================================================================
   IURTC 筹备工作台 —— 设计令牌 / 外壳 / 通用组件
   视觉沿用原工作台：浅暖底 + 深墨字 + 墨绿主色
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #fafaf9;
  --surface: #fff;
  --surface-2: #f4f4f2;
  --surface-3: #eceae6;
  --line: #e5e5e1;
  --line-soft: #efefec;
  --ink: #15171c;
  --ink-2: #3f4450;
  --muted: #7a7e88;
  --faint: #a3a6ae;
  --accent: #0d7a5f;
  --accent-dark: #0b6650;
  --accent-soft: rgba(13, 122, 95, 0.08);
  --accent-line: rgba(13, 122, 95, 0.22);
  --st-done: #0d7a5f;
  --st-doing: #b45309;
  --st-todo: #7a7e88;
  --st-block: #b03232;
  --danger: #b03232;
  --danger-soft: rgba(176, 50, 50, 0.08);
  --warn-soft: #fdf4e8;
  --warn-line: #e6c99f;
  --info: #2563eb;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 24px 60px -20px rgba(15, 20, 30, 0.28);
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Source Han Sans SC', 'Noto Sans CJK SC', sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --topbar-h: 58px;

  /* 主题切换过渡时长（js/theme.js 读同一个变量决定过渡窗口何时结束） */
  --theme-trans: 380ms;

  /* ---------------------------------------------------------------- 派生色
     凡是「深色模式下必须跟着换」的硬编码色，都抽成这里的令牌。
     纪律：CSS 里不再出现字面色值（文档预览的白纸除外）。 */
  --topbar-bg: rgba(250, 250, 249, 0.94);
  --ink-invert: #15171c;          /* 反色底（跳链、P0 徽标） */
  --on-invert: #fff;              /* 反色底上的文字 */
  --on-accent: #fff;              /* 墨绿/青底上的文字 */
  --on-danger: #fff;              /* 危险色底上的文字 */
  --on-doing: #fff;               /* 进行中橙底上的文字 */
  --toast-bg: #15171c;
  --toast-fg: #fff;
  --toast-key-bg: #1f2937;
  --overlay-bg: rgba(18, 22, 28, 0.34);
  --hover-tint: rgba(0, 0, 0, 0.012);
  --danger-line: rgba(176, 50, 50, 0.3);
  --danger-line-soft: rgba(176, 50, 50, 0.25);
  --danger-line-2: rgba(176, 50, 50, 0.22);
  --doing-soft: rgba(180, 83, 9, 0.08);
  --info-soft: rgba(37, 99, 235, 0.08);
  --plum: #7d4a63;
  --plum-soft: rgba(125, 74, 99, 0.08);
  --faint-line: rgba(163, 166, 174, 0.6);
  --surface-fade: rgba(244, 244, 242, 0.55);
  --accent-wash: rgba(13, 122, 95, 0.03);
  --accent-glow: rgba(13, 122, 95, 0.09);
}

/* ---------------------------------------------------------------------------
   深色模式
   触发方式二选一：
     · 显式：<html data-theme="dark">
     · 跟随系统：JS 读取 prefers-color-scheme 后写成同一个属性（index.html 头部有
       免闪烁的内联脚本，首帧即定色）
   --------------------------------------------------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14171c;
  --surface: #1c2027;
  --surface-2: #242931;
  --surface-3: #2d333c;
  --line: #333a45;
  --line-soft: #282d36;
  --ink: #e8eaef;
  --ink-2: #c0c6d1;
  --muted: #8d94a2;
  --faint: #6b7382;
  --accent: #2fbd97;
  --accent-dark: #26a687;
  --accent-soft: rgba(47, 189, 151, 0.14);
  --accent-line: rgba(47, 189, 151, 0.38);
  --st-done: #2fbd97;
  --st-doing: #e0913a;
  --st-todo: #8d94a2;
  --st-block: #e2686a;
  --danger: #e2686a;
  --danger-soft: rgba(226, 104, 106, 0.14);
  --warn-soft: #2a2318;
  --warn-line: #6a5228;
  --info: #6aa3ff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.72);

  --topbar-bg: rgba(20, 23, 28, 0.92);
  --ink-invert: #e8eaef;
  --on-invert: #14171c;
  --on-accent: #071a15;
  --on-danger: #2a1010;
  --on-doing: #2a1a08;
  --toast-bg: #2a3038;
  --toast-fg: #eef0f4;
  --toast-key-bg: #1e232a;
  --overlay-bg: rgba(5, 7, 11, 0.62);
  --hover-tint: rgba(255, 255, 255, 0.05);
  --danger-line: rgba(226, 104, 106, 0.45);
  --danger-line-soft: rgba(226, 104, 106, 0.34);
  --danger-line-2: rgba(226, 104, 106, 0.3);
  --doing-soft: rgba(224, 145, 58, 0.16);
  --info-soft: rgba(106, 163, 255, 0.16);
  --plum: #d79ab6;
  --plum-soft: rgba(215, 154, 182, 0.14);
  --faint-line: rgba(141, 148, 162, 0.5);
  --surface-fade: rgba(36, 41, 49, 0.6);
  --accent-wash: rgba(47, 189, 151, 0.05);
  --accent-glow: rgba(47, 189, 151, 0.12);
}

/* ---------------------------------------------------------------------------
   主题切换过渡
   js/theme.js 在换色之前给 <html> 挂上 .theme-anim，窗口结束后再摘掉：
   于是只有「切换主题」这一小段时间里颜色属性会插值，
   页面自身的 hover / 进度条动画不受影响，首帧加载也不会闪一下。
   图标（.ico-sun / .ico-moon）有自己的旋转淡入淡出，这里排除掉。
   --------------------------------------------------------------------------- */
html.theme-anim *:not(.ico-sun):not(.ico-moon),
html.theme-anim *:not(.ico-sun):not(.ico-moon)::before,
html.theme-anim *:not(.ico-sun):not(.ico-moon)::after {
  transition-property: background-color, background-image, border-color, color, fill, stroke, box-shadow, outline-color, text-decoration-color, caret-color, accent-color;
  transition-duration: var(--theme-trans);
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-delay: 0s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
::selection { background: var(--accent-soft); }

/* 原生控件跟随主题（占位符、下拉选项、滚动条、日期选择器） */
::placeholder { color: var(--faint); opacity: 1; }
select option { background: var(--surface); color: var(--ink); }
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { color-scheme: inherit; }
* { scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- 主题切换按钮 */
/* 日/月两枚图标叠在同一位置，用透明度 + 旋转切换，切换时有连贯的过场 */
.theme-btn { position: relative; }
.theme-btn .ico-sun, .theme-btn .ico-moon,
.auth-theme .ico-sun, .auth-theme .ico-moon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  opacity: 1;
  pointer-events: none;
  transition: opacity var(--theme-trans) ease, transform var(--theme-trans) cubic-bezier(0.34, 1.2, 0.64, 1);
}
.theme-btn .ico-sun, .theme-btn .ico-moon { width: 18px; height: 18px; }
.auth-theme .ico-sun, .auth-theme .ico-moon { width: 16px; height: 16px; }

/* 未选中的那枚：淡出并转出去 */
.theme-btn .ico-moon, .auth-theme .ico-moon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-70deg) scale(0.35);
}
:root[data-theme="dark"] .theme-btn .ico-sun,
:root[data-theme="dark"] .auth-theme .ico-sun {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(70deg) scale(0.35);
}
:root[data-theme="dark"] .theme-btn .ico-moon,
:root[data-theme="dark"] .auth-theme .ico-moon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

/* 登录页（无顶栏）用的浮动主题按钮 */
.auth-theme {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: 0.15s;
}
.auth-theme:hover { background: var(--surface-2); color: var(--ink); }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 999;
  background: var(--ink-invert); color: var(--on-invert); padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { left: 12px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.view-root { min-height: calc(100vh - var(--topbar-h)); outline: none; }

/* ------------------------------------------------------------------ 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 14px; height: var(--topbar-h); }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; white-space: nowrap; flex: none; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.brand-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 6px 11px; border-radius: 9px; font-size: 13.5px; font-weight: 500;
  color: var(--muted); white-space: nowrap; transition: 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.topbar-tools { display: flex; align-items: center; gap: 8px; flex: none; }

.search-box { position: relative; display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 0 9px; height: 34px; color: var(--muted); transition: 0.15s; }
.search-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { border: 0; outline: none; background: transparent; width: 168px; font-size: 13px; color: var(--ink); }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
.search-pop {
  position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-height: 380px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 80;
}
.search-pop .sp-group { font-size: 11px; color: var(--faint); padding: 6px 10px 4px; letter-spacing: 0.04em; }
.search-pop .sp-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.search-pop .sp-item:hover, .search-pop .sp-item.on { background: var(--surface-2); }
.search-pop .sp-item .sp-code { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 5px; padding: 1px 6px; flex: none; }
.search-pop .sp-item .sp-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-pop .sp-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

.icon-btn { position: relative; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); transition: 0.15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: var(--on-danger); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }

.user-menu { position: relative; }
.user-chip { display: flex; align-items: center; gap: 7px; padding: 3px 7px 3px 3px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); transition: 0.15s; }
.user-chip:hover { background: var(--surface-2); }
.user-chip .user-name { font-size: 12.5px; font-weight: 600; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; z-index: 80; }
.menu-item { display: block; width: 100%; text-align: left; padding: 8px 11px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.menu-item:hover { background: var(--surface-2); color: var(--ink); }
.menu-item.danger { color: var(--danger); }

/* ------------------------------------------------------------------ 通用 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 500; padding: 7px 13px; border-radius: 9px; transition: 0.16s; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); background: var(--surface-2); color: var(--ink); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.pri:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--on-accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn.lg { padding: 10px 20px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px; }
.card-b.tight { padding: 0; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.k { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.chip.w { background: var(--warn-soft); border-color: var(--warn-line); color: var(--st-doing); }
.chip.d { background: var(--danger-soft); border-color: var(--danger-line-soft); color: var(--danger); }
.chip.mono { font-family: var(--mono); font-size: 11px; }
.chip.plain { background: transparent; border-color: transparent; color: var(--muted); padding: 0; }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status[data-status="未开始"] { color: var(--st-todo); background: var(--surface-2); }
.status[data-status="进行中"] { color: var(--st-doing); background: var(--doing-soft); }
.status[data-status="已完成"] { color: var(--st-done); background: var(--accent-soft); }
.status[data-status="阻塞"] { color: var(--st-block); background: var(--danger-soft); }

.prio { font-family: var(--mono); font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; letter-spacing: 0.02em; }
.prio[data-prio="P0"] { color: var(--on-invert); background: var(--ink-invert); }
.prio[data-prio="P1"] { color: var(--ink-2); background: var(--surface-3); }

.avatar { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 700; flex: none; letter-spacing: 0; }
.avatar.lg { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.avatar.sm { width: 21px; height: 21px; border-radius: 6px; font-size: 10px; }

.field { display: flex; flex-direction: column; gap: 5px; }
/* .field 自身的 display:flex 会盖掉 UA 的 [hidden]{display:none}，必须显式补一条 */
.field[hidden] { display: none; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, .input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 9px;
  padding: 8px 11px; font-size: 13.5px; outline: none; transition: 0.15s;
}
.field textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { font-size: 11.5px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span2 { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- 多选控件（.ms）
   负责人可多选：几个人共同负责一件事。
   为什么不用原生 <select multiple>：手机上几乎没法用（要长按才能多选），
   而这恰恰是筹备组的常态。这里是「按钮 + 勾选面板 + chip」。
   -------------------------------------------------------------------- */
.ms { position: relative; min-width: 0; }
.ms-btn {
  display: flex; align-items: center; gap: 6px; width: 100%; min-height: 36px;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font-size: 13.5px;
  text-align: left; cursor: pointer; transition: 0.15s; font-family: inherit;
}
.ms-btn:hover { border-color: var(--accent-line); }
.ms.open .ms-btn { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.ms-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ms-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: 1; min-width: 0; }
.ms-empty { font-size: 13px; }
.ms-caret { margin-left: auto; flex: none; color: var(--muted); font-size: 11px; }
.ms-chip { max-width: 100%; }
.ms-chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-x {
  display: inline-grid; place-items: center; width: 15px; height: 15px; flex: none;
  border-radius: 4px; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer;
}
.ms-x:hover { background: var(--danger-soft); color: var(--danger); }
.ms-panel {
  /* 就地展开，不做绝对定位：
     抽屉（.drawer-b overflow-y:auto）与弹窗都会裁掉绝对定位的下层，
     与其被切掉半截，不如把表单撑开——和本项目既有的「依赖选择器」口径一致。 */
  margin-top: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
}
.ms-list { max-height: 240px; overflow-y: auto; padding: 4px; }
.ms-opt {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: 7px; font-size: 13.5px; cursor: pointer;
}
.ms-opt:hover { background: var(--surface-2); }
.ms-opt.on { background: var(--accent-soft); }
/* .field input 的通配规则会把复选框拉成整行宽，这里必须单独覆盖 */
.ms-opt input[type="checkbox"] {
  width: 15px; height: 15px; min-height: 0; flex: none;
  padding: 0; margin: 0; border-radius: 4px; accent-color: var(--accent);
}
.ms-foot {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-top: 1px solid var(--line-soft); background: var(--surface-2);
}
.ms-clear {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 7px; padding: 3px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.ms-clear:disabled { opacity: 0.45; cursor: not-allowed; }
.ms.busy { opacity: 0.7; pointer-events: none; }
/* 参考区块里的主责选择器（静态表格里，宽度受限） */
.ms.ref-owner { max-width: 100%; }
.ms.ref-owner .ms-btn { min-height: 32px; font-size: 12.5px; padding: 4px 8px; }
/* 按钮本身可能只有 132–160px 宽（决策卡 / 窄表格列），勾选面板跟着这么窄的话
   复选框 + 三字人名都快挤不下。就地展开的面板允许比按钮宽（撑宽所在单元格），
   保底 200px 保证每行「复选框 + 姓名」完整可读。 */
.ms.ref-owner .ms-panel { min-width: 200px; }

/* ---------------------------------------------------------------- 前置完成闸门弹窗 */
.gate-warn {
  border: 1px solid var(--warn-line);
  background: var(--warn-soft);
  border-radius: 11px;
  padding: 11px 13px;
}
.gate-warn .t { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.gate-warn .d { font-size: 12.5px; color: var(--ink-2); line-height: 1.75; margin-top: 5px; }
.gate-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
}
.gate-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.gate-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 30ch; color: var(--ink-2);
}
.gate-row.dead .gate-title { color: var(--danger); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 9px 13px; font-size: 13px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--hover-tint); }

.empty { padding: 38px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty .big { font-size: 26px; margin-bottom: 8px; opacity: 0.5; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line-soft); margin: 12px 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hr-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }

/* ------------------------------------------------------------------ 页面骨架 */
.page { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
/* PC 大屏：放开 1280px 宽度帽，顶栏与页面用满屏幕宽度。
   只在 ≥1280px（PC）生效 —— 窄屏 / 移动端布局完全不受影响；
   各视图内部是流式栅格（如材料台 296px 侧栏 + 自适应主列），
   多出来的宽度全部落在内容区，表格 / 看板 / 甘特自然变宽。 */
@media (min-width: 1280px) {
  .wrap, .page { max-width: none; }
}
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: clamp(20px, 3vw, 26px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.page-head .lede { color: var(--ink-2); font-size: 13.5px; max-width: 70ch; }
.page-head .spacer { flex: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 99px; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: 290px minmax(0, 1fr); align-items: start; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.stat { background: var(--surface); padding: 12px 15px; }
.stat .n { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.stat .n small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat .t { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.stat .bar { height: 4px; border-radius: 99px; background: var(--line-soft); margin-top: 7px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.35s; }

/* ------------------------------------------------------------------ 抽屉 / 弹窗 / toast */
.overlay { position: fixed; inset: 0; background: var(--overlay-bg); z-index: 100; opacity: 0; transition: opacity 0.2s; }
.overlay.on { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); max-width: 100vw;
  background: var(--bg); z-index: 110; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer.on { transform: translateX(0); }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 13px 18px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.drawer-h .ttl { font-size: 15px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-f { flex: none; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); display: flex; gap: 8px; justify-content: flex-end; }

.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(0.98); opacity: 0; z-index: 120; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 60px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); transition: 0.2s; }
.modal.on { transform: translate(-50%, -50%) scale(1); opacity: 1; }
/* 标题栏即拖拽把手：cursor 提示可拖；touch-action 让触屏按住能拖而不是滚动页面 */
.modal-h { padding: 15px 18px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 700; flex: none; cursor: move; user-select: none; -webkit-user-select: none; touch-action: none; }
/* flex 列容器里必须给 .modal-b 显式 min-height:0 + flex:1，
   否则它按内容高度撑开、把 .modal-f（取消/保存按钮）顶出视口外点不到 */
.modal-b { padding: 18px; overflow-y: auto; font-size: 13.5px; color: var(--ink-2); flex: 1 1 auto; min-height: 0; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex: none; }

.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--toast-bg); color: var(--toast-fg); border-radius: 11px; padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: flex-start; animation: toastIn 0.2s ease; }
.toast.ok { background: var(--accent); }
.toast.err { background: var(--danger); }
.toast.key { background: var(--toast-key-bg); border-left: 3px solid var(--accent); }
.toast .tx { flex: 1; }
.toast .x { opacity: 0.6; cursor: pointer; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 通知面板 */
.notif-panel { position: fixed; top: calc(var(--topbar-h) + 8px); right: max(12px, calc((100vw - 1280px) / 2 + 12px)); width: min(390px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 90px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 90; overflow: hidden; }
.notif-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 9px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item .n-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }
.notif-item .n-body { flex: 1; min-width: 0; }
.notif-item .n-msg { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; word-break: break-word; }
.notif-item .n-time { font-size: 11px; color: var(--faint); margin-top: 2px; }
.notif-f { padding: 8px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.notif-f .btn { flex: 1; }

/* 登录 / 注册 */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background: radial-gradient(1100px 520px at 50% -10%, var(--accent-glow), transparent 65%), var(--bg); }
.auth-card { position: relative; width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-md); padding: 30px 28px 24px; }
.auth-brand { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 600; color: var(--accent); letter-spacing: 0.03em; }
.auth-brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.auth-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 4px; }
.auth-card .sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form .err { color: var(--danger); font-size: 12.5px; min-height: 18px; }
.auth-alt { margin-top: 16px; font-size: 12.5px; color: var(--muted); text-align: center; }
.auth-alt a { color: var(--accent); font-weight: 600; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--faint); line-height: 1.6; }
.auth-foot code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* 表格卡 / 列表行 */
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.list-row:last-child { border-bottom: 0; }
.list-row.click { cursor: pointer; }
.list-row.click:hover { background: var(--surface-2); }

/* 响应式 */
@media (max-width: 1080px) {
  .grid.side { grid-template-columns: 1fr; }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  :root { --topbar-h: auto; }
  .topbar-inner { flex-wrap: wrap; gap: 6px 10px; height: auto; padding-top: 9px; padding-bottom: 9px; }
  .brand-name { display: none; }
  .nav { order: 3; flex-basis: 100%; }
  .nav-link { padding: 5px 9px; font-size: 12.5px; }
  .search-box input { width: 96px; }
  .user-chip .user-name { display: none; }
  .page { padding: 16px 14px 56px; }
  .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .search-pop { width: min(340px, calc(100vw - 28px)); right: -40px; }
  /* 窄屏弹窗：内边距收窄、底部按钮不换行也不出屏 */
  .modal { max-height: calc(100dvh - 24px); }
  .modal-b { padding: 14px; }
  .modal-f { padding: 10px 14px; }
  .modal-f .btn { flex: 1 1 auto; }
  .drawer-b { padding: 14px; }
  .drawer-f { padding: 10px 14px; }
  .drawer-f .btn { flex: 1 1 auto; }
  .form-foot { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .search-box { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-card { padding: 24px 20px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.auth-mode .topbar{display:none}
.auth-mode .view-root{min-height:100vh}
