/* ==========================================================================
   shell.css — 统一外壳：侧栏 / 顶栏 / 内容区 / 浮层 / 登录页
   ========================================================================== */

* { box-sizing: border-box; }

/* hidden 必须真的隐藏。
   本文件里有多个类声明了 display:flex（.yi-shell / .yi-login-wrap / .yi-env-bar…），
   它们的特异性**高于**浏览器默认的 [hidden]{display:none}，
   于是「JS 设了 hidden」的元素仍然占位 —— 表现为页面顶部凭空多出一大片空白，
   而且肉眼找不到原因（元素本身看不见）。这一条是兜底，别删。 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--text-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 键盘可达性：只给键盘焦点画框，鼠标点击不画 */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ============================ 外壳骨架 ============================ */

.yi-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- 侧栏 ---------- */

.yi-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-right: 1px solid var(--line-1);
  z-index: 20;
  transition: width 0.16s ease;
}

/* 顶部 3px 域色标识条：一眼知道在哪个后台 */
.yi-sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brand);
}

.yi-sb-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 14px 12px;
  min-height: 62px;
}

.yi-sb-logo {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
  letter-spacing: -0.02em;
}

.yi-sb-name {
  min-width: 0;
}
.yi-sb-name b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yi-sb-name span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 工作台切换器（分段控件） ----------
   双域账号才出现。为什么是分段而不是下拉：
     · 下拉要两次点击（展开 → 选），而「财务/售后」切换是每天几十次的动作；
     · 旧下拉展开后会出现「客服售后 当前」「财务对账」两行按钮，
       看着像两个并排按钮，用户会以为上面那行是标题（实际截图就是这样）。
   分段控件把「现在在哪」和「还能去哪」压成一行，一次点击完成。 */
.yi-sb-switch {
  display: flex;
  gap: 2px;
  margin: 0 10px 12px;
  padding: 3px;
  border-radius: 10px;
  background: #f1f4f6;
  border: 1px solid rgba(16, 24, 40, .05);
}

.yi-seg {
  flex: 1;
  min-width: 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s, box-shadow .12s;
}
.yi-seg > span:first-of-type {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yi-seg .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  opacity: .55;
  transition: opacity .12s, transform .12s;
}
.yi-seg:hover:not(.is-on) {
  background: rgba(255, 255, 255, .72);
  color: var(--text-1);
}
.yi-seg:hover:not(.is-on) .dot { opacity: 1; }

/* 当前段：白底 + 细阴影，配色仍靠域色圆点表达，不整块染域色（会太吵） */
.yi-seg.is-on {
  background: #fff;
  /* 当前段用域色文字：白底 + 浅阴影在浅灰底上区分度太弱，
     用户需要「一眼看出现在在哪个台」。 */
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .10), 0 0 0 1px rgba(16, 24, 40, .04);
}
.yi-seg.is-on .dot { opacity: 1; box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }

/* 对方域的待办角标 */
.yi-seg .n {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

/* 折叠态：只留圆点，宽度 64px 时还能看出在哪个域 */
body.yi-sb-collapsed .yi-sb-switch { flex-direction: column; margin: 0 8px 10px; }
body.yi-sb-collapsed .yi-seg { height: 26px; }
body.yi-sb-collapsed .yi-seg > span { display: none; }
body.yi-sb-collapsed .yi-seg .dot { width: 8px; height: 8px; }

/* ---------- 菜单 ---------- */

.yi-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 16px;
  scrollbar-width: thin;
}
.yi-nav::-webkit-scrollbar { width: 6px; }
.yi-nav::-webkit-scrollbar-thumb { background: #d6dae3; border-radius: 3px; }

.nav-group {
  padding: 14px 10px 6px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  margin-bottom: 1px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-md);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, color 0.1s;
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text-1); text-decoration: none; }
.nav-item.active {
  background: var(--brand-weak);
  color: var(--brand);
  font-weight: 500;
}
/* 当前项左侧 3px 竖条：比整块高亮克制，且不抢眼 */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--brand);
}
.nav-item i {
  flex: none;
  width: 18px;
  text-align: center;
  font-style: normal;
  font-size: 14px;
  opacity: 0.85;
}
.nav-item span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.nav-item .badge:empty { display: none; }

/* ---------- 侧栏底部 ---------- */

.yi-sb-foot {
  border-top: 1px solid var(--line-2);
  padding: 12px 16px 14px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.6;
}
.yi-sb-foot .ver-line { margin-top: 4px; }
.yi-sb-foot .ver-line a { color: var(--text-2); }

/* ---------- 折叠态 ---------- */

