/* 代理平台（沿用登录页配色：浅蓝白底 + 深蓝主色 + 琥珀代理色） */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* display:grid/flex 会覆盖 hidden 属性，必须显式兜底 */
[hidden] { display: none !important; }

:root {
  --blue: #2b5aa6;
  --blue-deep: #1e3a6e;
  --coral: #f05548;
  --amber: #b45309;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card: #ffffff;
  --radius: 14px;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--text);
  background: #f7fafd;
  min-height: 100vh;
}

/* ===== 登录视图（与 /login 同款双栏） ===== */
.page { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }

.brand-panel {
  background: linear-gradient(150deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  padding: 56px 48px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.brand-panel::after {
  content: ""; position: absolute; right: -120px; bottom: -120px;
  width: 340px; height: 340px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}
.brand-panel::before {
  content: ""; position: absolute; right: 60px; top: -80px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255, 209, 59, 0.14);
}
.brand-logo {
  width: 84px; height: 84px; display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 22px; padding: 11px; margin-bottom: 22px;
  box-shadow: 0 8px 24px rgba(8, 26, 58, .22);
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-panel h1 { font-size: 27px; letter-spacing: 1px; }
.brand-sub { margin: 10px 0 26px; font-size: 14.5px; opacity: 0.85; }
.brand-points { list-style: none; margin-bottom: 30px; }
.brand-points li { font-size: 14px; line-height: 2.1; opacity: 0.92; }
.brand-price {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px; padding: 16px 20px; max-width: 360px;
}
.price-row { display: flex; justify-content: space-between; font-size: 14px; line-height: 2.2; }
.brand-back { margin-top: 30px; color: rgba(255, 255, 255, 0.75); font-size: 13px; text-decoration: none; }
.brand-back:hover { color: #fff; }

.form-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.form-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 18px;
  box-shadow: 0 12px 40px rgba(43, 90, 166, 0.12); padding: 36px 34px 30px;
}
.form-tip { font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field input {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color 0.15s; font-family: inherit;
}
.field input:focus { border-color: var(--blue); }
.form-err {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--coral);
  font-size: 13px; border-radius: 9px; padding: 9px 12px; margin-bottom: 16px;
}
.submit {
  width: 100%; padding: 13px 0; border: 0; border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 2px;
  cursor: pointer; transition: opacity 0.15s; font-family: inherit;
}
.submit:hover { opacity: 0.92; }
.submit:disabled { opacity: 0.6; cursor: wait; }
.form-foot { margin-top: 18px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.8; }
.form-foot a { color: var(--blue); }

/* ===== 工作台 ===== */
.dash { max-width: 1080px; margin: 0 auto; padding: 22px 20px 40px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand-logo {
  height: 38px; width: auto; padding: 0; margin: 0;
  background: transparent; border-radius: 0; box-shadow: none;
}
.brand h1 { font-size: 17px; }
.brand .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.who { font-size: 13px; font-weight: 700; color: var(--amber);
  background: #fff4e5; border: 1px solid #fed7aa; border-radius: 999px; padding: 5px 12px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 9px; padding: 8px 14px; font-size: 13px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; font-family: inherit;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--blue-deep); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: 0 1px 3px rgba(31, 41, 55, .04);
}
.stat .k { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat i { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat .c-amber { color: var(--amber); }
.stat .c-blue { color: var(--blue); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: 0 1px 3px rgba(31, 41, 55, .04);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; }
.muted { color: var(--muted); font-size: 12px; font-weight: 400; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-top: 8px; }

.invite-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff4e5; border: 1px dashed #fed7aa; border-radius: 12px; padding: 14px 16px;
}
.invite-box b { font-size: 26px; letter-spacing: 6px; color: var(--amber); font-variant-numeric: tabular-nums; }
.invite-box .btn { background: #fff; }

.grant-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grant-form input {
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14px; outline: none; font-family: inherit; width: 100%;
}
.grant-form input:focus { border-color: var(--blue); }
.grant-form .btn.primary { grid-column: span 2; justify-content: center; padding: 11px 0; }
.msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.msg.ok { color: #15803d; }
.msg.bad { color: var(--coral); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #f1f4f8; vertical-align: top; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; }
.delta-plus { color: #15803d; font-weight: 600; }
.delta-minus { color: var(--coral); font-weight: 600; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: 12px; word-break: break-all; }

.foot { margin-top: 24px; font-size: 12px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; }
  .brand-panel { padding: 30px 24px 26px; justify-content: flex-start; }
  .brand-points { display: none; }
  .form-panel { padding: 26px 18px 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .grant-form { grid-template-columns: 1fr; }
  .grant-form .btn.primary { grid-column: span 1; }
}

/* ---- 平台公告横幅（管理员 → 代理） ---- */
.plat-notice {
  display: flex; align-items: flex-start; gap: 10px;
  background: #EAF2FE; border: 1.5px solid #BAD4F8; border-radius: 12px;
  padding: 10px 14px; margin-top: 16px;
  font-size: 13.5px; color: #23477E; line-height: 1.6;
}
.plat-notice.warn { background: #FDF3E7; border-color: #F5D6AE; color: #7C4A12; }
.plat-notice span { flex: none; }
.plat-notice[hidden] { display: none; }

/* ---- 渠道公告设置卡 ---- */
.an-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink, #1F2937); }
.an-label .muted { font-weight: 400; }
.an-label textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 13.5px; font-family: inherit; line-height: 1.6; outline: none; resize: vertical;
}
.an-label textarea:focus { border-color: var(--blue); }
.an-row { margin-top: 10px; align-items: center; }
.an-row select {
  padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #fff;
}
.an-check { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.an-check input { width: auto; }
@media (max-width: 720px) { .an-row { flex-wrap: wrap; } }

/* ---- 微信二维码 ---- */
.wx-row { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.wx-row img {
  width: 180px; height: 180px; object-fit: contain;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
.wx-ops { flex: 1; min-width: 220px; }
.wx-ops input[type="file"] { font-size: 13px; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-row .btn { justify-content: center; }

.wx-mask {
  position: fixed; inset: 0; background: rgba(15, 30, 55, .55);
  display: flex; align-items: center; justify-content: center; z-index: 60;
}
.wx-mask[hidden] { display: none; }
.wx-dialog {
  background: #fff; border-radius: 16px; padding: 20px 24px;
  width: min(360px, 92vw); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.wx-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.wx-x { border: 0; background: none; font-size: 20px; cursor: pointer; color: #64748B; }
.wx-dialog img {
  max-width: 260px; max-height: 260px; border-radius: 12px; display: inline-block;
  border: 1.5px solid var(--line);
}
.wx-cap { font-size: 13px; color: #475569; margin-top: 10px; line-height: 1.6; }
.wx-err { font-size: 13px; color: #B4232A; margin-top: 10px; }

/* ---- 拿货价目表 ---- */
#agent-tier-table { overflow-x: auto; }
.ag-tier { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12.5px;
  font-variant-numeric: tabular-nums; }
.ag-tier th { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
  font-size: 11.5px; }
.ag-tier td { padding: 9px 8px; border-bottom: 1px solid #f1f4f8; white-space: nowrap;
  vertical-align: middle; }
.ag-tier tr.cur td { background: #fff9e8; }
.ag-tier tr.cur td:first-child { box-shadow: inset 3px 0 0 #f0b429; }
.ag-tier .tag-cur {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
  background: #ffd43b; color: #7a4b00; font-size: 10.5px; font-weight: 700;
}
@media (max-width: 720px) {
  .ag-tier { font-size: 11.5px; }
  .ag-tier th, .ag-tier td { padding: 7px 4px; }
}
