/* 平台共享层：顶部平台导航条、登录卡片、角色徽标、权限提示面板 */
:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #e3e8ef;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #1f5eff;
  --brand-dark: #1648cc;
  --ok: #17a673;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 2px 10px rgba(31, 94, 255, .08);
  /* 平台导航条总高。≤768px 会拆成「品牌行 + 状态栏」两行，由文件末尾的移动端块改写；
     子系统主区高度与抽屉定位一律引用它，不要再各自硬编码像素值。 */
  --pbar-h: 60px;
}

/* ---------- 平台导航条 ---------- */
.platform-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  height: 60px;
  padding: 0 18px;
  background: linear-gradient(90deg, #ffffff 0%, #f7f9ff 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.pbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* 退出按钮已与 .pbar-right 拆开（窄屏要单独上移到品牌行）。桌面用 order 把它排到
   最右；.pbar-right 继续靠 margin-left:auto 顶到右侧，与原来 space-between 的观感一致。 */
.platform-bar #btnSignOut { order: 3; flex: 0 0 auto; }
.pbar-right { order: 2; margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.pbar-logo { width: 34px; height: 34px; object-fit: contain; }
.pbar-title { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.pbar-sep { color: #cbd5e1; }
.pbar-app { font-size: 15px; font-weight: 600; color: var(--brand-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 角色徽标 ---------- */
.role-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  border: 1px solid transparent;
}
.role-badge.role-admin,
.role-badge.role-super { background: #eef2ff; color: #1d4ed8; border-color: #c7d2fe; }
.role-badge.role-editor { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.role-badge.role-viewer { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }

.user-chip {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- 同步状态 ---------- */
.sync { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.sync-idle { background: #f3f4f6; color: var(--muted); }
.sync-pending { background: #fff7ed; color: var(--warn); border-color: #fed7aa; }
.sync-saving { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.sync-ok { background: #ecfdf5; color: var(--ok); border-color: #a7f3d0; }
.sync-error { background: #fef2f2; color: var(--danger); border-color: #fecaca; cursor: pointer; }

/* ---------- 提示面板 ---------- */
.shell-panel {
  max-width: 620px;
  margin: 80px auto;
  padding: 28px 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-align: center;
}
.shell-panel h2 { margin: 0 0 12px; font-size: 20px; }
.shell-panel p { color: var(--muted); line-height: 1.7; margin: 8px 0; }
.shell-actions { margin-top: 20px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: #c7d2fe; color: var(--brand-dark); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.mini-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  color: var(--text);
}
.mini-btn.danger { color: var(--danger); }
.hidden { display: none !important; }

/* ---------- 登录卡片 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 500px at 50% -10%, #e8efff 0%, #f5f7fa 60%);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(31, 94, 255, .10);
  padding: 26px 28px 28px;
}
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-head img { width: 62px; height: 62px; object-fit: contain; }
.auth-head h1 { font-size: 20px; margin: 10px 0 4px; }
.auth-head p { color: var(--muted); font-size: 13px; margin: 0; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: #f3f4f6; padding: 4px; border-radius: 10px; }
.auth-tabs button {
  flex: 1;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.auth-tabs button.active { background: #fff; color: var(--brand-dark); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .06); }
.auth-card label { display: block; font-size: 13px; color: var(--text); margin: 10px 0 5px; }
.auth-card input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}
.auth-card input:focus { outline: none; border-color: var(--brand); }
.auth-row { display: flex; gap: 8px; align-items: flex-end; }
.auth-row .grow { flex: 1; }
.auth-submit { width: 100%; height: 40px; margin-top: 16px; border: none; border-radius: 9px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.auth-submit:disabled { opacity: .6; cursor: default; }
.auth-msg { min-height: 20px; font-size: 13px; margin-top: 10px; text-align: center; }
.auth-msg.err { color: var(--danger); }
.auth-msg.ok { color: var(--ok); }
.auth-foot { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.auth-foot a { color: var(--brand); cursor: pointer; }
/* label 里的补充说明，弱化处理别喧宾夺主 */
.lab-hint { font-size: 11px; color: var(--muted); }
.auth-env {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  word-break: break-all;
}

/* ---------- 响应式统一断点（全平台共用）----------
   口径（各子系统样式表沿用同一套，不要再各写各的宽度）：
     > 1280px   桌面：多栏 / 宽侧栏
     769–1280px 平板：侧栏收窄
     ≤ 768px    手机：单列 + 抽屉 + 底部 tab
   这里只处理平台共享层（导航条 / 提示面板），子系统自身的适配写在各自样式表末尾。 */
@media (max-width: 768px) {
  /* 窄屏导航条拆两行，总高写入 --pbar-h，子系统据此算主区高度。
     83 = 品牌行 40 + 状态栏 42 + 导航条自身 border-bottom 1（实测值，勿凭估算改） */
  :root { --pbar-h: 83px; }

  .platform-bar {
    height: auto;
    padding: 0;
    gap: 0;                      /* 行间用状态栏的 border-top 分界，不再用 gap */
    flex-wrap: wrap;
    align-items: stretch;
  }

  /* 第一行：品牌。整行独占，右侧放「退出」（由 shell.js 渲染为 .platform-bar 直接子元素，
     靠 order 从第二行上移到这里）。品牌行与退出同一行，故用 flex 两端对齐。 */
  .pbar-left { width: auto; flex: 1 1 auto; height: 40px; padding: 0 0 0 12px; }
  .pbar-logo { width: 26px; height: 26px; }
  .pbar-title { display: none; }                 /* 窄屏只留 logo，它本身就是返回门户的链接 */
  .pbar-sep { display: none; }
  .pbar-app { font-size: 15px; }

  /* 第二行：状态栏 —— 左侧同步状态与角色、用户名；右侧让给子系统工具条按钮 */
  .pbar-right {
    order: 3;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    background: #fafbfe;
    border-top: 1px solid var(--border);
  }
  /* 「退出」上移到品牌行：order 让它排到 .pbar-left 之后、.pbar-right 之前，
     即第一行末尾；margin-left:auto 把它顶到该行最右。 */
  .platform-bar #btnSignOut { order: 2; margin-left: auto; margin-right: 12px; }
  .pbar-right .user-chip {
    flex: 0 1 auto; min-width: 0;
    max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .pbar-right a.btn { display: none; }           /* 「返回门户」让位给状态信息，logo 本身就是入口 */
  .pbar-right .role-super { display: none; }     /* 平台角色在门户可见，状态栏只留本子系统角色，给状态信息腾宽 */
  /* 覆盖子系统里 .btn 的 min-height:40px，否则按钮会撑破 42px 的状态栏 */
  .platform-bar .btn { height: 34px; min-height: 0; padding: 0 12px; font-size: 13px; }
  /* 最长的提示是「他人已更新，点此重载」，给上限兜底：万一将来文案更长，省略号收尾而不是撑破整行 */
  .sync { font-size: 12px; padding: 2px 8px; flex: 0 0 auto; max-width: 44vw; overflow: hidden; text-overflow: ellipsis; }
  .role-badge { font-size: 11px; padding: 1px 7px; flex: 0 0 auto; }

  /* 未授权 / 未登录面板 */
  .shell-panel { margin: 40px 12px; padding: 20px; }
  .shell-panel h2 { font-size: 18px; }
}