body.yi-sb-collapsed .yi-sidebar { width: var(--sidebar-w-collapsed); }
body.yi-sb-collapsed .yi-sb-name,
body.yi-sb-collapsed .yi-sb-switch,
body.yi-sb-collapsed .nav-group,
body.yi-sb-collapsed .nav-item span,
body.yi-sb-collapsed .yi-sb-foot { display: none; }
body.yi-sb-collapsed .yi-sb-brand { padding: 20px 0 14px; justify-content: center; }
body.yi-sb-collapsed .nav-item { justify-content: center; padding: 0; }
body.yi-sb-collapsed .nav-item .badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 8px; height: 8px; padding: 0; font-size: 0;
}
body.yi-sb-collapsed .yi-main { margin-left: var(--sidebar-w-collapsed); }

/* ---------- 主区 ---------- */

.yi-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.16s ease;
}

.yi-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line-1);
}

.yi-tb-collapse {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-2);
  cursor: pointer; font-size: 14px;
}
.yi-tb-collapse:hover { background: var(--bg-subtle); }

.yi-tb-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  /* 标题吃掉所有剩余空间：左标题 / 右（工具 + 用户）才是稳定布局。
     之前靠两个 margin-left:auto 互相挤，工具区为空时用户区就掉到标题旁边
     （截图里「超级管理员」紧贴着「工作台」）。 */
  flex: 1 1 auto;
}
.yi-tb-title h2 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 域徽标：顶栏里最稳定的身份提示 */
.yi-tb-domain {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--brand-weak);
  color: var(--brand);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.yi-tb-domain .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* 只读徽标：仅 viewer 出现，灰底不可关 */
.yi-tb-readonly {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: var(--fs-xs);
  font-weight: 500;
}

/* 顶栏工具区（财务模块往里塞「导出 / 筛选」等按钮）。
   ⚠️ 这里必须用 id 选择器：财务的 styles.css 里写的是 `.topbar-tools`，
   而外壳渲染的 class 也叫 .topbar-tools —— 两边同名同特异性，
   谁后加载谁生效，结果就是「有时有样式、有时没有」。
   用 #topbarTools 把间距与自动靠右锁死，按钮内部样式仍交给财务样式表。 */
#topbarTools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
  flex-wrap: wrap;
}
#topbarTools:empty { display: none; }

.yi-tb-right {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  /* 不再写 margin-left:auto：与 #topbarTools 同时 auto 会把顶栏劈成三段，
     工具按钮飘到中间。靠右由 #topbarTools 负责，这里只留间距。 */
  margin-left: 8px;
}

.yi-tb-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.12s;
}
.yi-tb-user:hover { background: var(--bg-subtle); }
.yi-tb-user .yi-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  display: grid; place-items: center;
  flex: none;
}
.yi-tb-user .who { line-height: 1.25; min-width: 0; }
.yi-tb-user .who b { display: block; font-size: var(--fs-sm); font-weight: 500; }
.yi-tb-user .who span { display: block; font-size: var(--fs-xs); color: var(--text-3); }

/* 角色名前面的域色小点 */
.yi-role-dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: 1px;
}

/* ---------- 内容区 ---------- */

.yi-content {
  flex: 1;
  min-width: 0;
  padding: var(--sp-5);
}
.yi-content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}
#view { min-height: 300px; }

