/* 品牌色取自「20 品牌vi手册.pdf」文字层：主色 PANTONE 7627C #9A2C28、辅助色 #C99D6B、深墨 #150201
   色阶命名：50 最浅 / 100 淡 / 200 浅 / 300 柔 / 400 亮 / 500 基 / 600 深 / 700 浓 / 800 重 / 900 最深 */
:root {
  /* ---- 品牌色（朱红）---- */
  --brand-50:  #fdf4f3;
  --brand-100: #fbe5e3;
  --brand-200: #f4c4c1;
  --brand-300: #e99a95;
  --brand-400: #dc6a63;
  --brand-500: #c73e36;  /* 提亮后的活色，用于 hover、图标、小面积点缀 */
  --brand-600: #9A2C28;  /* 品牌主色 VI 原色，用于按钮、标题、强调 */
  --brand-700: #7d2320;  /* 加深，用于 active/pressed */
  --brand-800: #5e1a18;
  --brand-900: #3f1110;
  --brand:     var(--brand-600);
  --brand-live: var(--brand-500);
  --brand-ink:  var(--brand-700);

  /* ---- 辅助色（暖金）---- */
  --gold-50:  #fdf8f0;
  --gold-100: #faf0dd;
  --gold-200: #f3dfb8;
  --gold-300: #e8c78a;
  --gold-400: #dab26a;
  --gold-500: #C99D6B;  /* VI 原色，用于次级强调、用户气泡、辅助边框 */
  --gold-600: #b0854e;
  --gold-700: #8c6739;
  --brand-aux: var(--gold-500);

  /* ---- 中性色（暖灰系）---- */
  --ink:       #150201;    /* 最深墨色，极少用 */
  --text-1:    #1d1a19;    /* 主正文 */
  --text-2:    #4a4442;    /* 次级正文 / 小标题 */
  --text-3:    #6b6461;    /* 辅助文字 / meta（≈ 7:1 on white） */
  --text-4:    #8a827f;    /* 更弱的提示 / placeholder */
  --text:      var(--text-1);
  --text-dim:  var(--text-3);
  --line-1:    #d9d4d1;    /* 主分割线 / 输入框边框 */
  --line-2:    #e8e4e1;    /* 次级分割线 / 卡片内部分隔 */
  --line-3:    #f1eeec;    /* 最弱分割线 / hover 底 */
  --line:      var(--line-1);
  --line-soft: var(--line-2);
  --bg:        #f4f2f0;    /* 页面底色 */
  --surface:   #ffffff;    /* 卡片 / 面板 */
  --surface-2: #faf8f7;    /* 次级面板 / 斑马纹 */
  --surface-3: #f5f2f0;    /* 输入框背景 / 禁用态 */
  --surface-alt: var(--surface-2);

  /* ---- 状态色 ---- */
  --success-500: #1f6b3f;
  --success-100: #e8f2ec;
  --success-200: #b6d6c3;
  --danger-500:  #9d1f1a;
  --danger-100:  #fbeceb;
  --danger-200:  #eec6c3;
  --warning-500: #8a5a12;
  --warning-100: #fbf3e6;
  --warning-200: #e7d3ae;
  --ok:     var(--success-500);
  --danger: var(--danger-500);
  --warn:   var(--warning-500);
  --ok-bg:     var(--success-100);
  --ok-line:   var(--success-200);
  --danger-bg:  var(--danger-100);
  --danger-line: var(--danger-200);
  --warn-bg:    var(--warning-100);
  --warn-line:  var(--warning-200);

  /* ---- 焦点环 ---- */
  --focus: var(--brand-500);
  --focus-ring: 0 0 0 3px rgba(199, 62, 54, .15);

  /* ---- 圆角 ---- */
  --radius-sm: 3px;
  --radius:    6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 999px;

  /* ---- 间距（4px 基准）---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --gap: var(--space-3);

  /* ---- 阴影 ---- */
  --shadow-xs: 0 1px 2px rgba(21, 2, 1, .04);
  --shadow-sm: 0 1px 2px rgba(21, 2, 1, .05), 0 1px 3px rgba(21, 2, 1, .04);
  --shadow-md: 0 2px 4px rgba(21, 2, 1, .06), 0 4px 12px rgba(21, 2, 1, .05);
  --shadow-lg: 0 4px 8px rgba(21, 2, 1, .07), 0 8px 24px rgba(21, 2, 1, .06);
  --shadow-card:  var(--shadow-sm);
  --shadow-raise: var(--shadow-md);

  /* ---- 字体层级 ---- */
  --font-xs:   12px;   /* 辅助 / badge / 时间 */
  --font-sm:   13px;   /* 次级正文 / label */
  --font-base: 14px;   /* 主正文 */
  --font-md:   15px;   /* 小标题 / 导航 */
  --font-lg:   16px;   /* pane 标题 / 重要小标题 */
  --font-xl:   18px;   /* 登录标题 / 卡片标题 */
  --font-2xl:  20px;   /* 详情大标题 */
  --font-3xl:  24px;   /* 统计数字 */
  --font-4xl:  32px;   /* 大数字 / Hero */

  /* ---- 行高 ---- */
  --leading-tight: 1.25;
  --leading-base:  1.5;
  --leading-relax: 1.65;

  /* ---- 动效 ---- */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur-base: 150ms;
  --dur-slow: 200ms;
}

* { box-sizing: border-box; }

/* 视图容器用了 display:flex/grid，会盖掉 UA 的 [hidden]，必须显式压回去 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: var(--font-base)/var(--leading-base) -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Helvetica Neue", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 通用控件 ---------- */

.btn {
  font: inherit;
  font-weight: 500;
  height: 40px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line-1);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-1);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--text-1);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:focus-visible {
  box-shadow: var(--focus-ring);
  border-color: var(--brand-400);
}

.btn-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}

.btn-primary:active:not(:disabled) {
  background: var(--brand-700);
  border-color: var(--brand-700);
}

.btn-secondary {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-700);
  font-weight: 500;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--brand-100);
  border-color: var(--brand-300);
  color: var(--brand-700);
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-3);
}

.btn-quiet:hover {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: transparent;
}

.btn-block { width: 100%; }

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--font-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  height: 44px;
  padding: 0 var(--space-5);
  font-size: var(--font-md);
}

input[type="text"], input[type="password"], textarea, .select {
  font: inherit;
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--line-1);
  border-radius: var(--radius);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              background-color var(--dur-fast) var(--ease-standard);
  caret-color: var(--brand-600);
}

input[type="text"]:hover,
input[type="password"]:hover,
textarea:hover,
.select:hover {
  border-color: var(--text-4);
}

textarea {
  height: auto;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
  line-height: var(--leading-base);
}

input:focus-visible, textarea:focus-visible, .select:focus-visible {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

input::placeholder, textarea::placeholder {
  color: var(--text-4);
}

/* 原生 datetime-local / date 不吃上面的选择器，会退化成系统控件 */
input[type="datetime-local"], input[type="date"] {
  font: inherit;
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--line-1);
  border-radius: var(--radius);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
  caret-color: var(--brand-600);
}

