/* Agent Mail · 设计系统（帝国暗色 token · 手写 CSS） */
:root {
  --canvas: #0f172a;
  --sidebar: #0b1220;
  --surface: #1b2637;
  --raised: #26334a;
  --line: #334155;
  --fg: #dbe3ee;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font: 15px/1.65 -apple-system, "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
}
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------------------------------------------------------------- 骨架 */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

/* ---------------------------------------------------------------- 侧栏 */
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--line);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 15.5px; font-weight: 600; padding: 2px 8px; }
.brand a { color: var(--fg); text-decoration: none; }
.brand .ver { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 3px; }

.side-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; padding: 0 8px;
}
.spaces { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }

/* 分组：独立 / 虚空七执政 / 护庭十三队 */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 12px; }
.group-label {
  font-size: 11px; color: var(--muted); letter-spacing: .04em;
  padding: 0 9px 5px; opacity: .9;
  display: flex; align-items: center; gap: 6px;
}
/* 组名左侧细线，弱化但可辨，不与侧栏「空间」总标题抢层级 */
.group-label::before {
  content: ""; width: 3px; height: 3px; border-radius: 50%;
  background: var(--line); flex: none;
}
.whoami-mini { color: var(--muted); }
.space-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: 9px; text-decoration: none;
  font-size: 14px; color: var(--muted);
  border: 1px solid transparent;
}
.space-item:hover { background: var(--surface); color: var(--fg); }
.space-item.on {
  background: var(--surface); color: var(--fg);
  border-color: var(--line);
}
.sname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 🔴 类名勿用 .unread：信件卡片的未读态也叫 unread，会撞车。
   侧栏未读数字徽章统一叫 .pill-count（text-align 可继承，撞名会把整张卡片文字居中）。 */
.pill-count {
  background: #0369a1; color: #e0f2fe; font-size: 11px;
  min-width: 18px; text-align: center; padding: 0 5px;
  border-radius: 999px; line-height: 17px;
}