/* 切域时的过渡态：宁可给一句「正在切换」，也不要让用户看着空白以为卡死 */
.yi-stage-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
  color: var(--text-3);
  font-size: 13px;
}
.yi-sp {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(13, 148, 136, .2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: yi-spin .7s linear infinite;
}
@keyframes yi-spin { to { transform: rotate(360deg); } }

/* 无权限 / 空状态 */
.yi-empty {
  max-width: 520px;
  margin: 64px auto;
  text-align: center;
  color: var(--text-2);
}
.yi-empty .icon {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  display: grid; place-items: center;
  font-size: 22px;
  color: var(--text-3);
}
.yi-empty h3 { margin: 0 0 6px; font-size: var(--fs-lg); color: var(--text-1); font-weight: 600; }
.yi-empty p { margin: 0 0 4px; font-size: var(--fs-md); line-height: 1.7; }

/* ============================ 登录页 ============================ */

.yi-login-wrap {
  min-height: 100vh;
  /* 用 flex 而不是 grid + place-items：
     grid 的 justify-items:center 会让卡片按 max-content 收窄，
     而我们需要 width:100% + max-width 的「窄屏铺满、宽屏 400px」。 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #e8eefc 0%, transparent 60%),
    radial-gradient(900px 460px at 95% 110%, #e6f6f3 0%, transparent 55%),
    var(--bg-page);
}

.yi-login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px 30px 26px;
}

.yi-login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.yi-login-logo {
  width: 40px; height: 40px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--fi) 0%, var(--as) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: grid; place-items: center;
  flex: none;
}
.yi-login-brand h1 {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.yi-login-brand p {
  margin: 3px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.yi-login-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-subtle);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.yi-login-tabs button {
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.yi-login-tabs button[aria-selected="true"] {
  background: var(--bg-card);
  color: var(--text-1);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.yi-login-form { display: block; }
.yi-login-form[hidden] { display: none; }

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}
.field input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  background: var(--bg-card);
  font: inherit;
  font-size: var(--fs-md);
  color: var(--text-1);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-weak);
}
.field .hint {
  margin-top: 5px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.6;
}

.yi-btn-primary,
.yi-btn-ghost {
  height: 38px;
  border-radius: var(--r-md);
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.yi-btn-primary {
  width: 100%;
  border: 0;
  background: var(--brand);
  color: #fff;
}
.yi-btn-primary:hover { filter: brightness(0.94); }
.yi-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.yi-btn-ghost {
  width: 100%;
  border: 1px solid var(--line-1);
  background: var(--bg-card);
  color: var(--text-1);
}
.yi-btn-ghost:hover { background: var(--bg-subtle); }

.yi-login-msg {
  min-height: 18px;
  margin-top: 12px;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--danger);
}
.yi-login-msg.ok { color: var(--ok); }
.yi-login-msg.info { color: var(--text-2); }

.yi-login-foot {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.7;
  text-align: center;
}

/* 环境条（测试版常驻，登录页也可见） */
.yi-env-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 6px 14px;
  background: #fff8e6;
  border-bottom: 1px solid #f2d98d;
  font-size: var(--fs-sm);
  color: #7a4d00;
}
.yi-env-bar .env-tag {
  padding: 1px 7px;
  border-radius: 4px;
  background: #b54708;
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 600;
}
/* 环境条实际高度 33px（padding 6+6 + 行高 21），留 1px 余量。
   写 30 会盖住顶栏上沿 3px —— 顶上那条橙边就是这么被切掉半截的。 */
body.yi-env-test { padding-top: 34px; }
body.yi-env-test .yi-sidebar { top: 34px; }
body.yi-env-test .yi-topbar { top: 34px; }

/* ============================ 浮层 ============================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: #101828;
  color: #fff;
  font-size: var(--fs-md);
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease;
}
.toast[hidden] { display: none; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.drawer-mask,
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.32);
  backdrop-filter: blur(1px);
}
.drawer-mask { z-index: var(--z-drawer); }
.modal-mask { z-index: var(--z-modal); display: grid; place-items: center; padding: 24px; }
.drawer-mask[hidden],
.modal-mask[hidden] { display: none; }

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: calc(var(--z-drawer) + 1);
  width: min(720px, 100vw);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}
.drawer[hidden] { display: none; }

.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

/* ============================ 响应式 ============================ */

/* 侧栏在窄屏变成抽屉：财务表格需要横向空间 */
@media (max-width: 900px) {
  .yi-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  body.yi-sb-open .yi-sidebar { transform: translateX(0); }
  body.yi-sb-open .yi-scrim { display: block; }
  .yi-main { margin-left: 0; }
  body.yi-sb-collapsed .yi-main { margin-left: 0; }
  .yi-content { padding: var(--sp-4); }
  .yi-topbar { padding: 0 12px; }
  .yi-tb-user .who { display: none; }
}

.yi-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(16, 24, 40, 0.32);
}

@media (max-width: 640px) {
  .yi-content { padding: var(--sp-3); }
  .yi-login-card { padding: 24px 20px 20px; border-radius: var(--r-lg); }
}

/* 打印：去掉外壳，只留内容（财务报表要能直接打印） */
@media print {
  .yi-sidebar, .yi-topbar, .yi-scrim, .toast, .drawer-mask { display: none !important; }
  .yi-main { margin-left: 0 !important; }
  .yi-content { padding: 0 !important; }
  body { background: #fff; }
}

/* ==========================================================================
   作用域修正（必须放在模块 CSS 之后生效：靠特异性压制，不靠加载顺序）
   --------------------------------------------------------------------------
   财务模块自己也定义了 .nav-item，两边类名相同。
   `.yi-nav .nav-item` 特异性 (0,2,0) 高于 `.nav-item` (0,1,0)，
   所以无论模块 CSS 什么时候加载，外壳的菜单样式都稳定生效。
   这里保留 .nav-item 这个类名而不改它，是因为财务的 App.go() 会按
   `#nav .nav-item` 反查当前项，改类名等于改它的运行时依赖。
   ========================================================================== */
.yi-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  margin-bottom: 1px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: 400;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}
.yi-nav .nav-item:hover { background: var(--bg-subtle); color: var(--text-1); }
.yi-nav .nav-item.active {
  background: var(--brand-weak);
  color: var(--brand);
  font-weight: 500;
}
.yi-nav .nav-item i { width: 18px; text-align: center; font-size: 14px; color: inherit; opacity: .8; }
.yi-nav .nav-item.active i { color: var(--brand); opacity: 1; }