input[type="datetime-local"]:focus-visible, input[type="date"]:focus-visible {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

/* 自定义 select 下拉箭头（纯 CSS） */
.select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 50%,
    calc(100% - 10px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 28px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              background-color var(--dur-fast) var(--ease-standard);
}

.select:hover {
  border-color: var(--text-4);
}

.select:focus-visible {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brand-600) 50%),
    linear-gradient(135deg, var(--brand-600) 50%, transparent 50%);
}

.field { margin-bottom: var(--space-3); text-align: left; }

.field label {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--text-2);
  font-size: var(--font-sm);
  font-weight: 500;
}

.field label .label-required {
  color: var(--brand-600);
  margin-left: 2px;
}

/* 输入框错误态 + 抖动动画 */
.input-invalid,
input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger-500);
  background: var(--danger-100);
  animation: input-shake 0.3s var(--ease-standard);
}

@keyframes input-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.input-invalid:focus-visible,
input[aria-invalid="true"]:focus-visible,
textarea[aria-invalid="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(157, 31, 26, .12);
}

@media (prefers-reduced-motion: reduce) {
  .input-invalid,
  input[aria-invalid="true"],
  textarea[aria-invalid="true"] {
    animation: none;
  }
}

.form-error {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  color: var(--danger-500);
  background: var(--danger-100);
  border-left: 3px solid var(--danger-500);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--font-sm);
  line-height: 1.5;
  text-align: left;
}

/* 「已退出登录」是正常流程，不该穿错误红 */
.form-error.is-neutral {
  color: var(--text-3);
  background: var(--surface-2);
  border-left-color: var(--line-1);
}

.form-success {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  color: var(--success-500);
  background: var(--success-100);
  border-left: 3px solid var(--success-500);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--font-sm);
  line-height: 1.5;
  text-align: left;
}

.hint { color: var(--text-3); font-size: var(--font-sm); line-height: 1.5; }

.boot { padding: var(--space-6); color: var(--text-3); }

/* ---------- 状态徽章 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--space-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--font-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: .01em;
}

.badge-ok {
  background: var(--success-100);
  border-color: var(--success-200);
  color: var(--success-500);
}

.badge-danger {
  background: var(--danger-100);
  border-color: var(--danger-200);
  color: var(--danger-500);
}

.badge-warn {
  background: var(--warning-100);
  border-color: var(--warning-200);
  color: var(--warning-500);
}

.badge-gold {
  background: var(--gold-100);
  border-color: var(--gold-200);
  color: var(--gold-600);
}

.badge-ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--text-3);
}

.badge-dot::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- 登录页 ----------
   满屏两栏：左侧动画、右侧表单，7:3。DOM 里表单在前 —— 按 Tab 先到账号框、
   读屏器先读表单；视觉上靠 row-reverse 把动画摆到左边。
   角色动画移植自 animated-characters-login-page：它的画布是 550×400，
   这里把画布内的一切几何都写成 em，再让 font-size 等于「一个设计稿像素」的
   实际尺寸，整块就跟着容器等比缩放。 */

.login-view {
  display: flex;
  min-height: 100vh;
  background: var(--surface);
}

@supports (height: 100dvh) {
  /* 手机上地址栏会伸缩，只用 100vh 会把表单底部顶出屏幕。 */
  .login-view { min-height: 100dvh; }
}

.login-shell {
  display: flex;
  flex-direction: row-reverse;   /* 动画在左、表单在右 */
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

/* 表单占 3、动画占 7。但表单给一个最小宽度：30% 一旦小于这个数，先压缩动画而不是
   把输入框挤扁 —— 比例为可用性让路。 */
.login-pane {
  display: flex;
  flex: 3 1 0;
  min-width: 380px;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-8);
  background: var(--surface);
}

.login-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.login-logo {
  display: block;
  margin: 0 auto var(--space-4);
  filter: drop-shadow(0 1px 2px rgba(21, 2, 1, .08));
}

.login-title {
  margin: 0 0 var(--space-1);
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.01em;
}

.login-sub {
  margin: 0 0 var(--space-6);
  color: var(--text-3);
  font-size: var(--font-sm);
  line-height: 1.5;
}

.login-card .btn-primary {
  margin-top: var(--space-4);
  font-weight: 600;
  height: 44px;
}

/* 员工面 / 管理面是两个入口的说明。放在按钮下面、弱化成辅助文字，
   不跟表单抢注意力。 */
.login-note {
  margin: var(--space-4) 0 0;
  color: var(--text-3);
  font-size: var(--font-xs);
  line-height: 1.5;
}

.login-card a { color: var(--brand-600); text-decoration: none; }
.login-card a:hover { color: var(--brand-500); text-decoration: underline; }

/* 密码可见性切换。按钮压在输入框右端，所以输入框右侧要留出它的位置，
   否则长密码会顶到图标底下。 */
.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-3);
  background: none;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-standard),
              background-color var(--dur-fast) var(--ease-standard);
}

.password-toggle:hover { color: var(--text-1); background: var(--surface-3); }

.password-toggle:focus-visible {
  outline: none;
  color: var(--brand-600);
  box-shadow: var(--focus-ring);
}

/* 一个按钮两个图标：藏密码时显示「睁眼」（点它可看），显形后显示「闭眼」。 */
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-on .icon-eye { display: none; }
.password-toggle.is-on .icon-eye-off { display: block; }

/* ---------- 登录页动画画布 ---------- */

.login-scene-wrap {
  position: relative;
  display: flex;
  flex: 7 1 0;
  min-width: 0;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  padding: var(--space-6) var(--space-8) 0;
  /* 中暖灰打底、品牌红只做地面那道光。四个角色里有一个是纯黑的，底色一旦压暗到
     品牌深红，他的人形就直接糊在背景里；白色眼白也需要一层中调才立得住。 */
  background:
    radial-gradient(80% 50% at 50% 108%, rgba(199, 62, 54, .35), transparent 68%),
    linear-gradient(168deg, var(--text-2), var(--text-4));
}

.characters-scene {
  /* 1em = 设计稿 1px。宽、高各算一遍取小值：只看宽度的话，宽屏上四个角色会长得
     比屏幕还高，脚被裁在视口外面。支持容器查询时宽度用实测值，否则按 70vw 估算。 */
  --scene-basis: calc(70vw - 4rem);
  --scene-height: calc(100vh - 5rem);
  /* 上限决定「角色最大能长多高」：2px 时最高那个是画布的 400×2=800px，
     差不多是笔记本视口高度的六七成 —— 再大就成了满屏贴脸，再小则撑不住左侧这一栏。 */
  --scene-cap: 2px;
  --scene-unit: min(var(--scene-cap), calc(var(--scene-basis) / 550), calc(var(--scene-height) / 400));

  position: relative;
  flex: 0 0 auto;
  width: calc(550 * var(--scene-unit));
  height: calc(400 * var(--scene-unit));
  font-size: var(--scene-unit);
}

