/* ==========================================================================
   门户公共件 portal-ui.css（全站整改 · 门户线，2026-09-25）
   --------------------------------------------------------------------------
   只放「门户每页都在重复写」的那几样：页面底子、顶栏、页标题、管理表格、表单字段、
   居中弹窗 / 底部弹层、轻提示、空状态、加载圈、登录卡。
   规矩：
   · 一律只用 mulee-tokens.css 的变量和 ui- 基础类，这里不写任何颜色值。
   · 类名 pu- 开头（portal ui），不和 ERP 的 ui- 基础类撞名。
   · 每页 <head> 顺序：mulee-tokens.css → portal-ui.css → 本页 <style>（只剩布局）。
   · 手机 / 电脑只认 768 一个分界。
   · 木里员工端（mulee.html）不引这个文件，它还用 aurora-shared.css。
   ========================================================================== */

/* ── 页面底子 ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-page); color: var(--ink); font-family: var(--font);
  font-size: var(--fs-14); line-height: var(--lh-normal); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--brand-strong); text-decoration: none; }

/* ── 顶栏：返回 · 页名 · 小字说明 · 右边动作（白底，下面一条很淡的线） ── */
.pu-top { position: sticky; top: 0; z-index: var(--z-header); display: flex; align-items: center; gap: var(--s-3);
  min-height: var(--h-header); padding: env(safe-area-inset-top, 0px) var(--gutter-desk) 0; background: var(--surface);
  box-shadow: 0 1px 0 var(--line-soft); }
.pu-top__back { flex: none; width: 36px; padding: 0; border-radius: var(--r-full); }
.pu-top__back .ui-icon { width: var(--icon-md); height: var(--icon-md); }
.pu-top__logo { height: 28px; display: block; flex: none; }
.pu-top__title { margin: 0; font-size: var(--fs-18); font-weight: var(--fw-heavy); line-height: var(--lh-tight);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pu-top__spacer { flex: 1; min-width: 0; }
.pu-top__actions { display: flex; align-items: center; gap: var(--s-2); flex: none; }

/* ── 内容区：宽屏铺满，左右留白 24（手机 16） ── */
.pu-page { padding: var(--s-6) var(--gutter-desk) var(--s-10); }
.pu-head { display: flex; align-items: flex-end; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); }
.pu-head__main { flex: 1; min-width: 0; }
.pu-title { margin: 0; font-size: var(--fs-22); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.pu-desc { margin: var(--s-1) 0 0; font-size: var(--fs-13); color: var(--ink-2); line-height: var(--lh-normal); }
.pu-section { margin-bottom: var(--s-4); }
.pu-section > .ui-card__head { padding-bottom: var(--s-3); }
.pu-hint { font-size: var(--fs-13); color: var(--ink-2); line-height: var(--lh-loose); }
.pu-hint b { color: var(--ink); font-weight: var(--fw-strong); }

/* ── 管理表格：表头浅灰块，行之间一条很淡的线，悬停浅底 ── */
.pu-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pu-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-14);
  font-variant-numeric: tabular-nums; }
.pu-table th { padding: 10px 12px; background: var(--bg-sunken); color: var(--ink-2); font-size: var(--fs-12);
  font-weight: var(--fw-strong); text-align: left; white-space: nowrap; }
.pu-table th:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.pu-table th:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.pu-table td { padding: 12px; border-bottom: 1px solid var(--line-soft); color: var(--ink); vertical-align: middle; }
.pu-table tbody tr:last-child td { border-bottom: 0; }
.pu-table tbody tr:hover td { background: var(--bg-hover); }
.pu-table .pu-weak { color: var(--ink-3); font-size: var(--fs-12); }
.pu-table td b, .pu-table .ui-tag, .pu-table .ui-num { white-space: nowrap; }
/* 操作列:按钮靠右;地方不够时整颗按钮换行(不把操作列挤出卡片) */
.pu-table .pu-ops { text-align: right; }
.pu-table .pu-ops .ui-btn { margin: 2px 0 2px var(--s-1); }