/* 浮层用 id 选择器兜底：
   财务与售后各有一套 .toast / .drawer / .modal，深色浅色都不一样。
   外壳在「模块样式尚未加载」的瞬间（登录页、首次切换）也要能弹出提示，
   所以用 id 写一份基准样式。id 特异性更高，模块样式不会把它冲掉，
   但模块自己的浮层元素（不带这些 id）仍用自己的样式。 */
#toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: var(--z-toast); max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: var(--r-md);
  background: #101828; color: #fff; font-size: var(--fs-md); line-height: 1.5;
  box-shadow: var(--shadow-lg);
}
#toast[hidden] { display: none; }
#toast.err { background: var(--danger); }
#toast.ok  { background: var(--ok); }

#drawerMask { position: fixed; inset: 0; background: rgba(16,24,40,.32); z-index: var(--z-drawer); }
#drawerMask[hidden] { display: none; }
#drawer {
  position: fixed; inset: 0 0 0 auto; z-index: calc(var(--z-drawer) + 1);
  width: min(720px, 100vw); background: var(--bg-card); box-shadow: var(--shadow-lg);
  overflow-y: auto;
}
#drawer[hidden] { display: none; }
#modalMask { position: fixed; inset: 0; background: rgba(16,24,40,.32); z-index: var(--z-modal); display: grid; place-items: center; padding: 24px; }
#modalMask[hidden] { display: none; }
#modal { width: min(520px, 100%); max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--bg-card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }

/* 售后模块用 #toast-root 堆叠多条提示，外壳只给定位。 */
.yi-toast-root { position: fixed; top: 74px; right: 22px; z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 10px; }

/* ==========================================================================
   成员与邀请面板 / 用户下拉菜单
   ========================================================================== */

.yi-user-menu {
  position: fixed;
  z-index: calc(var(--z-modal) + 5);
  min-width: 200px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.yi-user-menu[hidden] { display: none !important; }
.yi-user-menu .who {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 6px;
}
.yi-user-menu .who b { display: block; font-size: var(--fs-md); }
.yi-user-menu .who span { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.yi-user-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  font: inherit;
  font-size: var(--fs-md);
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
}
.yi-user-menu button:hover { background: var(--bg-subtle); }
.yi-user-menu button[data-do="logout"] { color: var(--danger); }

.yi-people-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, .38);
  backdrop-filter: blur(2px);
}
.yi-people-mask[hidden] { display: none !important; }

.yi-people {
  width: min(920px, 100%);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.yi-people-head {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-1);
}
.yi-people-head h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.yi-people-x {
  margin-left: auto;
  width: 28px; height: 28px;
  border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-3);
  font-size: 14px; cursor: pointer;
}
.yi-people-x:hover { background: var(--bg-subtle); color: var(--text-1); }

.yi-people-tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-1);
}
.yi-people-tabs button {
  position: relative;
  padding: 11px 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--fs-md);
  color: var(--text-2);
  cursor: pointer;
}
.yi-people-tabs button[aria-selected="true"] {
  color: var(--brand);
  font-weight: 500;
}
.yi-people-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: var(--brand);
  border-radius: 1px 1px 0 0;
}
.yi-people-tabs em {
  font-style: normal;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.yi-people-tabs em:empty { display: none; }

.yi-people-body { padding: 16px 20px 20px; overflow-y: auto; }

.yi-people-hint {
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.7;
}

.yi-people-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-2);
  font-size: var(--fs-md);
}
.yi-people-empty .icon {
  width: 44px; height: 44px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok);
  display: grid; place-items: center;
  font-size: 20px;
}
.yi-people-empty b { display: block; color: var(--text-1); margin-bottom: 4px; }
.yi-people-empty p { margin: 0; font-size: var(--fs-sm); color: var(--text-3); }
.yi-people-empty.err { color: var(--danger); }

.yi-people-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.yi-people-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 1px solid var(--line-1);
  white-space: nowrap;
}
.yi-people-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.yi-people-table tr:hover td { background: #fbfcfd; }
.yi-people-table td.act { text-align: right; white-space: nowrap; }
.yi-people-table td.dim { color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap; }
.yi-people-table .mono { font-family: var(--font-mono); font-size: var(--fs-sm); }

.yi-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  color: var(--text-1);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.yi-btn:hover { background: var(--bg-subtle); }
.yi-btn:disabled { opacity: .5; cursor: not-allowed; }
.yi-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.yi-btn.primary:hover { filter: brightness(.94); }
.yi-btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.yi-btn.ok:hover { filter: brightness(.94); }
.yi-btn.warn2 { color: var(--danger); border-color: #f3c7c3; }
.yi-btn.warn2:hover { background: var(--danger-bg); }
.yi-btn.block { width: 100%; height: 36px; font-size: var(--fs-md); }

.yi-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.yi-tag.ok { background: var(--ok-bg); color: var(--ok); }
.yi-tag.warn { background: var(--warn-bg); color: var(--warn); }
.yi-tag.danger { background: var(--danger-bg); color: var(--danger); }

.yi-select, .yi-input {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  font: inherit;
  font-size: var(--fs-md);
  color: var(--text-1);
}
.yi-select:focus, .yi-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-weak);
}

