/* ==========================================================================
   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: 10px;
  padding: 20px 16px 14px;
  min-height: 64px;
}

.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: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  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 {
  margin: 0 10px 10px;
}
.yi-sb-switch-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-1);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.yi-sb-switch-btn:hover { background: var(--bg-hover); border-color: var(--line-1); }
.yi-sb-switch-btn .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); flex: none;
}
.yi-sb-switch-btn .grow { flex: 1; text-align: left; }
.yi-sb-switch-btn .arrow { color: var(--text-3); font-size: 10px; }

/* 切换器展开的菜单 */
.yi-sb-switch-menu {
  margin-top: 6px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.yi-sb-switch-menu[hidden] { display: none; }
.yi-sb-switch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  font-size: var(--fs-sm);
  color: var(--text-1);
  cursor: pointer;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.yi-sb-switch-item:hover { background: var(--bg-subtle); }
.yi-sb-switch-item[aria-current="true"] { background: var(--brand-weak); font-weight: 500; }
.yi-sb-switch-item .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.yi-sb-switch-item .n {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- 菜单 ---------- */

.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;
}
.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;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}
.topbar-tools:empty { display: none; }

.yi-tb-right {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.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-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;
}
body.yi-env-test { padding-top: 30px; }
body.yi-env-test .yi-sidebar { top: 30px; }
body.yi-env-test .yi-topbar { top: 30px; }

/* ============================ 浮层 ============================ */

.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; }