@supports (height: 100dvh) {
  .characters-scene { --scene-height: calc(100dvh - 5rem); }
}

@supports (font-size: 1cqw) {
  .login-scene-wrap { container-type: inline-size; }

  /* 实测容器宽度。表单的最小宽度会把实际比例从 7:3 撞开，估算值就不准了。 */
  .characters-scene { --scene-basis: 100cqw; }
}

.character {
  position: absolute;
  bottom: 0;
  transform-origin: bottom center;
  transition: transform .7s var(--ease-standard), height .5s var(--ease-standard);
  will-change: transform;
}

.character-purple { left: 70em; width: 180em; height: 400em; background: #6C3FF5; z-index: 1; }
.character-black  { left: 240em; width: 120em; height: 310em; background: #2D2D2D; z-index: 2; }
.character-orange {
  left: 0; width: 240em; height: 150em; background: #FF9B6B;
  border-radius: 120em 120em 0 0; z-index: 3;
}
.character-yellow {
  left: 310em; width: 140em; height: 230em; background: #E8D754;
  border-radius: 70em 70em 0 0; z-index: 4;
}

/* 入场：四个角色依次从画布外弹入。动画跑完由 JS 打上 is-entered，
   之后 inline 的倾斜 transform 才能接管 —— 否则动画一直压着 transform。 */
.character-purple { animation: purple-entrance 1.2s cubic-bezier(.34, 1.56, .64, 1) both; }
.character-black  { animation: black-entrance 1s cubic-bezier(.34, 1.56, .64, 1) .2s both; }
.character-orange { animation: orange-entrance 1.1s cubic-bezier(.34, 1.56, .64, 1) .1s both; }
.character-yellow { animation: yellow-entrance 1s cubic-bezier(.34, 1.56, .64, 1) .3s both; }

.character.is-entered { animation: none; }

@keyframes purple-entrance {
  0%   { transform: translate(-150em, 50em) rotate(-15deg) scale(.3); opacity: 0; }
  60%  { transform: translate(10em, -10em) rotate(3deg) scale(1.05); }
  100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
}

@keyframes black-entrance {
  0%   { transform: translateY(-100em) scale(.5); opacity: 0; }
  70%  { transform: translateY(10em) scale(1.08); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes orange-entrance {
  0%   { transform: translate(-200em, 80em) rotate(-25deg) scale(.2); opacity: 0; }
  65%  { transform: translate(15em, -8em) rotate(5deg) scale(1.1); }
  100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
}

@keyframes yellow-entrance {
  0%   { transform: translate(200em, 60em) rotate(20deg) scale(.3); opacity: 0; }
  65%  { transform: translate(-12em, -5em) rotate(-4deg) scale(1.06); }
  100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
}

.eyes {
  position: absolute;
  display: flex;
  transition: left .7s var(--ease-standard), top .7s var(--ease-standard);
}

.character-purple .eyes { gap: 32em; }
.character-black .eyes { gap: 24em; }
/* 橙、黄两只是纯瞳孔，原项目给它们更短的跟随延迟，看着更「精神」。 */
.character-orange .eyes,
.character-yellow .eyes {
  gap: 32em;
  transition: left .2s cubic-bezier(0, 0, .2, 1), top .2s cubic-bezier(0, 0, .2, 1);
}

.character-yellow .eyes { gap: 24em; }

.eyeball {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  transition: height .3s var(--ease-standard), border-radius .3s var(--ease-standard),
              transform .3s var(--ease-standard);
  will-change: height, border-radius, transform;
}

.pupil {
  border-radius: 50%;
  transition: transform .1s ease-out, height .15s ease-out;
  will-change: transform, height;
}

.mouth-purple,
.mouth-orange {
  position: absolute;
  background: #2D2D2D;
}

.mouth-purple {
  width: 24em;
  height: 8em;
  border-radius: 0 0 12em 12em;
  transition: left .7s var(--ease-standard), top .7s var(--ease-standard),
              width .5s var(--ease-standard), height .5s var(--ease-standard),
              border-radius .5s var(--ease-standard), transform .5s var(--ease-standard);
}

.mouth-orange {
  width: 26em;
  height: 13em;
  border-radius: 0 0 13em 13em;
  transition: left .2s cubic-bezier(0, 0, .2, 1), top .2s cubic-bezier(0, 0, .2, 1),
              width .5s var(--ease-standard), height .5s var(--ease-standard),
              border-radius .5s var(--ease-standard), transform .5s var(--ease-standard);
}

/* 打字中：紫的嘴抿成一条竖线，橙的嘟成圆点。 */
.mouth-purple.is-typing {
  width: 7em;
  height: 32em;
  border-radius: 0;
  transform: translate(13.5em, -28em) var(--counter-skew, skewX(0));
}

.mouth-orange.is-typing {
  width: 14em;
  height: 14em;
  border-radius: 50%;
  transform: translateX(6em);
}

/* 登录失败：嘴角翻过来。 */
.mouth-purple.is-sad { width: 24em; height: 8em; border-radius: 12em 12em 0 0; }
.mouth-orange.is-sad { width: 26em; height: 13em; border-radius: 13em 13em 0 0; }

/* 登录成功：张开的笑口。 */
.mouth-purple.is-happy { width: 30em; height: 16em; border-radius: 0 0 15em 15em; }
.mouth-orange.is-happy { width: 32em; height: 18em; border-radius: 0 0 16em 16em; }

.mouth-yellow {
  position: absolute;
  width: 80em;
  height: 20em;
  transition: left .2s cubic-bezier(0, 0, .2, 1), top .2s cubic-bezier(0, 0, .2, 1);
}

.mouth-yellow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mouth-yellow .mouth-line {
  transition: d .5s var(--ease-standard);
}

/* 彩色纸屑。挂到 body 上，所以登录成功换屏后它还在落。 */
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0%   { translate: 0 0; opacity: 1; }
  100% { translate: 30px 200vh; opacity: 1; rotate: 720deg; }
}

/* 系统开了「减少动效」：不做入场、不跟随、不飘纸屑，角色直接停在最终位置。
   动画是纯装饰，静态的四个角色照样成立。 */
@media (prefers-reduced-motion: reduce) {
  .character { animation: none; animation-name: none; transition: none; }
  .eyes, .eyeball, .pupil, .mouth-purple, .mouth-orange, .mouth-yellow { transition: none; }
  .confetti-layer { display: none; }
}


/* ---------- 工作台骨架 ---------- */

.app-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 桌面端：侧边栏 + 主内容区横向布局 */
@media (min-width: 860px) {
  .app-view {
    flex-direction: row;
  }
}

/* 主内容区（顶栏 + 工作台 + 底部导航） */
.app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100%;
}

/* ---------- 左侧垂直边栏（桌面端） ---------- */

.sidebar {
  display: none;
  flex: none;
  width: 200px;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line-2);
  box-shadow: var(--shadow-xs);
  position: relative;
  z-index: 5;
}

@media (min-width: 860px) {
  .sidebar {
    display: flex;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 52px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--line-2);
  flex: none;
}

.sidebar-logo {
  flex: none;
  filter: drop-shadow(0 1px 2px rgba(21, 2, 1, .08));
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: var(--font-md);
  color: var(--text-1);
  letter-spacing: -.01em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-2) 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer {
  flex: none;
  padding: var(--space-2) 0;
  border-top: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 40px;
  padding: 0 var(--space-4);
  border: none;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: background-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard);
}