.yi-invite-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: end;
}
.yi-invite-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.yi-invite-form .yi-btn.block { grid-column: 1 / -1; }

.yi-invite-result {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--brand-line);
  border-radius: var(--r-md);
  background: var(--brand-weak);
}
.yi-invite-result b { font-size: var(--fs-md); }
.yi-invite-result .link {
  margin: 8px 0;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  word-break: break-all;
  user-select: all;
}
.yi-invite-result .dim { margin: 0 0 10px; font-size: var(--fs-sm); color: var(--text-2); }
.yi-invite-result .mono { font-family: var(--font-mono); }

.yi-temp-pwd {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--brand-line);
  border-radius: var(--r-md);
  background: var(--brand-weak);
}
.yi-temp-pwd b { font-size: var(--fs-md); }
.yi-temp-pwd .code {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: .04em;
  user-select: all;
}
.yi-temp-pwd p { margin: 0 0 10px; font-size: var(--fs-sm); color: var(--text-2); }
.yi-temp-pwd .row { display: flex; gap: 8px; }

/* ==========================================================================
   修改密码 / 编辑资料弹窗
   ========================================================================== */

.yi-pwd-mask {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 10);
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, .42);
  backdrop-filter: blur(2px);
}
.yi-pwd-mask[hidden] { display: none !important; }

.yi-pwd {
  width: min(420px, 100%);
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.yi-pwd header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-1);
}
.yi-pwd header h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.yi-pwd-x {
  margin-left: auto;
  width: 28px; height: 28px;
  border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-3);
  font-size: 14px; cursor: pointer;
}
.yi-pwd-x:hover { background: var(--bg-subtle); color: var(--text-1); }

.yi-pwd-body { padding: 18px 20px 4px; }

.yi-pwd-notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--warn-bg);
  color: #7a4d00;
  font-size: var(--fs-sm);
  line-height: 1.7;
}
.yi-pwd-notice strong { font-weight: 600; }

.yi-field {
  display: block;
  margin-bottom: 14px;
}
.yi-field > span {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}
.yi-field .yi-input { width: 100%; height: 38px; font-size: var(--fs-md); }

.yi-pwd-row { display: flex; gap: 8px; }
.yi-pwd-row .yi-input { flex: 1; }
.yi-pwd-row .yi-btn { height: 38px; flex: none; }

.yi-pwd-strength {
  margin: -4px 0 10px;
  font-size: var(--fs-sm);
  min-height: 18px;
}
.yi-pwd-strength .dim { color: var(--text-3); }

.yi-pwd-err {
  margin-bottom: 10px;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.yi-pwd-err[hidden] { display: none !important; }

.yi-pwd footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line-2);
}
.yi-pwd footer .yi-btn { height: 34px; padding: 0 16px; font-size: var(--fs-md); }

/* 成员表里的「待改密」小标 */
.yi-tag.warn-soft {
  background: var(--warn-bg);
  color: var(--warn);
  margin-left: 4px;
}

/* 行内编辑表单 */
.yi-edit-grid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px 12px;
  align-items: center;
}
.yi-edit-grid > span {
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.yi-edit-grid .yi-input,
.yi-edit-grid .yi-select { width: 100%; height: 36px; }

/* ==========================================================================
   备份提醒条（售后域，管理员，每天一次）
   --------------------------------------------------------------------------
   为什么不做成 modal：它会盖住整个界面，用户切到售后第一下点菜单点不动。
   提醒的价值远低于「立刻能操作」，所以做成右下角一条，不挡任何东西。
   ========================================================================== */

.yi-bk-banner {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 40px));
  padding: 11px 12px 11px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(16, 24, 40, .10);
  box-shadow: 0 10px 30px rgba(16, 24, 40, .14);
  animation: yi-bar-in .2s ease-out;
}
@keyframes yi-bar-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.yi-bk-banner .i { font-size: 15px; line-height: 1; flex: none; }
.yi-bk-banner .t {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
}
.yi-bk-banner .t .d { font-size: 11.5px; color: var(--text-3); }

.yi-bk-banner .b {
  flex: none;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line-1);
  border-radius: 7px;
  background: #fff;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.yi-bk-banner .b:hover { background: var(--bg-subtle); color: var(--text-1); }
.yi-bk-banner .b.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 500;
}
.yi-bk-banner .b.primary:hover { filter: brightness(1.05); }

