/* 平台后台界面样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --nav-bg: #16233a;
  --nav-bg2: #1e2f4c;
  --orange: #ff6a00;
  --orange-soft: #fff4ec;
  --text: #16233a;
  --text-2: #5a6b85;
  --text-3: #8a94a6;
  --line: #e8edf5;
  --bg: #f2f4f8;
  --card: #ffffff;
  --green: #1a9c4a;
  --red: #d63333;
  --blue: #2a5cff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #2c3e5e, #16233a);
}

.login-card {
  width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 34px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.login-logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
}

.login-sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-3);
}

.login-card label {
  display: block;
  margin: 22px 0 8px;
  font-size: 13px;
  color: var(--text-2);
}

.login-card input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  background: #fafbfd;
}

.login-card input:focus { border-color: var(--orange); background: #fff; }

.btn-primary {
  width: 100%;
  height: 44px;
  margin-top: 26px;
  border: none;
  border-radius: 8px;
  background: var(--orange);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { background: #e85f00; }

.login-tip {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}

.login-err {
  margin-top: 14px;
  font-size: 13px;
  color: var(--red);
  min-height: 18px;
  text-align: center;
}

/* ============ 布局 ============ */
.app { display: none; min-height: 100vh; }
.app.show { display: flex; }

.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--nav-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  padding: 26px 22px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.side-brand-t {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.side-brand-s {
  margin-top: 6px;
  font-size: 12px;
  color: #93a5bf;
}

.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: #c8d4e4;
  cursor: pointer;
  margin-bottom: 4px;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: var(--nav-bg2); color: #fff; font-weight: 600; }
.nav-item .ni-ico { width: 18px; text-align: center; opacity: 0.9; }

.nav-foot {
  padding: 16px 18px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #93a5bf;
}
.nav-out {
  margin-top: 10px;
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  color: #dbe4f0;
  cursor: pointer;
  font-size: 12px;
}

.nav-out:hover { background: rgba(255, 255, 255, 0.08); }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  border: 1px solid #dfe6f2;
  border-radius: 10px;
  padding: 9px 18px;
  margin-bottom: 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(22, 35, 58, 0.05);
  transition: all .15s;
}
.back-link:hover { color: #fff; background: var(--orange); border-color: var(--orange); box-shadow: 0 6px 16px rgba(255, 122, 26, 0.28); }

.page-title { font-size: 24px; font-weight: 800; }
.page-sub { margin-top: 6px; font-size: 13px; color: var(--text-3); }

.head-actions { display: flex; gap: 10px; }

.btn {
  height: 36px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}

.btn:hover { border-color: #cfd9e8; color: var(--text); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #e85f00; }
.btn.danger { color: var(--red); border-color: #f3c2c2; }
.btn.danger:hover { background: #fdf2f2; }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 12px; font-size: 12px; }

/* ============ 仪表盘 ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi {
  background: var(--card);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 2px 10px rgba(22, 35, 58, 0.05);
  position: relative;
  overflow: hidden;
}

.kpi-label { font-size: 13px; color: var(--text-3); }
.kpi-num { margin-top: 10px; font-size: 30px; font-weight: 800; line-height: 1.1; }
.kpi-num.money { font-size: 26px; color: var(--orange); }
.kpi-num.green { color: var(--green); }
.kpi-num.warn { color: #e8850b; }
.kpi-foot { margin-top: 8px; font-size: 12px; color: var(--text-3); }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 2px 10px rgba(22, 35, 58, 0.05);
  margin-bottom: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title { font-size: 16px; font-weight: 700; }
.card-hint { font-size: 12px; color: var(--text-3); }

/* ============ 表格 ============ */
table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 13px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid #f3f6fa;
  color: var(--text);
  vertical-align: middle;
}

tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: none; }

.t-main { font-weight: 600; }
.link-name { cursor: pointer; }
.link-name:hover { color: var(--orange); }
.t-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.t-money { color: var(--orange); font-weight: 700; }
.t-mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
}

.tag.on { background: #eaf7ef; color: var(--green); }
.tag.off { background: #fdecec; color: var(--red); }
.tag.draft { background: #f1f3f7; color: var(--text-3); }
.tag.pending { background: #fff4e6; color: #e8850b; }
.tag.trial { background: #f3edff; color: #6b3fd4; }
.tag.accepted { background: #eaf0ff; color: var(--blue); }
/* 生产中：活儿正在干，用更实的靛蓝，和刚接单区分开 */
.tag.making { background: #e4ecff; color: #2b4fd6; }
/* 已完工待收款：活还没干完（钱没收），用橙色提醒，别做成绿的让人以为完事了 */
.tag.done { background: #fff1e6; color: #c05a00; }
/* 已结清、已取消：灰色的结束态 */
.tag.settled { background: #f1f3f7; color: var(--text-3); }
.tag.canceled { background: #f1f3f7; color: var(--text-3); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 小程序展示排名（点一下就能改） */
.rank-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-3);
  background: #f1f3f7;
  cursor: pointer;
  white-space: nowrap;
}

.rank-chip.fixed {
  background: #fff4e6;
  color: #e8850b;
  font-weight: 600;
}

.rank-chip:hover { opacity: 0.85; }

/* 调整展示顺序的面板 */
.rank-tip {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.7;
  margin-bottom: 14px;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow: auto;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f7f9fc;
  border: 1px solid #eceff4;
  border-radius: 10px;
  padding: 10px 12px;
}

.rank-no {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: #eef1f6;
  color: #5b6b82;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-no.top {
  background: linear-gradient(135deg, #ff9a3c, #ff7226);
  color: #ffffff;
}

.rank-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.rank-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
  margin-top: 2px;
}

.rank-btns { display: flex; gap: 6px; }

.rank-auto {
  margin-top: 14px;
  text-align: right;
}

.empty {
  padding: 36px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 38, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-mask.show { display: flex; }

.modal {
  width: 460px;
  max-height: 86vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  padding: 26px 26px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 18px; }

.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 7px;
}

.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  background: #fafbfd;
  font-family: inherit;
}

.form-row textarea { height: 76px; padding: 10px 12px; resize: vertical; }

.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--orange);
  background: #fff;
}

.form-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* 密码框右侧的「显示 / 隐藏」按钮 */
.pwd-cell { position: relative; }
.pwd-cell input { padding-right: 52px; }
.pwd-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  user-select: none;
}
.pwd-eye:hover { background: #eef2f8; color: var(--text); }

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ============ 提示 ============ */
.toast {
  position: fixed;
  top: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #16233a;
  color: #fff;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.2s;
  z-index: 90;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #b62d2d; }

/* ============ 筛选栏 ============ */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-bar select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  font-size: 13px;
  color: var(--text-2);
  outline: none;
}

.filter-bar .spacer { flex: 1; }

/* ============ 小程序卡片 ============ */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.app-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(22, 35, 58, 0.05);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.app-card-name { font-size: 17px; font-weight: 800; }
.app-card-appid { margin-top: 6px; font-size: 12px; color: var(--text-3); font-family: ui-monospace, monospace; }

.app-card-stats { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); justify-content: space-between; }
.acs { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.acs-n { font-size: 17px; font-weight: 700; white-space: nowrap; }
.acs-n.money { font-size: 15px; color: var(--orange); }
.acs-l { font-size: 11px; color: var(--text-3); }

.app-card-foot { display: flex; gap: 8px; }

/* ============ 授权页 ============ */
.auth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 16px; }

.auth-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(22, 35, 58, 0.05);
  overflow: hidden;
}

.auth-head {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.auth-name { font-size: 17px; font-weight: 800; }
.auth-meta { margin-top: 6px; font-size: 12px; color: var(--text-3); }

.auth-body { padding: 16px 22px 20px; }

.code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}

.code-row .btn { flex-shrink: 0; white-space: nowrap; }

.code-label {
  width: 108px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-2);
}

.code-val {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text);
  padding: 4px 12px;
  border-radius: 8px;
  background: #f4f7fb;
}

.code-spacer { flex: 1; }

.owner-list { margin-top: 6px; }

.owner-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f6fa;
  font-size: 13px;
}

.owner-row .o-name { font-weight: 600; min-width: 80px; }
.owner-row .o-id { font-family: ui-monospace, monospace; color: var(--text-3); font-size: 12px; }
.owner-row .code-spacer { flex: 1; }

.auth-sub {
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.auth-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-foot .expire-info { flex: 1; font-size: 12px; color: var(--text-3); }

/* ============ 侧栏分组 ============ */
.nav-group-title {
  padding: 14px 14px 6px;
  font-size: 11px;
  color: #6d809c;
  letter-spacing: 1px;
}

/* ============ 柱状图 ============ */
.chart { padding: 10px 0 0; }
.chart-cols { display: flex; align-items: flex-end; gap: 5px; height: 180px; }
.bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}
.bar {
  width: 70%;
  max-width: 26px;
  background: linear-gradient(180deg, #ffa95e, #ff6a00);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: height 0.25s;
}
.bar.empty { background: #eef1f6; }
.bar-label { font-size: 10px; color: var(--text-3); margin-top: 6px; height: 14px; white-space: nowrap; }

/* ============ 库存 ============ */
.stock-card { margin-bottom: 14px; }
.stock-low { color: var(--red); font-weight: 700; }
.stock-bar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  background: #eef1f6;
  width: 60px;
  vertical-align: middle;
  margin-right: 8px;
  overflow: hidden;
}
.stock-bar > i { display: block; height: 100%; background: var(--green); }
.stock-bar.low > i { background: var(--red); }

/* ============ 公告 ============ */
.notice-item {
  padding: 16px 0;
  border-bottom: 1px solid #f3f6fa;
}
.notice-item:last-child { border-bottom: none; }
.notice-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.notice-content { margin-top: 8px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.notice-meta { margin-top: 8px; font-size: 12px; color: var(--text-3); display: flex; gap: 12px; align-items: center; }

/* ============ 广告位 ============ */
.ad-thumb {
  width: 84px;
  height: 48px;
  border-radius: 6px;
  background: #f4f7fb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
}
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ============ 授权流程说明 ============ */
.auth-note { font-size: 13px; line-height: 2; color: #4a566b; }
.auth-note p { margin: 0 0 2px; }
.auth-note b { color: var(--text); }
.auth-note-foot { margin-top: 10px; color: #8a97ab; border-top: 1px dashed #e3eaf5; padding-top: 10px; }

/* ============ 订单状态色块 ============ */
.status-row { display: flex; gap: 14px; flex-wrap: wrap; }
.status-cell { flex: 1; min-width: 120px; background: #f7f9fc; border-radius: 10px; padding: 14px 18px; }
.status-label { font-size: 12px; color: #8a97ab; }
.status-num { font-size: 24px; font-weight: 700; margin-top: 6px; color: var(--text); }

/* 可点击卡片：鼠标移上去有反馈 */
.kpi.clickable, .status-cell.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kpi.clickable:hover { box-shadow: 0 6px 18px rgba(22, 35, 58, 0.10); transform: translateY(-2px); }
.status-cell.clickable:hover { background: #eef3fa; }

/* ============ 提醒条 ============ */
.alert-bar {
  background: var(--orange-soft);
  border: 1px solid #ffd9bb;
  color: #c4570a;
  padding: 11px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.alert-bar b { font-weight: 700; }
.alert-bar a { color: #c4570a; text-decoration: underline; cursor: pointer; }

/* ============ 日志 ============ */
.log-row td { font-size: 12.5px; }

/* ============ 危险操作（清空测试数据） ============ */
.danger-card {
  border: 1px solid #f3c2c2;
  background: #fffafa;
}
.danger-t { color: #d43030; }
.danger-list {
  font-size: 12.5px;
  color: #7a5555;
  line-height: 1.95;
  background: #fff;
  border: 1px solid #f6dddd;
  border-radius: 8px;
  padding: 11px 13px;
}
.danger-list strong {
  color: #d43030;
  font-weight: 700;
}
.danger-list strong { display: block; margin-bottom: 2px; }
.danger-list strong + br { display: none; }