.sidebar-nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--brand-600);
  border-radius: 0 2px 2px 0;
  transition: height var(--dur-fast) var(--ease-standard);
}

.sidebar-nav-item:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

.sidebar-nav-item:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

.sidebar-nav-item.is-active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}

.sidebar-nav-item.is-active::before {
  height: 24px;
}

.sidebar-nav-icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: block;
  position: relative;
}

.sidebar-nav-label {
  flex: 1;
  min-width: 0;
  line-height: 1;
}

/* 工作台图标：两个矩形代表两栏 */
.sidebar-nav-item[data-pane="tasks"] .sidebar-nav-icon::before,
.sidebar-nav-item[data-pane="tasks"] .sidebar-nav-icon::after {
  content: "";
  position: absolute;
  top: 1px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.sidebar-nav-item[data-pane="tasks"] .sidebar-nav-icon::before {
  left: 0;
  width: 5px;
}
.sidebar-nav-item[data-pane="tasks"] .sidebar-nav-icon::after {
  right: 0;
  width: 8px;
}

/* 派活图标：人形+箭头 */
.sidebar-nav-item[data-pane="assign"] .sidebar-nav-icon::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.sidebar-nav-item[data-pane="assign"] .sidebar-nav-icon::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-bottom: none;
  border-radius: 3px 3px 0 0;
}

/* 驾驶舱图标：柱状图 */
.sidebar-nav-item[data-pane="cockpit"] .sidebar-nav-icon::before {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 1px;
  width: 3px;
  height: 9px;
  background: currentColor;
  border-radius: 1px;
}
.sidebar-nav-item[data-pane="cockpit"] .sidebar-nav-icon::after {
  content: "";
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 3px;
  height: 12px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: -5px -3px 0 -1px currentColor;
}

/* 设置图标：齿轮 */
.sidebar-nav-item[data-pane="me"] .sidebar-nav-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.sidebar-nav-item[data-pane="me"] .sidebar-nav-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-nav-item,
  .sidebar-nav-item::before {
    transition: none;
  }
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-2);
  box-shadow: var(--shadow-xs);
  position: relative;
  z-index: 10;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-1);
  font: inherit;
  cursor: pointer;
}

.topbar-brand:focus-visible {
  outline: none;
  border-radius: var(--radius);
  box-shadow: var(--focus-ring);
}

.topbar-logo { flex: none; }

.topbar-title {
  color: var(--text-1);
  font-size: var(--font-md);
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: var(--space-1);
  min-width: 0;
}

.top-nav-item {
  position: relative;
  min-width: 72px;
  padding: 0 var(--space-4);
  border: 0;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-standard),
              background-color var(--dur-fast) var(--ease-standard);
}

.top-nav-item:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

.top-nav-item:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

.top-nav-item.is-active {
  color: var(--brand-700);
  font-weight: 600;
}

.top-nav-item.is-active::after {
  content: "";
  position: absolute;
  right: var(--space-3);
  bottom: 0;
  left: var(--space-3);
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand-600);
}

/* 顶栏用户头像下拉 */
.topbar-user {
  margin-left: auto;
  position: relative;
}

.avatar-btn {
  font: inherit;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 2px 2px 2px var(--space-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-1);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard),
              background-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}

.avatar-btn:hover {
  border-color: var(--line-1);
  background: var(--surface-2);
}

.avatar-btn:focus-visible {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--font-xs);
  font-weight: 600;
  flex: none;
}

.avatar-circle::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  position: relative;
  top: -2px;
  box-shadow: 0 4px 0 -1px #fff;
}

.avatar-name {
  font-size: var(--font-sm);
  font-weight: 500;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-3);
  margin-right: var(--space-2);
  transition: transform var(--dur-base) var(--ease-standard);
}

.avatar-btn[aria-expanded="true"] .avatar-caret {
  transform: rotate(180deg);
}

/* 下拉菜单 */
.avatar-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  z-index: 100;
  animation: dropdown-in var(--dur-base) var(--ease-standard);
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-menu { animation: none; }
}

.avatar-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-1);
  font: inherit;
  font-size: var(--font-sm);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-standard);
}

.avatar-menu-item:hover {
  background: var(--surface-2);
}

.avatar-menu-item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.avatar-menu-item.avatar-menu-danger {
  color: var(--danger-500);
}

.avatar-menu-item.avatar-menu-danger:hover {
  background: var(--danger-100);
}

.avatar-menu-icon {
  width: 16px;
  height: 16px;
  flex: none;
  background: var(--text-3);
  opacity: .6;
  border-radius: 2px;
}

.avatar-menu-divider {
  height: 1px;
  background: var(--line-2);
  margin: var(--space-1) 0;
}

/* 隐藏的 legacy tabs 占位（供审计用） */
.legacy-tabs { display: none; }

.workbench {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  background: var(--surface);
}

.work-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--line-2);
}

.work-sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-1);
  padding: var(--space-2);
  border-bottom: 1px solid var(--line-2);
  background: var(--surface);
  flex: none;
}

.work-sidebar-tab {
  height: 36px;
  min-width: 0;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard);
}

.work-sidebar-tab:hover { color: var(--text-1); background: var(--surface-2); }

.work-sidebar-tab.is-active {
  color: var(--brand-700);
  background: var(--brand-50);
  font-weight: 600;
}

.work-sidebar-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.work-sidebar > .pane {
  flex: 1;
  min-height: 0;
}

.pane-chat { border-left: 0; }

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: var(--space-4);
  background: var(--surface);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.pane::-webkit-scrollbar { width: 6px; }
.pane::-webkit-scrollbar-track { background: transparent; }
.pane::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 3px;
}
.pane::-webkit-scrollbar-thumb:hover { background: var(--line-1); }

.pane-detail { background: var(--surface-2); }

/* pane 标题 */
.pane-h {
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line-2);
  font-size: var(--font-lg);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pane-h .pane-h-extra {
  margin-left: auto;
  font-size: var(--font-xs);
  font-weight: 400;
  color: var(--text-3);
}

/* ---------- 左侧工作清单 ---------- */

.worklist-toolbar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.worklist-toolbar input {
  flex: 1;
  min-width: 0;
}

.worklist-toolbar .btn {
  flex: none;
}

.worklist-groups {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: var(--space-1);
}