/* ── 表单字段：上面一行灰字名，下面 ui-input；必填打红星 ── */
.pu-field { margin-bottom: var(--s-4); }
.pu-field > label, .pu-field__label { display: block; margin-bottom: 6px; font-size: var(--fs-13);
  font-weight: var(--fw-strong); color: var(--ink-2); }
.pu-field__help { margin-top: 6px; font-size: var(--fs-12); color: var(--ink-3); line-height: var(--lh-normal); }
.pu-req { color: var(--danger); margin-left: 2px; }
select.ui-input { padding-right: 8px; cursor: pointer; }
textarea.ui-input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; line-height: var(--lh-normal); }
.pu-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.pu-check { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--h-control-touch);
  font-size: var(--fs-13); color: var(--ink-2); cursor: pointer; }
.pu-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand-strong); }

/* ── 居中弹窗（要你确认 / 填一件事）：遮罩 + 圆角 28 的白卡；.show 或 .open 时出现 ── */
.pu-dialog { position: fixed; inset: 0; z-index: var(--z-modal); display: none; align-items: center;
  justify-content: center; padding: var(--s-4); background: var(--mask); }
/* [MULEE-424 动效统一] 弹窗 / 弹层进场:遮罩淡入、白卡淡入 + 轻轻缩上来 / 滑上来(动画帧在统一底层 mulee-tokens.css) */
.pu-dialog.show, .pu-dialog.open { display: flex; animation: ui-fade-in var(--dur-pop) var(--ease); }
.pu-dialog.show .pu-dialog__box, .pu-dialog.open .pu-dialog__box { animation: ui-pop-in var(--dur-pop) var(--ease); }
.pu-dialog__box { width: min(460px, 100%); max-height: 88vh; overflow: auto; background: var(--surface);
  border-radius: var(--r-2xl); box-shadow: var(--shadow-3); padding: var(--s-6); }
.pu-dialog__title { margin: 0; font-size: var(--fs-18); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.pu-dialog__sub { margin: 6px 0 var(--s-4); font-size: var(--fs-13); color: var(--ink-2); line-height: var(--lh-normal); }
.pu-dialog__foot { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-5); }

/* ── 底部弹层（手机）：宽屏上变成居中弹窗；.open 时出现 ── */
.pu-sheet { position: fixed; inset: 0; z-index: var(--z-sheet); display: none; align-items: flex-end;
  justify-content: center; background: var(--mask); }
.pu-sheet.open { display: flex; animation: ui-fade-in var(--dur-pop) var(--ease); }
.pu-sheet.open .pu-sheet__box { animation: ui-rise-in var(--dur-pop) var(--ease); }
.pu-sheet__box { width: 100%; max-height: 88vh; overflow: auto; background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-2);
  padding: var(--s-2) var(--gutter) calc(env(safe-area-inset-bottom, 0px) + var(--s-5)); }
.pu-sheet__box::before { content: ""; display: block; width: 36px; height: 4px; margin: 2px auto var(--s-3);
  border-radius: var(--r-full); background: var(--line-strong); }