.avatar {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
  background: var(--raised); color: var(--fg);
}
.avatar.big { width: 42px; height: 42px; border-radius: 12px; font-size: 19px; }
.avatar.amber { background: #78350f; color: #fcd34d; }
.avatar.sky   { background: #0c4a6e; color: #7dd3fc; }
.avatar.green { background: #14532d; color: #86efac; }
.avatar.red   { background: #7f1d1d; color: #fca5a5; }
.avatar.slate { background: #1e293b; color: #94a3b8; }
.avatar.teal  { background: #134e4a; color: #5eead4; }
.avatar.violet{ background: #4c1d95; color: #c4b5fd; }
.avatar.orange{ background: #7c2d12; color: #fdba74; }
.avatar.pink  { background: #831843; color: #f9a8d4; }

.side-foot {
  font-size: 11.5px; color: var(--muted); padding: 8px;
  border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px;
}
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

/* ---------------------------------------------------------------- 主区 */
.main { padding: 20px 26px 48px; max-width: 980px; }
.space-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.who { display: flex; align-items: center; gap: 12px; }
.who-txt h1 { font-size: 20px; margin: 0; font-weight: 600; }
.who-txt p { margin: 2px 0 0; }

.tabs { display: flex; gap: 4px; }
.tab {
  color: var(--muted); text-decoration: none; font-size: 14px;
  padding: 6px 16px; border-radius: 9px; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--fg); background: var(--surface); }
.tab.on { color: var(--accent); background: var(--surface); border-color: var(--line); }
.tab-badge {
  background: #0369a1; color: #e0f2fe; font-size: 11px;
  min-width: 17px; text-align: center; padding: 0 5px;
  border-radius: 999px; line-height: 16px;
}

/* ---------------------------------------------------------------- 提示条 */
.flash { border-radius: 9px; padding: 8px 14px; font-size: 13px; margin-bottom: 14px; }
.flash.ok  { background: #052e16; border: 1px solid #14532d; color: #86efac; }
.flash.bad { background: #450a0a; border: 1px solid #7f1d1d; color: #fca5a5; }

/* ---------------------------------------------------------------- 子筛选 */
.subtabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.subtab {
  font-size: 12.5px; padding: 4px 12px; border-radius: 999px;
  text-decoration: none; color: var(--muted);
  border: 1px solid var(--line); background: transparent;
}
.subtab:hover { color: var(--fg); background: var(--surface); }
.subtab.on { color: var(--fg); background: var(--raised); border-color: var(--accent); }

/* ---------------------------------------------------------------- 邮件列表 */
.maillist { display: flex; flex-direction: column; gap: 8px; }
.mail {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 16px;
}
.mail.unread { border-left: 3px solid var(--accent); }
.mail-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.mail-from { font-size: 13.5px; font-weight: 600; color: var(--fg); }
.mail-to { font-size: 12.5px; color: var(--muted); }
.mail-subject { font-size: 14.5px; margin: 2px 0 4px; color: var(--fg); }
.mail.unread .mail-subject { font-weight: 600; }
.mail-snippet {
  font-size: 13px; color: var(--muted); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.mail-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
}
.mail-time { font-size: 11.5px; color: var(--muted); margin-left: auto; }

.badge {
  display: inline-block; padding: 0 7px; border-radius: 999px;
  font-size: 11px; line-height: 1.7; border: 1px solid transparent;
}
.badge.sky   { background: #082f49; color: #7dd3fc; border-color: #0c4a6e; }
.badge.slate { background: #1e293b; color: #94a3b8; border-color: #334155; }
.badge.green { background: #052e16; color: #86efac; border-color: #14532d; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  appearance: none; cursor: pointer; font-family: inherit;
  background: #0369a1; color: #e0f2fe; border: 1px solid transparent;
  font-size: 13px; padding: 5px 14px; border-radius: 8px;
}
.btn:hover { background: #0284c7; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--fg); }
.btn.ghost:hover { background: var(--raised); }
.btn.small { font-size: 12px; padding: 3px 10px; }
.btn.danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; }
.btn.danger:hover { background: #450a0a; }

/* ---------------------------------------------------------------- 空态 */
.empty {
  border: 1px dashed var(--line); border-radius: 12px;
  padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13.5px;
}
.empty strong { display: block; font-size: 14.5px; color: var(--fg); margin-bottom: 6px; }

/* ---------------------------------------------------------------- 写信 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.input, .textarea, .select {
  width: 100%; background: var(--canvas); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font-family: inherit; font-size: 14px;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
}
.textarea { min-height: 220px; resize: vertical; line-height: 1.7; }

/* ---------------------------------------------------------------- 文件柜 */
.cabinet { display: flex; flex-direction: column; gap: 8px; }
.fileitem {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 15px;
}
.fext {
  width: 36px; height: 36px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
  background: var(--raised); color: var(--muted); text-transform: uppercase;
}
/* 图片缩略图：与 .fext 同尺寸，点了新窗预览 */
.thumb {
  width: 36px; height: 36px; border-radius: 8px; flex: none;
  overflow: hidden; background: var(--raised);
  border: 1px solid var(--line); display: block;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.factions { display: flex; align-items: center; gap: 6px; flex: none; }
.fmeta { flex: 1; min-width: 0; }
.fname {
  font-size: 14px; color: var(--fg); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.fname:hover { color: var(--accent); }
.fsub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.uploader {
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.uploader input[type=file] { color: var(--muted); font-size: 13px; flex: 1; min-width: 200px; }
/* 原生文件控件在暗色下默认白底，与主题冲突——改为 token 配色 */
.uploader input[type=file]::file-selector-button {
  background: var(--raised); color: var(--fg);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 13px; font-family: inherit; font-size: 13px;
  cursor: pointer; margin-right: 10px;
}
.uploader input[type=file]::file-selector-button:hover { background: #2f3f5a; }

/* ---------------------------------------------------------------- 信件详情 */
.crumb { margin-bottom: 12px; font-size: 13px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.letter {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 20px 24px;
}
.letter-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.letter-subject {
  font-size: 19px; font-weight: 600; margin: 0 0 10px;
  line-height: 1.45; word-break: break-word;
}
.letter-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}
.letter-meta .mail-from { color: var(--fg); font-weight: 600; font-size: 13.5px; }
.arrow-to { color: var(--muted); }

/* 正文：保留换行与空白，长词强制折行，避免撑破容器 */
.letter-body {
  padding: 18px 0 6px;
  font-size: 15px; line-height: 1.85;
  white-space: pre-wrap; word-break: break-word;
  color: var(--fg);
}
.letter-atts { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 10px; }
.letter-atts h3 { font-size: 14px; margin: 0 0 10px; }
.letter-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 16px; margin-top: 14px;
}
.panel-thread { margin-top: 18px; }
.mail.current { border-color: var(--accent); }
.mail-subject a { color: inherit; text-decoration: none; }
.mail-subject a:hover { color: var(--accent); }

/* 写信页 · 附件挑选 */
.attach-pick summary { cursor: pointer; padding: 4px 0; }
.attach-pick summary:hover { color: var(--fg); }
.picklist {
  margin-top: 8px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 9px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.pick {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 9px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.pick:hover { background: var(--raised); }
.pick input { accent-color: var(--accent); }
.pick-name {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.pick-size { flex: none; font-size: 11.5px; }

/* ---------------------------------------------------------------- 登录页 */
/* 独立布局：不继承 .shell 的侧栏，避免登录页出现导航骨架 */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 15px; padding: 28px 26px;
}
.login-brand {
  display: flex; align-items: center; gap: 13px; margin-bottom: 22px;
}
.login-mark {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: #0c4a6e; color: #7dd3fc;
  font-size: 15px; font-weight: 600; letter-spacing: .02em;
}
.login-brand h1 { font-size: 18px; margin: 0; font-weight: 600; }
.login-brand p { margin: 2px 0 0; }
.login-btn { width: 100%; padding: 9px; font-size: 14px; margin-top: 4px; }

/* 顶栏右侧的登录状态 */
.whoami {
  font-size: 12px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.whoami a { color: var(--muted); text-decoration: none; }
.whoami a:hover { color: var(--danger); }

/* ---------------------------------------------------------------- 响应式 */
/* 见文件末尾 —— 移动端规则必须放在**最后**，否则会被后面同优先级的
   普通规则（.side-link / .space-item 等）覆盖掉，等于没写。 */

/* ---------------------------------------------------------------- 通讯录 */
/* 侧栏底部入口（在空间列表之外，全局页） */
.side-links { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: 9px; text-decoration: none;
  font-size: 13.5px; color: var(--muted);
  border: 1px solid transparent;
}
.side-link:hover { background: var(--surface); color: var(--fg); }
.side-link.on { background: var(--surface); color: var(--accent); border-color: var(--line); }
/* 三横线图标：纯 CSS 画，不依赖字体/emoji（不同系统渲染不一致） */
.side-ico {
  width: 14px; height: 10px; flex: none; opacity: .8;
  background: repeating-linear-gradient(
    to bottom, currentColor 0 1.5px, transparent 1.5px 4.25px);
}

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 20px; margin: 0 0 3px; font-weight: 600; }
.page-head p { margin: 0; }
code.inline {
  background: var(--raised); border-radius: 5px; padding: 1px 5px;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
}

.dir-group { margin-bottom: 20px; }
.dir-group-title {
  font-size: 12px; color: var(--muted); font-weight: 500;
  letter-spacing: .04em; margin: 0 0 8px;
  display: flex; align-items: center; gap: 6px;
}
.dir-group-title::before {
  content: ""; width: 3px; height: 3px; border-radius: 50%;
  background: var(--line); flex: none;
}
.dir-list { display: flex; flex-direction: column; gap: 6px; }
.dir-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 15px;
}
.dir-main { flex: 1; min-width: 0; }
.dir-name {
  font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.dir-duty {
  font-size: 12.5px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dir-addr { flex: none; display: flex; align-items: center; gap: 7px; font-size: 12px; }
.addr-label { color: var(--muted); }
.dir-addr code {
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 8px; font-size: 12px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dir-help {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 20px;
}
.dir-help h3 { font-size: 14px; margin: 0 0 8px; }
.dir-help p { margin: 0; }
.dir-help pre {
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; margin: 10px 0 0;
  font-size: 12.5px; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--fg);
}

/* ---------------------------------------------------------------- 别名 */
/* 全名旁边的短称呼：显示层级弱于名字，读起来是「备注」不是「标题」 */
.alias-tag {
  font-size: 11.5px; font-weight: 400; color: var(--muted);
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px;
  letter-spacing: 0; vertical-align: middle;
  white-space: nowrap;
}
.alias-tag::before { content: "别名 "; opacity: .55; }

/* ================================================================ 移动端
   手机上侧栏不能占满一屏（原样式 height:100vh + 竖排 11 席 = 把主内容
   挤到屏幕外）。改成顶部两行式：
     第 1 行：品牌 | 通讯录
     第 2 行：所有席位的头像条，横向滑动，分组用竖线分隔
   🔴 必须放在文件最末尾：同优先级的普通规则写在后面会覆盖这里的设定。
   ================================================================ */
@media (max-width: 780px) {
  /* min-height:100vh 会让两行被平分，中间留出一大块空白；
     align-content:start 让行按内容高度分配，多余空间留在页面底部。 */
  .shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
  /* 🔴 grid 子项默认 min-width:auto，会被内容固有宽度撑破。
     席位条横排后固有宽度约 800px，不压住就会让整页横向溢出——
     右侧内容被推出视口、通讯录链接「消失」，全是这一个原因。 */
  .shell > * { min-width: 0; }
  /* 同理，侧栏内部这个 grid 也要压住：.spaces 是它的子元素，
     11 席横排的固有宽度会把列撑到 800px，通讯录就被排到屏幕外了。 */
  .sidebar > * { min-width: 0; }

  .sidebar {
    position: sticky; top: 0; z-index: 30;
    height: auto; padding: 8px 10px; gap: 6px;
    /* 🔴 .shell 有 min-height:100vh，侧栏作为 grid 子项默认 align-self:stretch，
       会被拉高、行高被平分（实测行高 120px 全是空白）。必须顶到上方按内容收缩。 */
    align-self: start;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "spaces";
    align-items: center;
    border-right: none; border-bottom: 1px solid var(--line);
  }

  .brand { grid-area: brand; padding: 0; font-size: 14px; }
  .brand .ver { display: none; }          /* 小屏省地方，版本号不关键 */

  /* 席位条：横向滚动，纵向别溢出 */
  .spaces {
    grid-area: spaces;
    flex-direction: row; gap: 4px;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
    padding-bottom: 1px;
  }
  .spaces::-webkit-scrollbar { display: none; }

  .nav-group { flex-direction: row; gap: 4px; flex: none; }
  /* 分组之间用小竖线分隔，标题文字在横条里太占地方 */
  .nav-group + .nav-group {
    margin-top: 0; margin-left: 4px; padding-left: 8px;
    border-left: 1px solid var(--line);
  }
  .group-label { display: none; }

  .space-item {
    flex: none; gap: 6px; padding: 5px 8px;
    font-size: 12.5px; border-radius: 8px;
  }
  .avatar { width: 22px; height: 22px; font-size: 11px; border-radius: 7px; }
  .avatar.big { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
  .sname { flex: none; max-width: 84px; }   /* 超出省略，横条不被长全名撑爆 */
  .pill-count { min-width: 16px; font-size: 10px; line-height: 15px; }

  /* 侧栏底部两个入口（总览 / 通讯录）整组钉在右上角。
     单个 side-link 定位会互相重叠，所以定位的是外层容器。 */
  .side-links {
    position: absolute; right: 10px; top: 6px;
    flex-direction: row; gap: 2px;
  }
  .side-link {
    padding: 4px 8px; font-size: 12px; gap: 5px;
  }
  .side-foot { display: none; }             /* 地址在手机上没信息量 */

  /* 主区 */
  .main { padding: 14px 13px 44px; max-width: none; }
  .space-head { flex-wrap: wrap; gap: 10px; align-items: flex-start; }
  .space-head h1 { font-size: 18px; }
  .tabs { flex: 1 1 100%; width: auto; min-width: 0; }
  .tab { flex: 1; justify-content: center; padding: 6px 10px; }
  .subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .subtabs::-webkit-scrollbar { display: none; }
  .subtab { flex: none; }

  /* 信件卡片 */
  .mail { padding: 12px 13px; }
  .mail-subject { font-size: 14.5px; }
  .mail-foot { flex-wrap: wrap; gap: 6px; }
  .mail-time { margin-left: auto; }

  /* 通讯录卡片：地址换到下一行，别把名字挤没 */
  .dir-card { flex-wrap: wrap; gap: 8px 10px; padding: 12px 13px; }
  .dir-main { flex: 1 1 100%; }
  .dir-addr { flex: 1 1 100%; justify-content: flex-start; }
  .dir-help { padding: 14px 15px; }
  .dir-help pre { font-size: 11.5px; }
}

/* 更窄（<= 420px）：再收一档 */
@media (max-width: 420px) {
  .sname { max-width: 60px; }
  .main { padding: 12px 10px 40px; }
  .space-head h1 { font-size: 17px; }
  .subtab { font-size: 12px; padding: 5px 9px; }
}

/* ---------------------------------------------------------------- 全部收件箱 */
.ov-list { display: flex; flex-direction: column; gap: 6px; }
.ov-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 15px;
  text-decoration: none; color: inherit;
  transition: background .12s, border-color .12s;
}
.ov-card:hover { background: var(--raised); border-color: var(--line-strong); }
/* 有未读 → 左边一道亮边，扫一眼就知道哪几席积压 */
.ov-card.has-unread { border-left: 3px solid #0ea5e9; padding-left: 13px; }

.ov-main { flex: 1; min-width: 0; }
.ov-name {
  font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.ov-last {
  font-size: 12.5px; color: var(--muted); margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; white-space: nowrap;
}
.ov-from { flex: none; color: var(--fg); opacity: .75; }
.ov-subj { overflow: hidden; text-overflow: ellipsis; }
.ov-time { flex: none; margin-left: auto; font-size: 11.5px; opacity: .65; }

.ov-stat {
  flex: none; display: flex; flex-direction: column;
  align-items: flex-end; gap: 1px; min-width: 74px;
}
.ov-unread { font-size: 18px; font-weight: 700; color: #7dd3fc; line-height: 1.2; }
.ov-unread small { font-size: 11px; font-weight: 400; margin-left: 2px; opacity: .8; }
.ov-zero { font-size: 12.5px; color: var(--muted); }
.ov-total { font-size: 11.5px; color: var(--muted); opacity: .7; }

/* ================================================================ 待办（v0.9.0）
   收件箱＝给你的信 / 文件柜＝给你的文件 / 待办＝要你过目核对的悬置事项。
   视觉上用琥珀色区分于未读的蓝：蓝色＝没看过，琥珀＝要你拍板。
   ================================================================ */

/* 补充徽章色（原有只有 sky / slate / green） */
.badge.amber { background: #422006; color: #fcd34d; border-color: #78350f; }
.badge.red   { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
.tab-badge.warn, .pill-count.warn { background: #78350f; color: #fde68a; }

.todo-intro { margin: -4px 0 14px; }
.todolist { display: flex; flex-direction: column; gap: 8px; }

.todo {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 16px;
}
/* 左侧一道边＝状态色，扫一眼就知道哪条还挂着 */
.todo.st-pending    { border-left: 3px solid #0ea5e9; padding-left: 14px; }
.todo.st-agent_done { border-left: 3px solid var(--warn); padding-left: 14px; }
.todo.st-confirmed  { border-left: 3px solid var(--ok); padding-left: 14px; opacity: .82; }
.todo.st-rejected   { border-left: 3px solid var(--danger); padding-left: 14px; opacity: .82; }

.todo-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.todo-title {
  font-size: 14.5px; font-weight: 600; margin: 0;
  flex: 1 1 220px; min-width: 0; word-break: break-word;
}
.todo-time { font-size: 11.5px; color: var(--muted); margin-left: auto; flex: none; }

.todo-body {
  font-size: 13.5px; color: var(--muted); line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; margin-top: 6px;
}
/* 长说明折叠：summary 里只留一段摘要，展开后摘要让位给全文 */
.todo-more { margin-top: 6px; }
.todo-more summary { cursor: pointer; list-style: none; }
.todo-more summary::-webkit-details-marker { display: none; }
.todo-snippet { font-size: 13.5px; color: var(--muted); }
.more-tip { font-size: 11.5px; color: var(--accent); margin-left: 6px; white-space: nowrap; }
.todo-more[open] .todo-snippet,
.todo-more[open] .more-tip { display: none; }

.todo-line {
  font-size: 12.5px; color: var(--muted); margin-top: 8px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--canvas); border-left: 2px solid var(--line);
  white-space: pre-wrap; word-break: break-word;
}
.todo-line b { color: var(--fg); font-size: 11.5px; margin-right: 8px; }
.todo-line.ok { border-left-color: var(--ok); }
.todo-line.no { border-left-color: var(--danger); }

.todo-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line);
}
.todo-src {
  font-size: 12px; color: var(--muted); text-decoration: none;
  background: var(--raised); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.todo-src:hover { color: var(--accent); }

.verdict-form {
  display: flex; align-items: center; gap: 6px; margin: 0;
  flex: 1 1 300px; min-width: 0; flex-wrap: wrap;
}
.note-input {
  flex: 1 1 130px; min-width: 110px; width: auto;
  padding: 4px 9px; font-size: 12.5px;
}

/* 席动作折叠：老板只是偶尔替席清场，不该跟「核对/否决」抢视线 */
.todo-ops { flex: none; }
.todo-ops summary {
  font-size: 12px; color: var(--muted); cursor: pointer; list-style: none;
  padding: 3px 9px; border: 1px solid var(--line); border-radius: 7px;
}
.todo-ops summary::-webkit-details-marker { display: none; }
.todo-ops summary:hover { color: var(--fg); background: var(--raised); }
.todo-ops[open] summary { color: var(--fg); background: var(--raised); }
.todo-ops[open] { flex: 1 1 100%; }
.ops-body {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px;
}
.ops-body form { display: flex; align-items: center; gap: 6px; margin: 0; }
.ops-note { width: 190px; padding: 4px 9px; font-size: 12.5px; }
.todo-meta { font-size: 11.5px; color: var(--muted); opacity: .75; }

/* 全局页：顶部三个数字（待核对 / 已核对 / 已否决） */
.tstat { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tstat-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 12px;
}
.tstat-item b { font-size: 16px; color: #7dd3fc; line-height: 1.2; }
.tstat-item.ok b { color: #86efac; }
.tstat-item.no b { color: #fca5a5; }
.tstat-item:hover { background: var(--raised); }
.tstat-item.on { border-color: var(--accent); }

.todo-group { margin-bottom: 20px; }
.todo-group-title {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; font-size: 14px; font-weight: 600;
}
.todo-group-title a { color: var(--fg); text-decoration: none; }
.todo-group-title a:hover { color: var(--accent); }
.todo-group-count { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 400; }

/* 待办的移动端规则必须留在**全文件最末尾**：
   上面的普通规则写在媒体查询之后，同优先级会盖掉媒体查询里的设定。 */
@media (max-width: 780px) {
  /* 侧栏底部三个入口在窄屏挤成一排：去掉装饰性横线图标（三个一模一样，
     没有信息量），只留短文字，给「待办」徽章腾地方。 */
  .side-link .side-ico { display: none; }
  .side-links { right: 8px; gap: 1px; }
  .side-link { padding: 4px 6px; font-size: 11.5px; gap: 4px; }
  .side-link .pill-count { min-width: 15px; font-size: 10px; line-height: 14px; padding: 0 4px; }

  .todo, .todo.st-pending, .todo.st-agent_done,
  .todo.st-confirmed, .todo.st-rejected { padding: 11px 11px 11px 11px; }
  .todo.st-pending, .todo.st-agent_done,
  .todo.st-confirmed, .todo.st-rejected { padding-left: 11px; }
  /* 手机上徽章与标题同行（标题自己折行），时间缩到右上角小字，省一行高度 */
  .todo-top { gap: 7px; }
  .todo-title { flex: 1 1 auto; min-width: 0; }
  .todo-time { flex: 0 0 auto; margin-left: auto; font-size: 10.5px; }
  .todo-src { max-width: 100%; }
  /* 批注框和两个结论按钮整行排开，指头点得准 */
  .verdict-form { flex: 1 1 100%; }
  .note-input { flex: 1 1 100%; }
  .todo-ops { flex: 1 1 100%; margin-left: 0; }
  .todo-ops summary { display: inline-block; }
  .ops-note { width: 100%; }
  .ops-body { width: 100%; }
  .ops-body form { flex: 1 1 100%; }
  .todo-group-title { flex-wrap: wrap; }
  .todo-group-count { flex: 1 1 100%; margin-left: 0; }
}


