/* 账号与权限层的外观：侧栏用户卡与菜单、权限显隐、提示条、修改密码弹窗。
 *
 * 与 supplier-ui-auth.js 配套使用，页面里要放在其它样式之后引入，
 * 这样用户卡的配色才能盖住基础样式里的写死色值。
 */

/* 未登录时先藏住正文，避免跳登录页前闪一下内容。
   auth.js 在确认已登录后会摘掉 auth-locked。 */
html.auth-locked body{visibility:hidden!important}

/* ── 权限显隐 ────────────────────────────────────────────────────────
   角色与权限写在 <html> 上（auth.js 的 applyFlags），所以 JS 动态生成的
   元素也能靠这几条规则收起来，不必逐个改渲染函数。
   页面里只要给按钮加 data-perm="权限键" 即可。 */
html[data-perm-export="0"] [data-perm~="export"],
html[data-perm-category="0"] [data-perm~="category"],
html[data-perm-write_marketing="0"] [data-perm~="write_marketing"],
html[data-perm-write_products="0"] [data-perm~="write_products"],
html[data-perm-write_business="0"] [data-perm~="write_business"],
html[data-perm-delete_records="0"] [data-perm~="delete_records"]{display:none!important}
html[data-admin="0"] [data-admin-only]{display:none!important}

/* ── 侧栏「后台管理」上的待审核角标 ────────────────────────────────
   注册申请是别人提交的，管理员不主动进后台就发现不了，
   所以在侧栏这个入口上挂一个数字（auth.js 的 injectAdminNav）。 */
