/* ========================================================
   星匣 StarBox · 运营管理后台样式
   品牌色：深紫 #4a3b52 / 珍珠白 #f6f3f8 / 细金 #3f6b66
   ======================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #f6f3f8;
  color: #463a50;
  font-size: 14px;
}
.hidden { display: none !important; }
a { color: #3f6b66; text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-page {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b2f45 0%, #4a3b52 45%, #6d5480 100%);
}
.login-bg {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(227,184,116,.14) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
}
.login-card {
  position: relative; width: 400px; padding: 44px 40px 34px;
  background: rgba(255,255,255,.97); border-radius: 18px;
  border: 1px solid rgba(227,184,116,.5);
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  text-align: center;
}
.login-logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff;
  background: linear-gradient(135deg, #5f8f8a, #3f6b66);
  box-shadow: 0 10px 24px rgba(63,107,102,.4);
}
.login-title { font-size: 24px; font-weight: 700; letter-spacing: 2px; color: #4a3b52; }
.login-sub { margin-top: 6px; font-size: 12px; color: #a993b3; letter-spacing: 1px; }
.login-form { margin-top: 28px; text-align: left; }
.lf-row { margin-bottom: 16px; }
.lf-row label { display: block; font-size: 12px; color: #8a7aa8; margin-bottom: 6px; }
.lf-row input {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 10px;
  border: 1px solid #ddd2e6; background: #fbf9fd; font-size: 14px; color: #463a50;
  outline: none; transition: border .15s;
}
.lf-row input:focus { border-color: #3f6b66; }
.lf-tip { min-height: 18px; font-size: 12px; color: #c09098; margin-bottom: 8px; }
.lf-btn {
  width: 100%; height: 44px; border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #5f8f8a, #3f6b66);
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 8px;
  box-shadow: 0 12px 26px rgba(63,107,102,.35);
}
.lf-btn:hover { filter: brightness(1.05); }
.lf-demo { margin-top: 16px; font-size: 11px; color: #b3a4bd; line-height: 1.7; text-align: center; }

/* ---------- 主框架 ---------- */
.frame { display: flex; height: 100vh; overflow: hidden; }