@media (max-width: 560px) {
  .yi-bk-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-wrap: wrap;
  }
  .yi-bk-banner .t { flex: 1 1 100%; }
}

/* ==========================================================================
   3.0 「Paper」外壳
   --------------------------------------------------------------------------
   这一版刻意**不再用深色侧栏**。深色侧栏 + 白色卡片 + 渐变按钮，是 AI 生成
   后台最常见的三件套；真正做过产品的人会把"结构"做轻，把"信息"做重。

   所以这里：
   · 侧栏不再是另一块颜色，而是同底色的一条"轨道"，只靠一道 1px 细线分隔；
     当前项是一张**白纸片**（surface + 细线 + 极浅阴影），像贴在轨道上。
   · 顶栏 56px，同底色 + 半透明模糊，只有一条细线。焦点的搜索框常驻在右侧，
     它是这个产品最"现代"的一件东西：⌘K 直接跳到任何页面。
   · 全站阴影只有三档，且卡片默认**没有**阴影 —— 靠细线和留白分层。
   ========================================================================== */

/* ---------- 画布 ---------- */
body {
  background: var(--canvas);
  color: var(--ink);
  font-size: var(--t-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 所有数字走等宽：对账、单号、时间列扫起来不跳 */
.num, .mono, .tbl td.num, .stat .v, .kpi .val { font-variant-numeric: tabular-nums; }

/* ---------- 侧栏（轨道） ---------- */
.yi-sidebar {
  width: var(--rail-w);
  background: color-mix(in srgb, var(--surface-2) 55%, var(--canvas));
  border-right: 1px solid var(--line);
  box-shadow: none;
  overflow: hidden;
}
.yi-sidebar::before, .yi-sidebar::after { content: none; }

.yi-sb-brand {
  padding: 16px 16px 12px;
  min-height: 60px;
  gap: 9px;
}
.yi-sb-logo {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .18);
}
.yi-sb-name b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.yi-sb-name span {
  color: var(--ink-3);
  font-size: 11px;
  margin-top: 1px;
}

/* 域切换：两个字的胶囊，选中项是白纸片 */
.yi-sb-switch { margin: 0 12px 10px; }
.yi-seg {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.yi-seg > span:first-of-type { color: var(--ink-2); font-size: 11.5px; }
.yi-seg.is-on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(24, 24, 27, .06), 0 0 0 1px transparent;
  font-weight: 600;
}
.yi-seg.is-on .dot { background: var(--accent); box-shadow: none; }
.yi-seg .dot { width: 5px; height: 5px; }
.yi-seg .n {
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10.5px;
  padding: 0 5px;
}

/* 导航 */
.yi-nav {
  padding: 2px 8px 10px;
  gap: 1px;
}
.yi-nav::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.nav-group {
  padding: 12px 8px 5px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-item {
  height: 32px;
  padding: 0 8px;
  gap: 9px;
  border-radius: 7px;
  color: var(--ink-2);
  font-size: var(--t-md);
  font-weight: 450;
  transition: background var(--d-1) var(--ease), color var(--d-1) var(--ease);
}
.nav-item i {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  background: none;
  color: var(--ink-3);
  font-size: 15px;
  border-radius: 0;
  transition: color var(--d-1) var(--ease);
}
.nav-item i svg { width: 16px; height: 16px; }
.nav-item:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
}
.nav-item:hover i { background: none; color: var(--ink-2); }

/* 当前项 = 一张白纸片，贴在轨道上 */
.nav-item.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 550;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(24, 24, 27, .05);
}
.nav-item.active i { background: none; color: var(--accent); box-shadow: none; }
.nav-item.active::before { content: none; }

.nav-item .badge {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: none;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
}

/* 侧栏底部 */
.yi-sb-foot {
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  margin-top: auto;
}
.yi-sb-foot .engine { color: var(--ink-3); font-size: 10.5px; line-height: 1.55; }
.yi-sb-foot .ver-line { color: var(--ink-3); margin-top: 2px; }
.yi-sb-foot .ver-line a { color: var(--ink-2); }
.yi-sb-foot .btn {
  height: 28px;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  box-shadow: none;
}
.yi-sb-foot .btn:hover {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

/* 折叠态 */
body.yi-sb-collapsed .yi-sidebar { width: var(--rail-w-collapsed); }
body.yi-sb-collapsed .yi-main { margin-left: var(--rail-w-collapsed); }
body.yi-sb-collapsed .nav-item { height: 34px; justify-content: center; padding: 0; }
body.yi-sb-collapsed .nav-item i { width: 18px; height: 18px; }
body.yi-sb-collapsed .nav-item i svg { width: 17px; height: 17px; }

/* ---------- 顶栏 ---------- */
.yi-topbar {
  height: var(--topbar-h);
  padding: 0 20px 0 14px;
  gap: 10px;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}
.yi-tb-collapse {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--ink-3);
  font-size: 13px;
}
.yi-tb-collapse:hover { background: var(--surface-3); color: var(--ink); }