.pu-sheet__title { margin: 0 0 4px; font-size: var(--fs-18); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.pu-sheet__sub { margin: 0 0 var(--s-4); font-size: var(--fs-13); color: var(--ink-2); line-height: var(--lh-normal); }
.pu-sheet__foot { display: flex; gap: var(--s-2); margin-top: var(--s-4); }
.pu-sheet__foot > .ui-btn { flex: 1; }

/* ── 轻提示：屏幕下方一条深色胶囊，做成了 = 墨色，没做成 = 红，提醒 = 橙 ── */
.pu-toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--s-6)); z-index: var(--z-toast);
  max-width: min(90vw, 560px); padding: 10px 18px; border-radius: var(--r-md); background: var(--ink); color: var(--on-fill);
  font-size: var(--fs-14); font-weight: var(--fw-strong); line-height: var(--lh-normal); box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none; transform: translate(-50%, 8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.pu-toast.show, .pu-toast.on { opacity: 1; transform: translate(-50%, 0); }
.pu-toast.err, .pu-toast.bad { background: var(--danger); }
.pu-toast.warn { background: var(--warn); }

/* ── 空状态：一个灰线图标 + 一句话 ── */
.pu-empty { padding: var(--s-10) var(--s-4); text-align: center; color: var(--ink-3); font-size: var(--fs-14); line-height: var(--lh-normal); }
.pu-empty > .ui-icon { display: flex; width: 36px; height: 36px; margin: 0 auto var(--s-2); color: var(--ink-4); }

/* ── 等数据(MULEE-424 动效统一):原「加载圈」(.pu-loading/.pu-spin)退役,
      各页直接用 mulee-tokens.css 里的灰色占位条 .ui-skeleton/.ui-skeleton__bar ── */

/* ── 视图切换(MULEE-424):换视图 / 换页签只轻轻淡入,各页给自己显示中的那块写 animation: ui-fade-in var(--dur) var(--ease)
      (动画帧在统一底层 mulee-tokens.css,门户、ERP 同一份) ── */

/* ── 一排胶囊（切门店）：永远一行，放不下左右滑，不出滚动条 ── */
.pu-chiprow { display: flex; gap: var(--s-2); overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; }
.pu-chiprow::-webkit-scrollbar { display: none; }

/* ── 登录 / 注册 / 改密：同一张白卡 ── */
.pu-auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: var(--s-8) var(--gutter); }
.pu-auth__card { width: 100%; max-width: 420px; padding: var(--s-8) var(--s-6) var(--s-6); background: var(--surface);
  border-radius: var(--r-2xl); box-shadow: var(--shadow-2); }
.pu-auth__logo { display: block; height: 34px; margin: 0 auto var(--s-4); }
.pu-auth__title { margin: 0; text-align: center; font-size: var(--fs-22); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.pu-auth__sub { margin: 6px 0 var(--s-5); text-align: center; font-size: var(--fs-13); color: var(--ink-2); }
.pu-auth .ui-input { height: 44px; font-size: var(--fs-16); }
.pu-auth .ui-btn--primary { width: 100%; height: 46px; font-size: var(--fs-16); }
.pu-auth__foot { margin-top: var(--s-4); text-align: center; font-size: var(--fs-13); color: var(--ink-2); }
.pu-auth__foot a { display: inline-block; padding: 10px 6px; margin: -10px -6px; font-weight: var(--fw-strong); cursor: pointer; }
.pu-seg-full { display: flex; width: 100%; }
.pu-seg-full > button { flex: 1; height: 36px; }

/* ── 手机（<768）：留白收成 16，控件长到手指点得准 ── */
@media (max-width: 767px) {
  .pu-top { padding-left: var(--gutter); padding-right: var(--gutter); gap: var(--s-2); }
  .pu-top > .ui-tag { display: none; }        /* 顶栏的小字说明手机上收起,页名优先 */
  .pu-top__title { flex: 0 1 auto; min-width: 3em; }
  .pu-m-hide { display: none; }               /* 按钮上的字手机上收起,只留图标 */
  .pu-page { padding: var(--s-4) var(--gutter) var(--s-10); }
  .pu-title { font-size: var(--fs-18); }
  .pu-table th, .pu-table td { padding: 10px 8px; }
  .pu-field .ui-input, .pu-dialog .ui-input { height: var(--h-control-touch); font-size: var(--fs-16); }
  .pu-dialog__box { padding: var(--s-5); }
  .pu-dialog__foot .ui-btn { height: var(--h-control-touch); flex: 1; }
}
@media (min-width: 768px) {
  .pu-sheet { align-items: center; padding: var(--s-6); }
  .pu-sheet__box { width: min(560px, 100%); border-radius: var(--r-2xl); box-shadow: var(--shadow-3);
    padding: var(--s-6); }
  .pu-sheet__box::before { display: none; }
  .pu-sheet__foot { justify-content: flex-end; }
  .pu-sheet__foot > .ui-btn { flex: none; }
}