.worklist-group + .worklist-group {
  margin-top: var(--space-4);
}

.worklist-group-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 var(--space-2);
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-3);
  padding: 0 var(--space-1);
}

.worklist-group-count {
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.worklist-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.worklist-item {
  width: 100%;
  padding: var(--space-3);
  margin-bottom: var(--space-1);
  text-align: left;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.worklist-item:hover {
  background: var(--surface-2);
  border-color: var(--line-1);
}

.worklist-item:active {
  transform: scale(0.99);
}

.worklist-item:focus-visible {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

.worklist-item[aria-current="true"] {
  border-left-color: var(--brand-600);
  border-color: var(--brand-200);
  background: var(--brand-50);
}

.worklist-item[aria-current="true"] .worklist-title {
  color: var(--brand-700);
  font-weight: 600;
}

.worklist-title {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.worklist-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.worklist-source {
  font-size: var(--font-xs);
  color: var(--text-3);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.worklist-meta .badge {
  flex: none;
}

/* ---------- 对话顶部标题栏 ---------- */

.chat-header {
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--line-2);
  flex: none;
}

.chat-header-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.chat-header-title {
  margin: 0;
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.chat-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-header-due {
  font-size: var(--font-xs);
  color: var(--text-3);
  white-space: nowrap;
}

/* ---------- 事项区 ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 240px;
  padding: var(--space-8) var(--space-4);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-3);
  text-align: center;
  font-size: var(--font-sm);
}

.empty::before {
  content: "";
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-2);
  border: 2px solid var(--line-2);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--line-2), var(--line-2)) center/18px 2px no-repeat,
    linear-gradient(var(--line-2), var(--line-2)) center 13px/12px 2px no-repeat;
}

.empty-title {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--text-2);
  margin: 0;
}

.empty-desc {
  margin: 0;
  color: var(--text-3);
  font-size: var(--font-sm);
  line-height: 1.5;
}

/* 骨架屏加载态 */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation-duration: 3s; }
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-line.short { width: 60%; }

/* 事项详情卡片 */
.pane-detail #detail-body {
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
}

.detail-title {
  margin: 0 0 var(--space-3);
  font-size: var(--font-lg);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-1);
  letter-spacing: -.01em;
  word-break: break-word;
}

/* dt/dd 元信息网格 */
.meta {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: var(--space-2) var(--space-3);
  margin: 0;
  font-size: var(--font-sm);
}

.meta dt {
  color: var(--text-3);
  font-weight: 400;
}

.meta dd {
  margin: 0;
  color: var(--text-1);
  word-break: break-word;
}

.meta .badge { align-self: flex-start; }

/* 区块小标题 */
.block-h {
  margin: var(--space-5) 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line-2);
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--text-1);
}

.block-h:first-child { margin-top: 0; }

/* ---------- 资料空间 ---------- */

.space-block {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.space-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-3);
}

.space-tools .select { flex: 0 1 160px; width: auto; }

.space-tools input { flex: 1 1 180px; width: auto; min-width: 0; }

.space-tools .btn { flex: none; }

.space-list { margin: 0; padding: 0; list-style: none; }

.space-item {
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}

.space-item:hover {
  border-color: var(--line-1);
  box-shadow: var(--shadow-xs);
}

.space-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  margin-bottom: var(--space-1);
}

.space-item-title {
  font-weight: 600;
  word-break: break-word;
  color: var(--text-1);
  font-size: var(--font-sm);
}

.space-item-when {
  margin-left: auto;
  color: var(--text-3);
  font-size: var(--font-xs);
  font-variant-numeric: tabular-nums;
}

.space-item-body {
  margin: 0;
  color: var(--text-2);
  font-size: var(--font-sm);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

/* ---------- 对话区 ---------- */

.messages {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding-right: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 3px;
}

.messages:empty { display: none; }

.chat-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 200px;
  padding: var(--space-6) var(--space-4);
  color: var(--text-3);
  text-align: center;
  font-size: var(--font-sm);
}

.chat-empty::before {
  content: "";
  width: 48px;
  height: 40px;
  margin-bottom: var(--space-2);
  border: 2px solid var(--line-2);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 2px;
  background:
    linear-gradient(var(--line-2), var(--line-2)) 11px 12px/26px 2px no-repeat,
    linear-gradient(var(--line-2), var(--line-2)) 11px 20px/16px 2px no-repeat;
}

.chat-empty-title {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--text-2);
  margin: 0;
}

.chat-empty-desc {
  margin: 0;
  color: var(--text-3);
  line-height: 1.5;
}

.msg {
  max-width: 88%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  font-size: var(--font-sm);
  line-height: 1.6;
  word-break: break-word;
  animation: msg-in var(--dur-base) var(--ease-standard);
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg { animation: none; }
}

/* 用户气泡：右对齐，暖金色调 */
.msg-user {
  margin-left: auto;
  background: var(--gold-50);
  border-color: var(--gold-200);
  border-right: 3px solid var(--gold-500);
  color: var(--text-1);
}

/* 助手气泡：左对齐，品牌红色调 */
.msg-assistant {
  margin-right: auto;
  background: var(--surface);
  border-color: var(--line-2);
  border-left: 3px solid var(--brand-500);
}

/* Markdown 渲染后的块级元素不能再吃 pre-wrap */
.msg-body { white-space: pre-wrap; }

.msg-body.is-rich { white-space: normal; }

.msg-body.is-rich > *:first-child { margin-top: 0; }

.msg-body.is-rich > *:last-child { margin-bottom: 0; }

.msg-body.is-rich p { margin: 0 0 var(--space-2); }

.msg-body.is-rich ul, .msg-body.is-rich ol {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-5);
}

.msg-body.is-rich li { margin-bottom: 2px; }

.msg-body.is-rich code {
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--font-xs);
}

.msg-body.is-rich pre {
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}

.msg-body.is-rich pre code { padding: 0; background: none; border: 0; }

.msg-body.is-rich strong { font-weight: 600; }

.msg-body.is-rich h1,
.msg-body.is-rich h2,
.msg-body.is-rich h3,
.msg-body.is-rich h4 {
  margin: var(--space-3) 0 var(--space-2);
  color: var(--text-1);
  font-weight: 600;
  line-height: 1.3;
}

.msg-body.is-rich h1 { font-size: var(--font-lg); }
.msg-body.is-rich h2 { font-size: var(--font-md); }
.msg-body.is-rich h3 { font-size: var(--font-base); }

/* Harness 业务拒绝：HTTP 200 但 ok:false，正常展示但不算成功 */
.msg-refused {
  border-left-color: var(--text-3);
  background: var(--surface-2);
  opacity: .85;
}

/* 正在逐字上屏的气泡。
   光标用一条随内容走动的竖线而不是尾部方块 —— 方块在换行时会掉到下一行开头，
   看起来像多打了一个字。 */
.msg-assistant.is-streaming .msg-body::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--text-3);
  animation: stream-caret 1s steps(2, start) infinite;
}