.yi-tb-title { gap: 8px; }
.yi-tb-title h2 {
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.yi-tb-domain {
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: none;
}
.yi-tb-domain .dot {
  width: 5px; height: 5px;
  background: var(--accent);
  box-shadow: none;
}
.yi-tb-readonly {
  background: var(--warn-weak);
  color: var(--warn);
  font-size: 10.5px;
  border-radius: 5px;
  box-shadow: none;
}

/* 右侧动作组：搜索胶囊 + 两个图标按钮 + 用户 */
.yi-tb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.yi-tb-search {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 8px 0 10px;
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
  transition: border-color var(--d-1) var(--ease), box-shadow var(--d-1) var(--ease);
}
.yi-tb-search .ico { display: grid; place-items: center; color: var(--ink-3); }
.yi-tb-search .ph { flex: 1; text-align: left; }
.yi-tb-search kbd {
  font-family: var(--font);
  font-size: 10px;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}
.yi-tb-search:hover { border-color: var(--line-strong); box-shadow: var(--sh-1); }

.yi-tb-icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--d-1) var(--ease), border-color var(--d-1) var(--ease);
}
.yi-tb-icon:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.yi-accent-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, #fff 55%, transparent);
}

.yi-tb-user {
  padding: 3px 8px 3px 3px;
  border-radius: 8px;
  gap: 7px;
  border: 1px solid transparent;
}
.yi-tb-user:hover {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--sh-1);
}
.yi-tb-user .yi-avatar {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  box-shadow: none;
}
.yi-tb-user .who b { font-size: 12px; font-weight: 600; color: var(--ink); }
.yi-tb-user .who span { font-size: 10.5px; color: var(--ink-3); }
.yi-role-dot { width: 5px; height: 5px; }

/* ---------- 内容 ---------- */
.yi-content { padding: 20px 24px 40px; }
.yi-content-inner { max-width: var(--content-max); }

#view { animation: viewIn var(--d-2) var(--ease-out) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 外观浮层 ---------- */
.yi-pop {
  position: fixed;
  z-index: var(--z-modal);
  width: 296px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--sh-3);
  animation: popIn var(--d-2) var(--ease-out) both;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.yi-pop-h {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.yi-pop-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.yi-pop-k { width: 44px; flex: none; font-size: 12px; color: var(--ink-2); }
.yi-pop-hint { font-size: 10.5px; color: var(--ink-3); margin: -2px 0 12px 54px; }
.yi-seg-sm {
  display: flex;
  flex: 1;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border-radius: 7px;
}
.yi-seg-sm button {
  flex: 1;
  height: 24px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}
.yi-seg-sm button.on {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--sh-1);
}
.yi-pop-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.yi-dot {
  position: relative;
  width: 22px; height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--c, var(--surface-2));
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(24, 24, 27, .12);
  transition: transform var(--d-1) var(--ease);
}
.yi-dot:hover { transform: scale(1.08); }
.yi-dot.on::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--c);
}
.yi-dot.custom {
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 13px;
  overflow: hidden;
  cursor: pointer;
}
.yi-dot.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.yi-dot.custom span { pointer-events: none; }

/* ---------- 命令面板 ⌘K ---------- */
body.cmdk-open { overflow: hidden; }
.cmdk-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-palette);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: color-mix(in srgb, var(--ink) 26%, transparent);
  backdrop-filter: blur(3px);
  animation: cmdkFade var(--d-1) var(--ease) both;
}
.cmdk-mask.is-closing { animation: cmdkOut var(--d-1) var(--ease) both; }
@keyframes cmdkFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cmdkOut { to { opacity: 0; } }

