/* ==========================================================================
   万pay 商户后台 · 外壳样式（merchant/assets/console.css）
   --------------------------------------------------------------------------
   只被 merchant/index.html 使用（外壳自身），不注入 pages/ 下的业务页 ——
   那些页面是从设计稿整页移植的，自带完整样式，再挂一份会与它们的
   .card / .btn / .modal 互相覆盖。

   外观依据资料库「商户后台设计」·商户后台（深色侧边栏 + 白色顶栏）。
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: #333;
  overflow: hidden;
}

.app { display: flex; flex-direction: column; height: 100vh; min-width: 1100px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e8eaee;
  display: flex;
  align-items: center;
  padding: 0 20px;
  flex: none;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3d8bff, #2f7bff);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 15px; font-weight: 700; color: #22303f; }
.brand-sub { font-size: 11px; color: #8a90a0; letter-spacing: .5px; }

.topbar .spacer { flex: 1; }

.top-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-size: 14px;
  cursor: pointer;
  margin-left: 28px;
  user-select: none;
}
.top-item:hover { color: #2f7bff; }
.top-item svg { display: block; }
.top-item.shop { color: #333; font-weight: 600; }
.top-item.shop .caret { font-size: 10px; color: #8a90a0; margin-left: 2px; }

/* ---------- 商户名下拉菜单 ---------- */
.user-wrap { position: relative; }
.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 168px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(30,40,60,.16);
  border: 1px solid #eceef2;
  padding: 6px;
  display: none;
  z-index: 60;
}
.user-menu.show { display: block; }
.user-menu .menu-item {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 6px;
  color: #444;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.user-menu .menu-item:hover { background: #f0f5ff; color: #2f7bff; }
.user-menu .menu-item svg { flex: none; }
.user-menu .menu-item .mi-label { color: #8a90a0; font-size: 13px; }
.user-menu .menu-item .mi-no {
  color: #444; font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 108px;
}
.user-menu .menu-item:hover .mi-no { color: #2f7bff; }
.user-menu .menu-sep { height: 1px; background: #f0f1f4; margin: 4px 8px; }

/* ---------- 商户编号弹窗 ---------- */
.modal.modal-simple { width: 360px; }
.shopno-box {
  background: #f7f9fc;
  border: 1px solid #eceff5;
  border-radius: 10px;
  padding: 16px 18px;
  text-align: center;
}
.shopno-box .shopno-label { font-size: 13px; color: #8a90a0; margin-bottom: 8px; }
.shopno-box .shopno-value {
  font-size: 20px;
  font-weight: 600;
  color: #222;
  letter-spacing: 1.2px;
  font-variant-numeric: tabular-nums;
  user-select: all;
  word-break: break-all;
}
.shopno-box .shopno-sub { font-size: 12.5px; color: #98a0ad; margin-top: 10px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20,28,44,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-mask.show { display: flex; }
.modal {
  width: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(20,30,55,.25);
  overflow: hidden;
  animation: modalIn .18s ease-out;
}
@keyframes modalIn {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-head {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid #f0f1f4;
}
.modal-head .m-title { font-size: 16px; font-weight: 600; color: #222; }
.modal-head .m-close {
  width: 26px; height: 26px;
  border: none; background: transparent;
  color: #9aa0ab; font-size: 18px; line-height: 1;
  cursor: pointer; border-radius: 6px; font-family: inherit;
}
.modal-head .m-close:hover { background: #f2f3f6; color: #555; }
.modal-body { padding: 22px 24px 6px; }
.modal-body .field { margin-bottom: 18px; }
.modal-body .field label { display: block; font-size: 13px; color: #555; margin-bottom: 7px; }
.modal-body .field input {
  width: 100%;
  height: 40px;
  border: 1px solid #d3d7de;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  color: #333;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.modal-body .field input:focus {
  border-color: #2f7bff;
  box-shadow: 0 0 0 3px rgba(47,123,255,.12);
}
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 14px 24px 20px; }
.modal-foot button {
  height: 36px;
  padding: 0 22px;
  border-radius: 18px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.modal-foot .btn-cancel { background: #fff; border: 1px solid #ccd1d9; color: #555; }
.modal-foot .btn-cancel:hover { border-color: #2f7bff; color: #2f7bff; }
.modal-foot .btn-ok { background: linear-gradient(135deg, #3d8bff, #2f7bff); border: none; color: #fff; }
.modal-foot .btn-ok:hover { filter: brightness(1.06); }
.modal-foot .btn-ok:disabled { opacity: .6; cursor: not-allowed; filter: none; }

/* ---------- 轻提示 ---------- */
#toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(28,34,48,.88);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all .2s;
  z-index: 200;
  max-width: 70vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 子页面通过 parent.Console.toast 到这里；一列堆叠而不是互相覆盖 */
.toast-area {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  max-width: 70vw;
}
.toast-area .toast {
  background: rgba(28,34,48,.9);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(20,30,55,.22);
}
.toast-area .toast.t-err { background: rgba(190,44,44,.94); }
.toast-area .toast.t-ok { background: rgba(14,140,90,.94); }

/* ---------- 主体 ---------- */
.main { flex: 1; display: flex; min-height: 0; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 200px;
  flex: none;
  background: #16203a;
  overflow-y: auto;
  padding-bottom: 30px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #33405f; border-radius: 3px; }

.nav-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #e8ecf5;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  background: #253052;
  margin-bottom: 3px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #2f3d66; }
.nav-item.top-level { font-weight: 600; }
.nav-item.group-head { font-weight: 600; }
.nav-item .arrow {
  font-size: 11px;
  color: #aeb8d6;
  transition: transform .2s;
}
.nav-item.group-head.collapsed .arrow { transform: rotate(-90deg); }
.nav-children { overflow: hidden; }
.nav-children.collapsed { display: none; }
.nav-item.child { padding-left: 34px; font-size: 14px; font-weight: 400; background: #202b4b; }
.nav-item.child:hover { background: #2a3760; }

/* 选中态必须排在各级底色之后：.nav-item.child 与 .nav-item.active 同为 (0,2,0)，
   再显式补上 .child.active / .group-head.active (0,3,0)，任何层级都不会被底色盖掉 */
.nav-item.active,
.nav-item.group-head.active,
.nav-item.child.active { background: #2f7bff; color: #fff; }
.nav-item.active:hover { background: #2f7bff; }
.nav-item .dev-badge {
  font-size: 10px;
  color: #8fa3cf;
  border: 1px solid #3d4a74;
  border-radius: 8px;
  padding: 1px 6px;
  line-height: 1.4;
}
.nav-item.active .dev-badge { color: #dbe7ff; border-color: rgba(255,255,255,.4); }

/* ---------- 内容区 ---------- */
.content { flex: 1; min-width: 0; background: #eef0f4; position: relative; }
.content iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #eef0f4;
}
.dev-view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #98a0ad;
  background: #eef0f4;
}
.dev-view.show { display: flex; }
.dev-view .dev-title { font-size: 20px; color: #6b7280; font-weight: 600; letter-spacing: 2px; }
.dev-view .dev-sub { font-size: 13px; color: #a6adb8; }