@keyframes stream-caret {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* 起步占位。模型先想再答，这几秒里必须让人看出「在动」，
   否则用户会以为卡住然后点第二次，于是话被说两遍。 */
.msg-typing {
  color: var(--text-3);
  font-size: var(--font-sm);
}

.msg-typing::after {
  content: '…';
  animation: stream-caret 1.2s steps(2, start) infinite;
}

/* 流中断：字留着（确实收到了），但要显出「没说完」。 */
.msg-incomplete {
  border-left-color: var(--warn, var(--text-3));
}

.msg-incomplete .msg-body::after {
  content: '（未传完）';
  display: block;
  margin-top: var(--space-1);
  color: var(--text-3);
  font-size: var(--font-xs);
}

/* 尊重系统的「减少动态效果」：光标与占位都不闪，但仍在。 */
@media (prefers-reduced-motion: reduce) {
  .msg-assistant.is-streaming .msg-body::after,
  .msg-typing::after {
    animation: none;
  }
}

.msg-role {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--text-3);
  font-size: var(--font-xs);
  font-weight: 600;
}

/* 正在输入指示器 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--text-3);
  font-size: var(--font-xs);
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-4);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .typing-dots span { animation: none; opacity: .7; }
}

.run-status {
  margin: var(--space-2) 0 0;
  min-height: 18px;
  color: var(--text-3);
  font-size: var(--font-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.run-status.busy::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line-2);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .run-status.busy::before { animation-duration: 3s; }
}

/* ---------- 事项执行信息 ---------- */

.work-panel {
  margin-top: var(--space-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  overflow: hidden;
  flex: none;
}

.work-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--line-2);
}

.work-panel-heading h3 {
  margin: 0;
  color: var(--text-1);
  font-size: var(--font-sm);
  font-weight: 600;
}

.work-panel-progress {
  color: var(--text-3);
  font-size: var(--font-xs);
  text-align: right;
}

.work-panel-body { min-width: 0; }

.work-panel-section {
  padding: var(--space-3);
}

.work-panel-section + .work-panel-section {
  padding-top: var(--space-3);
  border-top: 1px solid var(--line-2);
}

.work-panel-section-h {
  margin: 0 0 var(--space-2);
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* 执行步骤列表 */
.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--font-sm);
  color: var(--text-2);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
  background: var(--line-1);
}

.step-item.step-done .step-dot {
  background: var(--success-500);
}

.step-item.step-active .step-dot {
  background: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(199, 62, 54, .15);
}

.step-item.step-done .step-text {
  color: var(--text-3);
  text-decoration: line-through;
}

.step-item.step-active .step-text {
  font-weight: 500;
  color: var(--text-1);
}

.step-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.5;
}

/* 产出物列表 */
.artifact-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.artifact-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  margin-bottom: var(--space-1);
  font-size: var(--font-sm);
  transition: border-color var(--dur-fast) var(--ease-standard);
}

.artifact-item:hover {
  border-color: var(--line-1);
}

.artifact-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-1);
  font-weight: 500;
}

.artifact-type {
  font-size: var(--font-xs);
  color: var(--text-3);
  flex: none;
}

.artifact-empty {
  margin: 0;
  padding: var(--space-2) 0;
}

/* 工作面板元数据 */
.work-panel-meta {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: var(--space-2) var(--space-3);
  margin: 0;
  font-size: var(--font-sm);
}

.work-panel-meta dt {
  color: var(--text-3);
  font-weight: 400;
}

.work-panel-meta dd {
  margin: 0;
  color: var(--text-1);
  word-break: break-word;
}

.work-panel-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.work-panel-actions .btn {
  flex: 1;
}

/* ---------- 一体式消息输入区 ---------- */

.composer {
  flex: none;
  margin-top: var(--space-3);
  padding: var(--space-2);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}

.composer:focus-within {
  border-color: var(--brand-400);
  box-shadow: var(--focus-ring), var(--shadow-sm);
}

.composer textarea {
  width: 100%;
  min-height: 72px;
  max-height: 220px;
  margin: 0;
  padding: var(--space-2);
  border: 0;
  border-radius: calc(var(--radius-xl) - var(--space-1));
  background: transparent;
  box-shadow: none;
  resize: none;
}

.composer textarea:hover { border-color: transparent; }

.composer textarea:focus-visible {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding-top: var(--space-1);
}

.composer-options {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}

.composer-select {
  width: auto;
  max-width: 150px;
  height: 34px;
  padding: 0 28px 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-pill);
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface-2);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  color: var(--text-2);
  font: inherit;
  font-size: var(--font-xs);
  cursor: pointer;
}

.composer-select:hover { background-color: var(--surface-3); }

.composer-select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.composer-shortcut {
  margin-left: auto;
  color: var(--text-4);
  font-size: var(--font-xs);
  white-space: nowrap;
}

.composer-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}

.composer-send:hover:not(:disabled) { background: var(--brand-500); }
.composer-send:active:not(:disabled) { transform: scale(.94); }

.composer-send:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.composer-send:disabled { opacity: .5; cursor: not-allowed; }

.composer-send span {
  position: relative;
  width: 14px;
  height: 14px;
}

.composer-send span::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}

.composer-send span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 6px;
  width: 2px;
  height: 11px;
  border-radius: 1px;
  background: currentColor;
}

.composer-send.is-sending span {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.composer-send.is-sending span::before,
.composer-send.is-sending span::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  .composer-send,
  .top-nav-item { transition: none; }
  .composer-send.is-sending span { animation-duration: 3s; }
}

/* ---------- 待办 / 派活 / 驾驶舱 ----------

   这几个是「独占整宽」的区，跟工作清单/对话那两栏并存不了。
   .workbench 有两种形态：
     solo  = 只显示当前这一个区，占满整宽（待办/派活/驾驶舱）
     默认  = 两栏并排（工作清单/对话）
   形态由 JS 切 .solo 这个类。                        */

/* 🔴 新增独占区必须同时登记这里和 app.js 的 SOLO_PANES。
   漏这一行的后果是它跟工作清单/对话挤在两栏里常驻显示，
   而不是「切过去才出现」—— 页签看着没坏，版面已经乱了。 */
.pane-todos, .pane-assign, .pane-cockpit { display: none; }