.cmdk {
  width: min(620px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--sh-3);
  overflow: hidden;
  animation: cmdkIn var(--d-2) var(--ease-out) both;
}
@keyframes cmdkIn {
  from { opacity: 0; transform: translateY(-6px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.cmdk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
.cmdk-mag { color: var(--ink-3); font-size: 15px; }
.cmdk-bar input {
  flex: 1;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  font-size: 14.5px;
  color: var(--ink);
}
.cmdk-bar input::placeholder { color: var(--ink-3); }
kbd {
  font-family: var(--font);
  font-size: 10px;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.cmdk-list {
  max-height: min(48vh, 420px);
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin;
}
.cmdk-group {
  padding: 10px 8px 5px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.cmdk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--t-md);
  text-align: left;
  cursor: pointer;
}
.cmdk-row.on { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.cmdk-row.on .cmdk-ico { color: var(--accent); }
.cmdk-ico {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  color: var(--ink-3);
  flex: none;
}
.cmdk-ico svg { width: 16px; height: 16px; }
.cmdk-dot { width: 12px; height: 12px; border-radius: 50%; display: block; }
.cmdk-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-h { font-size: 11px; color: var(--ink-3); }
.cmdk-empty { padding: 28px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.cmdk-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 34px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
}
.cmdk-foot kbd { margin-right: 3px; }
.cmdk-brand { margin-left: auto; }

/* ---------- 登录页 ---------- */
.yi-login-wrap {
  background:
    radial-gradient(720px 420px at 50% -10%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 70%),
    radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--accent) 6%, transparent) 0%, transparent 60%),
    var(--canvas);
}
.yi-login-wrap::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 70% at 50% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(120% 70% at 50% 0%, #000 0%, transparent 70%);
  pointer-events: none;
}
.yi-login-card {
  position: relative;
  max-width: 392px;
  padding: 30px 28px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--sh-3);
}
.yi-login-brand { margin-bottom: 20px; gap: 11px; }
.yi-login-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .2);
}
.yi-login-brand h1 { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.yi-login-brand p { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.yi-login-tabs {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 18px;
}
.yi-login-tabs button {
  height: 28px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.yi-login-tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--sh-1);
}

.yi-login-form .field { margin-bottom: 12px; }
.yi-login-form .field > label { font-size: 12px; color: var(--ink-2); font-weight: 500; margin-bottom: 5px; }
.yi-login-form input,
.yi-login-form .field input {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
}
.yi-login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
  outline: none;
}
.yi-btn-primary {
  height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .12);
  transition: filter var(--d-1) var(--ease), box-shadow var(--d-1) var(--ease);
}
.yi-btn-primary:hover { filter: brightness(1.06); box-shadow: 0 2px 6px rgba(24, 24, 27, .16); }
.yi-btn-ghost { height: 38px; border-radius: 8px; }
.yi-login-foot {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-3);
}

/* ---------- 顶部提示条叠放 ---------- */
body.has-update { padding-top: 38px; }
body.has-update .yi-env-bar { top: 38px; }
body.has-update .yi-sidebar,
body.has-update .yi-topbar { top: 38px; }
/* 环境条高度由 JS 量出来写进 --envbar-h（手机会折行，不是固定 30/32） */
body.yi-env-test { padding-top: var(--envbar-h, 32px); }
body.yi-env-test .yi-sidebar,
body.yi-env-test .yi-topbar { top: var(--envbar-h, 32px); }
body.yi-env-test.has-update { padding-top: calc(var(--envbar-h, 32px) + 38px); }
body.yi-env-test.has-update .yi-sidebar,
body.yi-env-test.has-update .yi-topbar { top: calc(var(--envbar-h, 32px) + 38px); }
.update-bar { height: 38px; background: var(--accent); color: var(--accent-fg); box-shadow: none; }
.upd-tag { background: rgba(255, 255, 255, .9); color: var(--accent-ink); }
.upd-btn { background: #fff; color: var(--accent-ink); }

/* ---------- 备份提醒条 ---------- */
.yi-bk-banner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: var(--sh-3);
  color: var(--ink);
  font-size: 12.5px;
}
.yi-bk-banner .d { color: var(--ink-3); }
@media (max-width: 560px) {
  .yi-bk-banner { left: 10px; right: 10px; bottom: 10px; padding: 10px 12px; gap: 8px; align-items: center; }
  .yi-bk-banner .t { flex: 1 1 auto; font-size: 12px; line-height: 1.5; }
  .yi-bk-banner .d { display: none; }
  .yi-bk-banner .b { height: 28px; padding: 0 10px; font-size: 12px; }
}

/* ---------- 手机：顶栏收窄 ---------- */
@media (max-width: 900px) {
  .yi-tb-search { min-width: 0; width: 30px; padding: 0; justify-content: center; }
  .yi-tb-search .ph, .yi-tb-search kbd { display: none; }
  .yi-content { padding: 16px 14px 32px; }
}

/* 备份提醒条里的两个按钮：原来写死白底，深色下是一块白斑 */
.yi-bk-banner .b {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.yi-bk-banner .b:hover { background: var(--surface-2); color: var(--ink); }
.yi-bk-banner .b.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-fg);
}
.yi-bk-banner .b.primary:hover { filter: brightness(1.07); }

/* 侧栏轨道再压深一点：和内容区拉出层次，但仍保持浅色 */
.yi-sidebar { background: color-mix(in srgb, var(--surface-2) 78%, var(--canvas)); }
html[data-theme="dark"] .yi-sidebar { background: color-mix(in srgb, var(--surface-2) 60%, var(--canvas)); }

/* 命令面板输入框：全局 input:focus 会画一圈强调色描边，放在面板顶栏里很脏 */
.cmdk-bar input:focus { box-shadow: none; border: 0; outline: none; }
.cmdk-bar input::placeholder { color: var(--ink-3); }
