/* assets/admin-ui.css */
:root{
  --bg0:#f6f7fb;
  --bg1:#eef2ff;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --shadow: 0 12px 30px rgba(2,6,23,.08);
  --radius:14px;
  --accent:#6c5ce7; /* 默认：渠道色 */
  --danger:#d63031;
}

/* 主题色 */
body.theme-admin{ --accent:#0984e3; }
body.theme-channel{ --accent:#6c5ce7; }

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Microsoft YaHei", Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 10% 0%, var(--bg1) 0%, rgba(255,255,255,0) 60%),
    linear-gradient(180deg, var(--bg0) 0%, #ffffff 70%);
}

/* ====== 布局（左侧栏 + 顶栏 + 内容区） ====== */
.shell{
  min-height:100vh;
  display:flex;
}
.sidebar{
  width:248px;
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  color:#e2e8f0;
  display:flex;
  flex-direction:column;
  padding:14px 10px;
  border-right:1px solid rgba(255,255,255,.06);
}
.sidebar__brand{
  font-weight:700;
  font-size:14px;
  letter-spacing:.4px;
  padding:12px 12px;
  border-radius:12px;
  background: rgba(255,255,255,.06);
  margin:4px 6px 10px;
}
.nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:6px;
}
.nav a{
  text-decoration:none;
  color:#e2e8f0;
  padding:10px 12px;
  border-radius:12px;
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
.nav a:hover{ background: rgba(255,255,255,.06); }
.nav a.active{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.sidebar__footer{
  margin-top:auto;
  padding:8px 6px 6px;
}
.nav__logout{
  display:block;
  text-align:center;
  padding:10px 12px;
  border-radius:12px;
  background: rgba(214,48,49,.18);
  border:1px solid rgba(214,48,49,.35);
  color:#ffd3d3 !important;
  text-decoration:none;
}
.nav__logout:hover{ background: rgba(214,48,49,.24); }

.content{ flex:1; min-width:0; }

.topbar{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 18px;
  position:sticky;
  top:0;
  z-index:10;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}
.topbar__title{
  font-weight:700;
  letter-spacing:.2px;
}
.topbar__meta{
  color:var(--muted);
  font-size:13px;
  display:flex;
  align-items:center;
  gap:10px;
}
.topbar__meta .sep{ opacity:.6; }
.topbar__meta a{
  color: var(--accent);
  text-decoration:none;
  font-weight:600;
}
.topbar__meta a:hover{ text-decoration:underline; }

.page{ padding:18px; }

/* ====== 卡片容器 ====== */
.wrap{
  max-width:1200px;
  margin:0 auto;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px;
  box-shadow: var(--shadow);
}

/* ====== 标题 / 文本 ====== */
h2,h3{ margin:0 0 12px; }
h3{ margin-top:18px; }
.muted{ color:var(--muted); font-size:12px; }
code{
  background:#f1f5f9;
  padding:2px 6px;
  border-radius:8px;
  border:1px solid #e2e8f0;
}

/* ====== 表单 ====== */
.grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
@media (max-width: 980px){ .grid{ grid-template-columns: 1fr; } }

.row{ margin:10px 0; }
label{ display:block; font-size:12px; color:var(--muted); margin-bottom:6px; }

input,select{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  font-size:14px;
  outline:none;
  background:#fff;
  transition: box-shadow .15s, border-color .15s;
}
input:focus,select:focus{
  border-color: color-mix(in srgb, var(--accent) 55%, #ffffff 45%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* 按钮 */
button, a.btn{
  appearance:none;
  border:0;
  cursor:pointer;
  border-radius:12px;
  padding:10px 14px;
  font-weight:700;
  font-size:13px;
  background: var(--accent);
  color:#fff;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  box-shadow: 0 10px 20px rgba(2,6,23,.12);
}
button:hover, a.btn:hover{ filter: brightness(0.98); transform: translateY(-1px); }
button:active, a.btn:active{ transform: translateY(0); }

.btnDanger, button.btnDanger{
  background: var(--danger);
}

/* ====== 提示框 ====== */
.ok{
  background: #ecfdf3;
  border:1px solid #bbf7d0;
  color:#166534;
  padding:10px 12px;
  border-radius:12px;
  margin-bottom:10px;
}
.err{
  background: #fff1f2;
  border:1px solid #fecdd3;
  color:#9f1239;
  padding:10px 12px;
  border-radius:12px;
  margin-bottom:10px;
}

/* ====== 表格 ====== */
.table-wrap{
  border:1px solid var(--border);
  border-radius:14px;
  overflow:auto;
}
table{ width:100%; border-collapse:collapse; min-width: 760px; }
th,td{
  padding:12px 12px;
  border-bottom:1px solid var(--border);
  font-size:13px;
  vertical-align:top;
}
th{
  background: #f8fafc;
  color:#334155;
  font-weight:700;
}
tr:nth-child(even) td{ background:#fcfcfd; }
.tag{
  display:inline-block;
  background:#f1f5f9;
  border:1px solid #e2e8f0;
  border-radius:999px;
  padding:3px 10px;
  font-size:12px;
  color:#334155;
}
.actions form{ margin:8px 0; }

/* ====== KPI 卡片 ====== */
.kpi-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  margin:12px 0 6px;
}
@media (max-width: 980px){ .kpi-grid{ grid-template-columns: 1fr; } }
.kpi{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
}
.kpi__label{ color:var(--muted); font-size:12px; }
.kpi__value{ font-size:26px; font-weight:800; margin-top:6px; }
.kpi__sub{ color:var(--muted); font-size:12px; margin-top:4px; }

/* ====== 登录页 ====== */
body.auth{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.box{
  width:100%;
  max-width:460px;
  background:rgba(255,255,255,.9);
  border:1px solid var(--border);
  border-radius:18px;
  padding:26px;
  box-shadow: var(--shadow);
}
.box h2{
  margin:0 0 6px;
  font-size:20px;
}
.tip{ margin-top:12px; color:var(--muted); font-size:12px; line-height:1.6; }

/* ====== 小工具类 ====== */
.w-140{ width:140px; }
.w-160{ width:160px; }
.w-180{ width:180px; }
.w-220{ width:220px; }
.mt-6{ margin-top:6px !important; }
.ml-10{ margin-left:10px !important; }
.row--actions{ margin-top:16px; }
.muted--block{ margin-top:10px; line-height:1.6; }

/* 渠道登录页：更大一点 */
.box--lg{
  max-width: 560px;
  padding: 34px;
}
.box--lg h2{
  font-size: 22px;
}
/* ====== 成品化细节：工具条 / 按钮组 / 分组 / 行操作 ====== */

/* 工具条（表格上方的操作区） */
.toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  margin:12px 0 14px;
}
.toolbar__left, .toolbar__right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

/* 按钮：小号 / 幽灵 / 次级 */
.btn-group{ display:inline-flex; gap:8px; flex-wrap:wrap; }

.btn--sm{ padding:8px 10px; font-size:12px; border-radius:10px; box-shadow:none; }

.btn--ghost{
  background: transparent !important;
  color: var(--text) !important;
  border:1px solid var(--border) !important;
  box-shadow:none !important;
}
.btn--ghost:hover{
  background: #f8fafc !important;
}

.btn--soft{
  background: color-mix(in srgb, var(--accent) 12%, #ffffff) !important;
  color: color-mix(in srgb, var(--accent) 75%, #0f172a) !important;
  border:1px solid color-mix(in srgb, var(--accent) 18%, var(--border)) !important;
  box-shadow:none !important;
}

.btn--danger{
  background: var(--danger) !important;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)) !important;
}

/* 表单分组（把一个页面拆成多个“模块卡片”） */
.section{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
  margin:14px 0;
}
.section__head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.section__title{ font-size:14px; font-weight:800; letter-spacing:.2px; }
.section__desc{ color:var(--muted); font-size:12px; margin-top:4px; }
.note{
  color:var(--muted);
  font-size:12px;
  line-height:1.7;
  padding:10px 12px;
  border:1px dashed var(--border);
  border-radius:12px;
  background:#fff;
}

/* 表格行操作：折叠面板（不写 JS，也能像成品） */
.actionStack{ display:flex; flex-direction:column; gap:8px; }
.actionDetails{ border:1px solid var(--border); border-radius:12px; background:#fff; }
.actionDetails > summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  padding:10px 12px;
  border-radius:12px;
}
.actionDetails > summary::-webkit-details-marker{ display:none; }
.actionDetails[open] > summary{
  border-bottom:1px solid var(--border);
  border-bottom-left-radius:0;
  border-bottom-right-radius:0;
}
.actionPanel{
  padding:10px 12px;
}
.actionPanel .muted{ margin-bottom:6px; display:block; }
.actionDetails--danger{
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
}
.actionDetails--danger > summary{
  color: var(--danger);
}
/* ====== 成品化细节：工具条 / 按钮组 / 分组 / 行操作 ====== */
.toolbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; flex-wrap:wrap;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  margin:12px 0 14px;
}
.toolbar__left, .toolbar__right{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
}

.btn-group{ display:inline-flex; gap:8px; flex-wrap:wrap; }
.btn--sm{ padding:8px 10px; font-size:12px; border-radius:10px; box-shadow:none; }

.btn--ghost{
  background: transparent !important;
  color: var(--text) !important;
  border:1px solid var(--border) !important;
  box-shadow:none !important;
}
.btn--ghost:hover{ background:#f8fafc !important; }

.btn--soft{
  background: color-mix(in srgb, var(--accent) 12%, #ffffff) !important;
  color: color-mix(in srgb, var(--accent) 75%, #0f172a) !important;
  border:1px solid color-mix(in srgb, var(--accent) 18%, var(--border)) !important;
  box-shadow:none !important;
}

.btn--danger{
  background: var(--danger) !important;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)) !important;
}

/* 分组卡片 */
.section{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
  margin:14px 0;
}
.section__head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.section__title{ font-size:14px; font-weight:800; letter-spacing:.2px; }
.section__desc{ color:var(--muted); font-size:12px; margin-top:4px; }

.note{
  color:var(--muted);
  font-size:12px;
  line-height:1.7;
  padding:10px 12px;
  border:1px dashed var(--border);
  border-radius:12px;
  background:#fff;
}

/* 行操作折叠面板（无 JS） */
.actionStack{ display:flex; flex-direction:column; gap:8px; }
.actionDetails{ border:1px solid var(--border); border-radius:12px; background:#fff; }
.actionDetails > summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  padding:10px 12px;
  border-radius:12px;
}
.actionDetails > summary::-webkit-details-marker{ display:none; }
.actionDetails[open] > summary{
  border-bottom:1px solid var(--border);
  border-bottom-left-radius:0;
  border-bottom-right-radius:0;
}
.actionPanel{ padding:10px 12px; }
.actionPanel .muted{ margin-bottom:6px; display:block; }
.actionDetails--danger{
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
}
.actionDetails--danger > summary{ color: var(--danger); }
/* === MOBILE_RESP_V1 2026-01-28：后台手机端自适应（左侧栏变顶部） === */
@media (max-width: 900px){
  .shell{
    flex-direction: column !important;
    width: 100% !important;
  }

  /* 左侧栏变顶部栏 */
  .sidebar{
    width: 100% !important;
    padding: 10px 8px !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,.06) !important;
  }

  /* 菜单横向滚动 */
  .nav{
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    gap: 8px !important;
    padding: 6px 4px !important;
  }
  .nav a{
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    padding: 8px 10px !important;
  }

  /* 内容区占满屏幕 */
  .content{ min-width: 0 !important; }
  .page{ padding: 10px !important; }
  .wrap{ padding: 12px !important; border-radius: 12px !important; }
  .topbar{ padding: 10px 12px !important; }

  /* 手机端先隐藏侧栏底部退出区，避免挤压 */
  .sidebar__footer{ display: none !important; }
}

@media (max-width: 420px){
  .topbar__title{ font-size: 16px !important; }
}