.workbench.solo {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.workbench.solo .work-sidebar,
.workbench.solo .mobile-workbench-tabs,
.workbench.solo .pane { display: none; }

.workbench.solo .pane.pane-active { display: flex; }

/* 独占整宽时正文别拉太长，一行几十个字不好读 */
.workbench.solo .pane.pane-active > * {
  max-width: 880px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.todo-groups { min-height: 0; }

.todo-group + .todo-group { margin-top: var(--space-5); }

.todo-day {
  margin: 0 0 var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--line-2);
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.todo-day-count {
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}

.todo-list { list-style: none; margin: 0; padding: 0; }

.todo-card {
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
  cursor: pointer;
}

.todo-card:hover {
  border-color: var(--line-1);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.todo-card:active { transform: translateY(0); }

.todo-card.todo-late {
  border-left-color: var(--warning-500);
}

.todo-card.todo-late .todo-title { color: var(--warning-500); }

.todo-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.todo-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.4;
  word-break: break-word;
}

.todo-head .badge { flex: none; margin-top: 1px; }

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  color: var(--text-3);
  font-size: var(--font-xs);
  margin-bottom: var(--space-2);
}

.todo-meta .todo-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.todo-who { margin: 0; color: var(--text-3); font-size: var(--font-sm); }

.todo-detail {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
}

.todo-detail:empty { display: none; }

.todo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--line-2);
}

.todo-actions .btn { height: 32px; font-size: var(--font-sm); padding: 0 var(--space-3); }

/* 派活表单 */
.assign-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.assign-form label {
  font-size: var(--font-sm);
  color: var(--text-2);
  font-weight: 500;
}

.assign-form .btn {
  align-self: flex-start;
  margin-top: var(--space-2);
  height: 44px;
  padding: 0 var(--space-5);
  font-weight: 600;
}

.assign-form textarea { min-width: 0; }

/* ---------- 驾驶舱 ---------- */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
}

.stat-card:hover {
  border-color: var(--line-1);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card:active { transform: translateY(0); }

.stat-card:focus-visible {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

.stat-card.stat-warn {
  background: var(--warning-100);
  border-color: var(--warning-200);
}

.stat-card.stat-warn:hover {
  border-color: var(--warning-500);
}

.stat-card.stat-ok {
  background: var(--success-100);
  border-color: var(--success-200);
}

.stat-num {
  font-size: var(--font-3xl);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  letter-spacing: -.02em;
}

.stat-card.stat-warn .stat-num { color: var(--warning-500); }
.stat-card.stat-ok .stat-num { color: var(--success-500); }

.stat-label {
  font-size: var(--font-sm);
  color: var(--text-3);
  font-weight: 500;
}

.stat-sub {
  font-size: var(--font-xs);
  color: var(--text-4);
  margin-top: 2px;
}

.stat-rows { min-height: 0; }

/* ERP 主数据只读出口。工具栏照抄工作清单那条的横排规则，
   select 单独固定不收缩，否则它会被 input 挤成一条缝。 */
.erp-block {
  margin-top: var(--space-3);
}

.erp-toolbar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

/* 注意：.select 自带 width:100%，在 flex 行里会把整行吃掉。
   430px 下实测下拉占 406px、搜索框只剩 26px —— 这条 width:auto 是必需的覆盖。 */
.erp-toolbar select {
  flex: 0 0 auto;
  width: auto;
}

.erp-toolbar input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.erp-toolbar .btn {
  flex: 0 0 auto;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard);
  border-radius: var(--radius-sm);
}

.stat-row:hover { background: var(--surface-2); }

.stat-row:last-child { border-bottom: none; }

.stat-row-name {
  flex: none;
  min-width: 96px;
  font-weight: 600;
  color: var(--text-1);
  font-size: var(--font-sm);
}

.stat-row-counts {
  flex: 1;
  min-width: 0;
  color: var(--text-3);
  font-size: var(--font-xs);
  font-variant-numeric: tabular-nums;
}

.stat-row-late {
  flex: none;
  padding: 2px var(--space-2);
  border: 1px solid var(--warning-200);
  border-radius: var(--radius-sm);
  background: var(--warning-100);
  color: var(--warning-500);
  font-size: var(--font-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-row-tip {
  flex: none;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-size: var(--font-xs);
}

/* ---------- 催办提醒条 ---------- */

.nudge-bar {
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--warning-200);
  border-radius: var(--radius);
  background: var(--warning-100);
}

.nudge-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.nudge-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.nudge-chip.nudge-late {
  background: var(--warning-500);
  color: #fff;
}

.nudge-chip.nudge-now {
  border: 1px solid var(--warning-500);
  color: var(--warning-500);
  background: transparent;
}

.nudge-chip.nudge-soon {
  border: 1px solid var(--line-2);
  color: var(--text-3);
  background: var(--surface);
}

.nudge-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nudge-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--font-sm);
  color: var(--text-2);
}

.nudge-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nudge-item-when {
  flex: none;
  color: var(--text-3);
  font-size: var(--font-xs);
  font-variant-numeric: tabular-nums;
}

.nudge-item.nudge-overdue .nudge-item-when {
  color: var(--warning-500);
  font-weight: 600;
}

.hint.hint-warn { color: var(--warning-500); }

/* ---------- 底部 tab 栏 ---------- */

.bottom-nav {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--line-2);
  box-shadow: 0 -1px 2px rgba(21, 2, 1, .04);
  position: relative;
  z-index: 5;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 0;
  border: none;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-standard);
  position: relative;
}

.bottom-tab:hover {
  color: var(--text-1);
}

.bottom-tab:focus-visible {
  outline: none;
  color: var(--brand-600);
}

.bottom-tab.is-active {
  color: var(--brand-600);
  font-weight: 500;
}

.bottom-tab-icon {
  width: 22px;
  height: 22px;
  display: block;
  position: relative;
}

/* 工作台图标：两个矩形代表两栏 */
.bottom-tab[data-pane="tasks"] .bottom-tab-icon::before,
.bottom-tab[data-pane="tasks"] .bottom-tab-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.bottom-tab[data-pane="tasks"] .bottom-tab-icon::before {
  left: 1px;
  width: 6px;
}
.bottom-tab[data-pane="tasks"] .bottom-tab-icon::after {
  right: 1px;
  width: 10px;
}

/* 派活图标：人形+箭头 */
.bottom-tab[data-pane="assign"] .bottom-tab-icon::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.bottom-tab[data-pane="assign"] .bottom-tab-icon::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}

/* 驾驶舱图标：柱状图 */
.bottom-tab[data-pane="cockpit"] .bottom-tab-icon::before {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 2px;
  width: 4px;
  height: 10px;
  background: currentColor;
  border-radius: 1px;
}
.bottom-tab[data-pane="cockpit"] .bottom-tab-icon::after {
  content: "";
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 4px;
  height: 14px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: -6px -4px 0 -1px currentColor;
}

.bottom-tab-label {
  font-size: 10px;
  line-height: 1.2;
}

/* ---------- 页签（保留兼容） ---------- */

.pane-tabs {
  display: flex;
  gap: var(--space-1);
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 var(--space-2);
}

.pane-tabs::-webkit-scrollbar { display: none; }

.pane-tabs .tab {
  font: inherit;
  height: 36px;
  padding: 0 var(--space-3);
  background: transparent;
  color: var(--text-3);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-sm);
  font-weight: 500;
  transition: background-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
  position: relative;
}

.pane-tabs .tab:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

.pane-tabs .tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--brand-400);
}

.pane-tabs .tab[aria-pressed="true"] {
  color: var(--brand-700);
  border-color: var(--line-2);
  background: var(--surface-2);
  font-weight: 600;
}

