/* ============================================================
   管理后台 · Rokid 风格（与前台同一套设计语言）
   ============================================================ */

:root {
  --bg: #020806;
  --surface: #07120c;
  --surface-strong: #0a1b10;
  --text: #f4f7f3;
  --muted: #a0aaa2;
  --subtle: #6c776f;
  --line: rgba(126, 255, 150, .16);
  --line-soft: rgba(255, 255, 255, .09);
  --green: #69f466;
  --green-strong: #81ff75;
  --green-dark: #0c3e1b;
  --green-ink: #04120a;
  --danger: #ff6b7a;
  --radius: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 82% -4%, rgba(105, 244, 102, .08), transparent 34rem), var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-strong);
  color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(105, 244, 102, .16);
}
textarea { min-height: 88px; resize: vertical; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  font-size: 14px; font-weight: 680;
  transition: all .16s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(105, 244, 102, .5); background: rgba(105, 244, 102, .08); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: var(--green-ink); font-weight: 750; }
.btn-primary:hover { background: var(--green-strong); }
.btn-danger { border-color: rgba(255, 107, 122, .4); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 107, 122, .1); border-color: var(--danger); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-block { width: 100%; margin-top: 10px; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: min(440px, 100%);
  border: 1px solid var(--line); border-radius: 20px;
  background:
    radial-gradient(circle at 85% 0%, rgba(105, 244, 102, .1), transparent 18rem),
    var(--surface);
  padding: 40px 38px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.login-card h1 { font-size: 24px; letter-spacing: -.03em; font-weight: 800; }
.login-logo {
  width: 46px; height: 46px; object-fit: contain; display: block; margin: 0 auto 14px;
  border-radius: 13px; padding: 8px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 0 0 1px rgba(105, 244, 102, .25), 0 10px 26px rgba(0, 0, 0, .3);
}
.login-card .sub { color: var(--muted); font-size: 13.5px; margin: 10px 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); font-weight: 660; margin-bottom: 7px; }
.inline { display: flex; gap: 9px; }
.inline input { flex: 1; }
.inline .btn { flex: none; white-space: nowrap; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; color: var(--subtle); font-size: 12.5px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; word-break: break-all; }
.ok { color: var(--green); font-size: 13px; min-height: 20px; margin-top: 8px; }
.hint { color: var(--subtle); font-size: 12.5px; margin-top: 14px; line-height: 1.7; }
.diag { margin-top: 14px; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; }
.diag summary { color: var(--subtle); font-size: 12.5px; cursor: pointer; user-select: none; }
.diag pre {
  margin-top: 9px; font-size: 11.5px; color: var(--muted);
  white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow: auto;
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------- 控制台框架 ---------- */
.console { display: none; min-height: 100vh; flex-direction: column; }
.console.show { display: flex; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; min-height: 66px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(2, 8, 6, .88);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand { font-size: 16px; font-weight: 760; letter-spacing: -.02em; display: flex; align-items: center; }
.topbar .brand-logo { width: 22px; height: 22px; object-fit: contain; margin-right: 8px; border-radius: 6px; background: linear-gradient(135deg, var(--green), var(--green-dark)); padding: 2.5px; box-shadow: 0 0 0 1px rgba(105, 244, 102, .25); }
.who { display: flex; align-items: center; color: var(--muted); font-size: 13.5px; }
.who .btn { color: var(--text); }
.layout { display: flex; flex: 1; align-items: stretch; }

/* 侧边栏 */
.side {
  width: 220px; flex: none; padding: 22px 14px;
  border-right: 1px solid var(--line-soft);
}
.side .group {
  color: var(--subtle); font-size: 12px; font-weight: 760;
  letter-spacing: .08em; padding: 8px 12px 10px;
}
.side button {
  display: block; width: 100%; text-align: left;
  padding: 10px 13px; margin-bottom: 3px; border-radius: 11px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 620;
  transition: all .15s ease;
}
.side button:hover { color: var(--text); background: rgba(105, 244, 102, .07); }
.side button.active {
  color: var(--green); background: rgba(105, 244, 102, .1);
  border-color: rgba(105, 244, 102, .25); font-weight: 720;
}
.side button span { display: block; }
.side button em {
  display: block; font-style: normal; font-size: 11.5px; font-weight: 560;
  color: var(--subtle); margin-top: 2px; letter-spacing: .02em;
}
.side button.active em { color: color-mix(in srgb, var(--green) 72%, var(--subtle)); }
.res-page { color: var(--subtle); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }
.thumb { width: 74px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-soft); }

/* 主区 */
.main { flex: 1; padding: 26px 30px 60px; min-width: 0; }
.main-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.main-head h2 { font-size: 22px; letter-spacing: -.03em; font-weight: 780; }
.spacer { flex: 1; }

/* 概览统计卡 */
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 13px; }
.stat-card {
  border: 1px solid var(--line-soft); border-radius: 14px;
  background: var(--surface); padding: 19px 20px;
  transition: all .16s ease;
}
.stat-card:hover { border-color: rgba(105, 244, 102, .4); transform: translateY(-2px); }
.stat-card .n { font-size: 27px; font-weight: 800; letter-spacing: -.02em; color: var(--green); }
.stat-card .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* 数据表 */
.panel {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.panel table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.panel th {
  text-align: left; padding: 12px 16px; color: var(--subtle);
  font-size: 12px; font-weight: 760; letter-spacing: .05em;
  border-bottom: 1px solid var(--line-soft); background: var(--surface-strong);
  white-space: nowrap;
}
.panel td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.panel tr:last-child td { border-bottom: none; }
.panel tr:hover td { background: rgba(105, 244, 102, .04); }
.cell-clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops { display: flex; gap: 7px; flex-wrap: nowrap; }
.tag {
  display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(105, 244, 102, .12); color: var(--green);
}
.tag.off { background: rgba(255, 255, 255, .07); color: var(--subtle); }
.empty { padding: 46px 20px; text-align: center; color: var(--subtle); font-size: 13.5px; }

/* ---------- 编辑弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 4vw;
  background: rgba(1, 5, 3, .82);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.modal.show { display: flex; }
.modal-box {
  width: min(620px, 100%); max-height: 86vh; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); padding: 28px 30px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}
.modal-box h3 { font-size: 18px; letter-spacing: -.02em; font-weight: 780; margin-bottom: 20px; }
.modal-box .field { margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translate(-50%, 20px); z-index: 400;
  background: var(--surface-strong); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 11px 24px; font-size: 14px; font-weight: 620;
  opacity: 0; pointer-events: none; transition: all .25s ease;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* SDK 失败提示条 */
.sdk-banner {
  display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  background: #b3261e; color: #fff; text-align: center;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600;
}
.sdk-banner.show { display: block; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .side { width: 100%; border-right: none; border-bottom: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 4px; }
  .side .group { width: 100%; }
  .main { padding: 20px 16px 50px; }
}

/* 图片上传字段 */
.img-prev { margin-bottom: 9px; }
.img-prev .thumb { width: 120px; height: 74px; }
.img-none { display: inline-block; color: var(--subtle); font-size: 12.5px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 10px; }
.upload-btn { align-self: center; flex: none; cursor: pointer; }