/* 侧栏 */
.sidebar {
  width: 224px; flex-shrink: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #3b2f45, #4a3b52 60%, #453650);
  color: #cfc2da;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; }
.sb-logo {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5f8f8a, #3f6b66); color: #fff; font-size: 18px;
}
.sb-name { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.sb-menu { flex: 1; overflow-y: auto; padding: 6px 12px 20px; }
.sb-menu::-webkit-scrollbar { width: 0; }
.sb-group { margin-top: 14px; padding: 0 10px 6px; font-size: 11px; color: #8a7aa8; letter-spacing: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 2px 0; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; color: #cfc2da; transition: background .15s;
  border-left: 3px solid transparent;
}
.sb-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-item.on {
  background: rgba(227,184,116,.14); color: #f3dcb2;
  border-left-color: #5f8f8a; font-weight: 600;
}
.sb-item .ic { width: 20px; text-align: center; font-size: 15px; }
.sb-foot { padding: 14px 22px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #8a7aa8; line-height: 1.8; }

/* 内容区 */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: #fff; border-bottom: 1px solid #ece5f2;
}
.tb-crumb { font-size: 16px; font-weight: 700; color: #4a3b52; letter-spacing: 1px; }
.tb-right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: #a993b3; }
.tb-env {
  padding: 3px 10px; border-radius: 999px; font-size: 11px;
  background: rgba(227,184,116,.12); color: #3f6b66; border: 1px solid rgba(227,184,116,.4);
}
.tb-user { color: #6d5480; font-weight: 600; }
.tb-out {
  padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: 12px;
  border: 1px solid #ddd2e6; background: #fff; color: #8a7aa8;
}
.tb-out:hover { border-color: #c09098; color: #c09098; }

.page { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }

/* ---------- 通用卡片 / 区块 ---------- */
.card {
  background: #fff; border-radius: 14px; padding: 20px 22px;
  border: 1px solid #efe8f5; box-shadow: 0 6px 18px rgba(140,110,165,.06);
  margin-bottom: 18px;
}
.card-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-tt { font-size: 15px; font-weight: 700; color: #4a3b52; }
.card-tt .star { color: #5f8f8a; margin-right: 6px; }
.card-tip { font-size: 12px; color: #b3a4bd; line-height: 1.8; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* 看板统计卡 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  background: #fff; border-radius: 14px; padding: 18px 20px;
  border: 1px solid #efe8f5; box-shadow: 0 6px 18px rgba(140,110,165,.06);
}
.stat .k { font-size: 12px; color: #a993b3; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 6px; color: #4a3b52; font-family: "Noto Serif SC", serif; }
.stat .v.gold { color: #3f6b66; }
.stat .d { font-size: 11px; margin-top: 6px; color: #7fbf8f; }
.stat .d.down { color: #c09098; }

/* ---------- 表单 ---------- */
.f-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.f-row .lb { width: 190px; flex-shrink: 0; font-size: 13px; color: #6d5480; text-align: right; }
.f-row .lb small { display: block; font-size: 11px; color: #b3a4bd; font-weight: 400; margin-top: 2px; }
.f-row .ct { flex: 1; display: flex; align-items: center; gap: 8px; }
.f-row .unit { font-size: 12px; color: #a993b3; }
.ipt {
  height: 36px; padding: 0 12px; border-radius: 8px; font-size: 13px; color: #463a50;
  border: 1px solid #ddd2e6; background: #fbf9fd; outline: none; transition: border .15s;
}
.ipt:focus { border-color: #3f6b66; }
.ipt.w-s { width: 90px; } .ipt.w-m { width: 180px; } .ipt.w-l { width: 320px; } .ipt.w-full { width: 100%; }
textarea.ipt { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.8; resize: vertical; }
select.ipt { cursor: pointer; }

/* 开关 */
.sw { position: relative; width: 44px; height: 24px; border-radius: 999px; background: #ddd2e6; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.sw.on { background: linear-gradient(135deg, #5f8f8a, #3f6b66); }
.sw.on::after { left: 23px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 18px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 13px; transition: filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn.pri { background: linear-gradient(135deg, #5f8f8a, #3f6b66); color: #fff; font-weight: 600; box-shadow: 0 6px 14px rgba(63,107,102,.28); }
.btn.gh { background: #fff; border: 1px solid #ddd2e6; color: #8a7aa8; }
.btn.dgr { background: #fff; border: 1px solid #e6c2c7; color: #c09098; }
.btn.ok { background: #fff; border: 1px solid #bfe0c8; color: #5d9b6f; }
.btn.sm { height: 28px; padding: 0 12px; font-size: 12px; border-radius: 6px; }
.save-bar { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.save-bar .hint { font-size: 12px; color: #b3a4bd; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 10px 12px; font-size: 12px; color: #8a7aa8; font-weight: 600;
  background: #faf7fc; border-bottom: 1px solid #ece5f2; white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f3edf8; color: #463a50; vertical-align: middle; }
.tbl tr:hover td { background: #fdfbf7; }
.tbl .empty { text-align: center; color: #b3a4bd; padding: 30px 0; }

/* 徽章 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; white-space: nowrap; }
.tag.gold { background: rgba(227,184,116,.14); color: #3f6b66; border: 1px solid rgba(227,184,116,.45); }
.tag.blue { background: rgba(168,195,232,.18); color: #5a7fb0; border: 1px solid rgba(168,195,232,.5); }
.tag.green { background: rgba(160,208,170,.18); color: #5d9b6f; border: 1px solid rgba(160,208,170,.5); }
.tag.red { background: rgba(224,150,158,.14); color: #c09098; border: 1px solid rgba(224,150,158,.45); }
.tag.gray { background: #f1edf5; color: #a993b3; border: 1px solid #e5ddee; }
.tag.purple { background: rgba(195,166,232,.16); color: #8a6ab0; border: 1px solid rgba(195,166,232,.5); }

/* 子 tab */
.subtabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.subtab {
  padding: 7px 18px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: #fff; border: 1px solid #e5ddee; color: #8a7aa8;
}
.subtab.on { background: linear-gradient(135deg, #5f8f8a, #3f6b66); color: #fff; border-color: transparent; font-weight: 600; box-shadow: 0 6px 14px rgba(63,107,102,.25); }

/* 进度条 */
.pbar { height: 8px; border-radius: 999px; background: #efe8f5; overflow: hidden; }
.pbar .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5f8f8a, #3f6b66); }

/* ---------- 弹层 / Toast ---------- */
.m-mask {
  position: fixed; inset: 0; z-index: 200; background: rgba(59,47,69,.5);
  display: flex; align-items: center; justify-content: center;
}
.m-box {
  /* 宽度随内容自适应（含表格的详情弹窗自动撑宽），上限 88vw */
  width: max-content; min-width: 460px; max-width: 88vw;
  max-height: 86vh; overflow-y: auto;
  background: #fff; border-radius: 16px; padding: 22px 26px;
  border: 1px solid rgba(227,184,116,.4); box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
/* 内容含表格/选品列表时自动进入宽屏模式 */
.m-box:has(.tbl), .m-box:has(.pk-row) { min-width: 760px; }
@media (max-width: 860px) {
  .m-box { min-width: 0; width: auto; }
  .m-box:has(.tbl), .m-box:has(.pk-row) { min-width: 92vw; }
}
.m-head { font-size: 16px; font-weight: 700; color: #4a3b52; margin-bottom: 14px; }
.m-body { font-size: 13px; color: #6d5480; line-height: 1.8; }
.m-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 300;
  padding: 10px 22px; border-radius: 999px; font-size: 13px;
  background: #4a3b52; color: #fff; box-shadow: 0 10px 26px rgba(0,0,0,.25);
}

/* ---------- 聊天查询 ---------- */
.chat-wrap { display: flex; gap: 18px; align-items: flex-start; }
.chat-side { width: 300px; flex-shrink: 0; }
.chat-main { flex: 1; }
.sess {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px;
  cursor: pointer; border: 1px solid transparent; margin-bottom: 6px;
}
.sess:hover { background: #faf7fc; }
.sess.on { background: rgba(227,184,116,.1); border-color: rgba(227,184,116,.45); }
.sess .av {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f6cfe0, #cdd9f4); color: #6d4a63; font-size: 16px;
}
.sess .mt { flex: 1; min-width: 0; }
.sess .nm { font-size: 13px; font-weight: 600; color: #4a3b52; }
.sess .ls { font-size: 11px; color: #b3a4bd; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble-row { display: flex; margin-bottom: 12px; }
.bubble-row.me { justify-content: flex-end; }
.bubble {
  max-width: 70%; padding: 9px 14px; border-radius: 12px; font-size: 13px; line-height: 1.7;
  background: #f3eef8; color: #463a50;
}
.bubble-row.me .bubble { background: rgba(227,184,116,.18); }
.bubble .tm { display: block; font-size: 10px; color: #b3a4bd; margin-top: 4px; }
.bubble.img { padding: 6px; }
.bubble.img .fake-img {
  width: 150px; height: 110px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f6cfe0, #cdd9f4); color: #8a7aa8; font-size: 12px;
}

/* 合规警示条 */
.notice {
  display: flex; gap: 10px; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px;
  background: rgba(227,184,116,.08); border: 1px solid rgba(227,184,116,.4);
  font-size: 12px; color: #8a6a3f; line-height: 1.8;
}
.notice.blue { background: rgba(168,195,232,.1); border-color: rgba(168,195,232,.5); color: #5a7fb0; }
.notice.gold { background: rgba(227,184,116,.12); border-color: rgba(227,184,116,.55); color: #9a7434; }

/* 卡池创建向导浮层 */
.wz-mask {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-start; justify-content: center;
  background: rgba(60, 45, 70, 0.45); backdrop-filter: blur(3px); padding: 40px 16px; overflow-y: auto;
}
.wz-box {
  width: 720px; max-width: 96vw; background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 18px 60px rgba(90, 60, 100, .25);
}
.wz-hd {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid #f1ebf5; background: linear-gradient(135deg, rgba(246,207,224,.2), rgba(205,217,244,.2));
}
.wz-hd b { font-size: 15px; color: #4a3b52; flex: 0 0 auto; }
.wz-step { flex: 1; font-size: 12px; color: #9a8fb0; }
.wz-bd { padding: 18px 20px; max-height: 62vh; overflow-y: auto; }
.wz-bd .f-row { margin-bottom: 14px; }
.wz-bd textarea.ipt { min-height: 90px; resize: vertical; }
.wz-ft {
  display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px;
  border-top: 1px solid #f1ebf5; background: #fdfbff;
}

/* 响应式兜底 */
@media (max-width: 1100px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .chat-wrap { flex-direction: column; }
  .chat-side { width: 100%; }
}

/* 只读账号（无该模块操作权限）：锁定操作类按钮与开关，查看不受影响 */
body.no-act .btn.pri, body.no-act .btn.ok, body.no-act .btn.dgr,
body.no-act .save-bar .btn {
  pointer-events: none; opacity: .38; filter: grayscale(.4);
}
body.no-act .sw { pointer-events: none; opacity: .55; }

/* 奖品库/卡池选品小表格 */
.tbl.mini { font-size: 12px; }
.tbl.mini th, .tbl.mini td { padding: 6px 8px; }
.pk-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #f4eff7; font-size: 12.5px; }
.pk-row:hover { background: #faf7fd; }
.pk-row .pk-name { flex: 1; min-width: 0; }
.pk-row .ipt { padding: 4px 8px; font-size: 12px; }