.pane-tabs .tab[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--brand-600);
  border-radius: 2px 2px 0 0;
}

.tab-icon {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-block;
}

/* ---------- 移动端工作台视图 ---------- */

.mobile-workbench-tabs {
  display: none;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-1);
  padding: var(--space-2);
  background: var(--surface);
  border-bottom: 1px solid var(--line-2);
}

.mobile-workbench-tab {
  height: 36px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
}

.mobile-workbench-tab:hover { color: var(--text-1); background: var(--surface-2); }

.mobile-workbench-tab.is-active {
  color: var(--brand-700);
  background: var(--brand-50);
  font-weight: 600;
}

.mobile-workbench-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- 模态框 ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 2, 1, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  animation: overlay-fade-in var(--dur-base) var(--ease-standard);
}

@keyframes overlay-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-slide-in var(--dur-slow) var(--ease-standard);
}

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay { animation: none; }
  .modal { animation: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line-2);
  flex: none;
}

.modal-title {
  margin: 0;
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-1);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-3);
  transition: background-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard);
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

.modal-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.modal-close span {
  width: 14px;
  height: 14px;
  position: relative;
}

.modal-close span::before,
.modal-close span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.modal-close span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.modal-close span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}

.account-modal { max-width: 460px; }

.account-form .field:last-of-type { margin-bottom: 0; }

.account-meta {
  grid-template-columns: 72px minmax(0, 1fr);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--line-2);
}

.account-form > .hint {
  margin: 0 0 var(--space-4);
}

.account-form .form-error,
.account-form [role="status"] {
  margin-top: var(--space-3);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--line-2);
  flex: none;
}

/* ---------- 响应式 ---------- */

/* 平板档：1024px 以下收窄左栏 */
@media (max-width: 1024px) {
  .workbench {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .pane { padding: var(--space-3); }
}

/* 小屏：一级切换工作 / 对话，工作内部切换工作清单 / 事项 */
@media (max-width: 859px) {
  .topbar {
    flex-wrap: nowrap;
    height: auto;
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
    align-items: center;
  }

  .topbar-title { display: none; }
  .topbar-logo { width: 22px; height: 22px; }

  .top-nav {
    flex: 1;
    height: 44px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

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

  .top-nav-item {
    min-width: 56px;
    padding: 0 var(--space-2);
  }

  .avatar-name { display: none; }

  .avatar-btn {
    width: 36px;
    height: 36px;
    justify-content: center;
    padding: 3px;
  }

  .avatar-caret { display: none; }

  .workbench {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .workbench:not(.solo) .mobile-workbench-tabs { display: grid; }

  .workbench:not(.solo)[data-mobile-view="work"] .work-sidebar { display: flex; }
  .workbench:not(.solo)[data-mobile-view="work"] > .pane-chat { display: none; }
  .workbench:not(.solo)[data-mobile-view="chat"] .work-sidebar { display: none; }
  .workbench:not(.solo)[data-mobile-view="chat"] > .pane-chat { display: flex; }

  .pane { padding: var(--space-3); }
  .pane-chat { padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom)); }

  .work-panel-actions { flex-direction: column; }
  .space-tools { align-items: stretch; }
  .space-tools .select,
  .space-tools input,
  .space-tools .btn { flex: none; width: 100%; }

  /* 移动端头像下拉改为底部抽屉 */
  .avatar-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-3);
    animation: drawer-up var(--dur-slow) var(--ease-standard);
  }

  @keyframes drawer-up {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .avatar-menu { animation: none; }
  }

  .avatar-menu-item {
    padding: var(--space-3);
    font-size: var(--font-base);
  }

  .avatar-menu-divider { margin: var(--space-2) 0; }

  /* iOS Safari 对 <16px 的输入框会自动放大页面 */
  input[type="text"], input[type="password"], textarea, .select {
    font-size: 16px;
    height: 44px;
  }

  textarea { height: auto; min-height: 44px; }

  .btn { height: 44px; }

  .composer-send {
    width: 44px;
    height: 44px;
  }

  .composer-send span {
    width: 18px;
    height: 18px;
  }

  .composer-select {
    min-width: 0;
    max-width: 50%;
    height: 36px;
    font-size: 16px;
  }

  .composer-shortcut { display: none; }

  /* 窄屏：不显示动画，表单退回成一整屏居中的卡片。
     小屏上注意力该全给表单；看不见的动画也不该继续建 DOM、起定时器
     （app.js 认得同一个断点，见 loginSceneEnabled）。
     卡片自己的底、边和投影也在这里补回来 —— 桌面端那层壳负责它们，
     窄屏没有壳了。 */
  .login-shell {
    flex-direction: column;
  }

  .login-scene-wrap { display: none; }

  .login-view {
    background:
      radial-gradient(ellipse at 30% 20%, rgba(199, 62, 54, .06), transparent 55%),
      radial-gradient(ellipse at 70% 80%, rgba(201, 157, 107, .06), transparent 55%),
      var(--bg);
  }

  .login-pane {
    flex: 1 1 auto;
    min-width: 0;
    padding: var(--space-6) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom));
    background: none;
  }

  .login-card {
    padding: var(--space-8) var(--space-6);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .workbench.solo .pane.pane-active > * { max-width: 100%; }

  /* 模态框底部贴边 */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: modal-slide-up var(--dur-slow) var(--ease-standard);
  }

  @keyframes modal-slide-up {
    from {
      transform: translateY(100%);
      opacity: 1;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .modal { animation: none; }
  }
}

/* 桌面端保留完整品牌与顶部主导航。 */
@media (min-width: 860px) {
  .topbar-brand { min-width: 112px; }
}

/* 超窄屏 & 矮屏 */
@media (max-width: 380px) {
  .login-pane {
    padding: var(--space-5) var(--space-4);
  }

  .login-title { font-size: var(--font-lg); }

  .stat-num { font-size: var(--font-2xl); }
}

@media (max-height: 720px) {
  /* 矮屏（笔记本横屏、横过来的手机、老机型竖屏）：把纵向留白收掉，
     让登录页不出现滚动条。底部保留安全区，别让表单压到 home 指示条上。 */
  .login-pane { padding: var(--space-4) var(--space-5) calc(var(--space-4) + env(safe-area-inset-bottom)); }
  .login-logo { margin-bottom: var(--space-2); }
  .login-sub { margin-bottom: var(--space-4); }
}

/* 打印样式 */
@media print {
  .sidebar, .topbar, .bottom-nav, .composer, .worklist-toolbar, .todo-actions,
  .assign-form, .space-tools, .work-panel-actions, .modal-overlay,
  .new-task {
    display: none !important;
  }

  .workbench {
    grid-template-columns: 1fr;
    background: none;
  }

  .pane {
    background: #fff;
    border: none;
    box-shadow: none;
    padding: 0;
  }

  body { background: #fff; color: #000; }
}