.nav a .nav-badge{margin-left:auto;flex:none;display:grid;place-items:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;
  background:#e2705f;color:#fff;font-size:10px;font-weight:700;letter-spacing:0;line-height:1}

/* ── 顶栏右上角的账号入口 ──────────────────────────────────────────
   顶栏原来放着两个圆形按钮（⌕ 搜索、♧ 梅花符号），梅花那个其实是占了个头像位。
   现在只留一个头像：显示当前登录人姓名的首字（auth.js 的 paintTopAvatar），
   配色与侧栏用户卡的 .avatar 一致（浅蓝底 + 深蓝字）。点开是侧栏那套账号菜单。
   没有脚本时退回一个人形线稿，不会变成一个空圈。
   注意它是 <button>：按钮 UA 样式要清掉（padding / 字体 / 行高），否则字会被挤歪。 */
.top-avatar{flex:none;width:32px;height:32px;margin:0;padding:0;border-radius:50%;border:1px solid #cfe1ff;background:#e2f0ff;color:#2b74ce;
  display:grid;place-items:center;font-size:12px;font-weight:700;letter-spacing:0;line-height:1;font-family:inherit;
  cursor:pointer;user-select:none;-webkit-appearance:none;appearance:none;transition:background .16s,border-color .16s,box-shadow .16s}
.top-avatar:hover{background:#d6e9ff;border-color:#a9cdfd}
.top-avatar:focus-visible{outline:2px solid #2d80ef;outline-offset:2px}
.top-avatar[aria-expanded="true"]{background:#d6e9ff;border-color:#87bcfb;box-shadow:0 0 0 3px #dceaff}
.top-avatar svg{width:17px;height:17px;stroke-width:1.7}

/* 顶栏菜单：向下展开、右对齐到头像右边缘（侧栏那份是从下往上、左右撑满的）。 */
.top-right{position:relative}
.top-right .profile-menu{left:auto;right:0;top:calc(100% + 10px);bottom:auto;min-width:186px;z-index:95}

/* ── 侧栏用户卡 ──────────────────────────────────────────────────── */
.profile{position:relative;z-index:2}
.profile-wrap{position:relative;flex:1;min-width:0}
.profile-button{display:flex;align-items:center;gap:10px;width:100%;padding:7px 8px;border:1px solid transparent;border-radius:11px;background:transparent;color:inherit;text-align:left;transition:background .16s,border-color .16s}
.profile-button:hover{background:#7ba7ff1f;border-color:#9dc0ff2e}
.profile.is-open .profile-button{background:#7ba7ff26;border-color:#9dc0ff45}
.profile-text{flex:1;min-width:0}
.profile-text b{display:block;font-size:12px;font-weight:700;color:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-text small{display:block;font-size:10px;color:inherit;opacity:.66;margin-top:2px}
.profile-caret{flex:none;font-size:12px;line-height:1;color:inherit;opacity:.55;transition:transform .16s}
.profile.is-open .profile-caret{transform:rotate(180deg)}

.profile-menu{position:absolute;left:0;right:0;bottom:calc(100% + 9px);background:#fff;border:1px solid #e2eaf6;border-radius:13px;box-shadow:0 16px 38px #1b457727;padding:6px;z-index:90}
.profile-menu[hidden]{display:none!important}
.profile-menu-head{padding:9px 11px 10px;border-bottom:1px solid #eef3fa;margin-bottom:5px}
.profile-menu-head b{display:block;font-size:12px;font-weight:700;color:#273d5a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-menu-head small{display:block;font-size:10px;color:#93a4ba;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-menu-item{display:flex;align-items:center;gap:9px;width:100%;padding:9px 11px;border:0;border-radius:9px;background:transparent;color:#3d5878;font-size:12px;font-weight:600;text-align:left;text-decoration:none;cursor:pointer;font-family:inherit}
.profile-menu-item:hover{background:#f2f7ff;color:#1f6fd8}
.profile-menu-item svg{width:15px;height:15px;flex:none;color:#6f93c4}
.profile-menu-item.is-danger:hover{background:#fff2f1;color:#d0574c}
.profile-menu-item.is-danger svg{color:#d9897f}

/* ── 权限提示 ────────────────────────────────────────────────────── */
.auth-toast{position:fixed;left:50%;bottom:38px;transform:translateX(-50%);background:#22364f;color:#fff;font-size:12px;font-weight:600;padding:11px 18px;border-radius:10px;box-shadow:0 14px 30px #10233c3d;z-index:200}
.auth-toast[hidden]{display:none!important}

/* ── 修改密码弹窗 ────────────────────────────────────────────────── */
.auth-dialog-overlay{position:fixed;inset:0;background:#102a4b99;backdrop-filter:blur(3px);z-index:130;display:grid;place-items:center;padding:24px}
.auth-dialog{position:relative;width:min(392px,100%);background:#fff;border:1px solid #e2eaf6;border-radius:16px;box-shadow:0 30px 80px #0a254560;overflow:hidden}
.auth-dialog-close{position:absolute;right:16px;top:14px;width:28px;height:28px;border:0;border-radius:50%;background:#eef6ff;color:#477fbf;font-size:19px;line-height:1;cursor:pointer}
.auth-dialog-close:hover{background:#e2f0ff;color:#2678e6}
.auth-dialog-top{padding:22px 26px 14px;border-bottom:1px solid #eef3fa}
.auth-dialog-top small{font-size:9px;color:#6c9cd6;letter-spacing:.15em;font-weight:700}
.auth-dialog-top h2{font-size:19px;color:#22385a;margin:7px 0 0;letter-spacing:-.02em}
.auth-dialog-top p{color:#91a1b5;font-size:10px;margin:8px 0 0}
.auth-dialog-form{padding:16px 26px 20px;display:grid;gap:12px}
.auth-dialog-form label{display:block;font-size:11px;font-weight:700;color:#506680}
.auth-dialog-form input{display:block;width:100%;height:38px;margin-top:7px;padding:0 12px;border:1px solid #dce6f2;border-radius:8px;background:#fbfdff;color:#2f4c6c;font-size:11px;font-weight:500;font-family:inherit;outline:none}
.auth-dialog-form input:focus{border-color:#5b9df0;box-shadow:0 0 0 3px #e6f2ff;background:#fff}
.auth-dialog-error{margin:0;color:#d9695f;font-size:10px;font-weight:600}
.auth-dialog-error[hidden]{display:none!important}
.auth-dialog-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:4px}
.auth-dialog-actions button{border:1px solid #dce6f2;border-radius:8px;background:#fff;color:#4d668a;font-size:11px;font-weight:700;padding:10px 15px;cursor:pointer;font-family:inherit}
.auth-dialog-actions button:hover{border-color:#b6d0f2;color:#2f6bb5}
.auth-dialog-actions button.primary{background:#267cf3;border-color:#267cf3;color:#fff;box-shadow:0 4px 10px #287cf334}
.auth-dialog-actions button.primary:hover{background:#1a6fe4;color:#fff}
/* 「需要管理员权限」弹窗：复用上面改密码弹窗的壳，只多了中间那一段事实列表。
   两列是刻意的（标签固定 78px、右边跟着内容换行）——竖着排长短不一时右边界会参差不齐。
   z-index 要比产品弹窗（100）高、比分享面板（150）低：它常是站在产品弹窗里打开的。 */
.auth-permission-overlay{z-index:140}
.auth-dialog-facts{margin:0;padding:15px 26px 17px;display:grid;gap:9px}
.auth-dialog-facts div{display:grid;grid-template-columns:78px minmax(0,1fr);gap:12px;align-items:start}
.auth-dialog-facts dt{font-size:11px;font-weight:700;color:#8b9cb2;line-height:1.5}
.auth-dialog-facts dd{margin:0;font-size:11px;font-weight:600;color:#2f4c6c;line-height:1.5;overflow-wrap:anywhere}
/* 头部：图标座 + 文案两栏（覆盖 .auth-dialog-top 的 padding，其余继承） */
.auth-dialog-head{display:flex;gap:13px;align-items:flex-start;padding:22px 26px 16px}
.auth-dialog-badge{flex:none;width:36px;height:36px;border-radius:11px;background:#eaf4ff;color:#3a86e8;display:grid;place-items:center}
.auth-dialog-badge svg{width:19px;height:19px}
.auth-dialog-headtext{min-width:0}
/* 底部行动栏：一句说明 + 一颗按钮并排。原来的「知道了」是孤零零飘在右下角的实心蓝块，
   左边一大片留白，看着突兀；放进这条有浅底和上细线的栏里，和说明并排，视线才有依托。 */
.auth-dialog-foot{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:13px 26px 17px;border-top:1px solid #eef3fa;background:#fbfdff}
.auth-dialog-note{margin:0;flex:1 1 auto;min-width:0;color:#7d92ac;font-size:10.5px;font-weight:600;line-height:1.6}
.auth-dialog-foot .auth-dialog-actions{margin:0;flex:none}
@media(max-width:520px){
  .auth-dialog-facts div{grid-template-columns:1fr;gap:3px}
  .auth-dialog-head{padding:20px 20px 14px}
  .auth-dialog-facts{padding:13px 20px 15px}
  .auth-dialog-foot{padding:12px 20px 15px;gap:10px}
}
