:root {
  --bg: #0A0E14; --panel: #111823; --panel2: #172231; --line: #223047;
  --tx: #DCE3EC; --dim: #8A97A8; --blue: #4C8DFF; --green: #3FB950;
  --red: #F85149; --amber: #D29922;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--tx);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif; font-size: 15px;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 24px 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; margin-bottom: 16px;
}
h1 { font-size: 26px; } h2 { font-size: 19px; margin-bottom: 14px; }
.dim { color: var(--dim); font-size: 13px; }
input, textarea, select {
  width: 100%; background: var(--bg); color: var(--tx);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; outline: none; margin: 6px 0;
}
input:focus, textarea:focus { border-color: var(--blue); }
textarea { resize: vertical; min-height: 90px; font-family: monospace; }
button, .btn {
  display: inline-block; background: var(--blue); color: #fff; border: none;
  border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer;
  margin: 6px 6px 6px 0;
}
button:hover, .btn:hover { filter: brightness(1.15); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--tx); }
button.green { background: var(--green); }
button.red { background: var(--red); }
button:disabled { opacity: .5; cursor: not-allowed; }
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
header.top .brand { font-weight: 600; font-size: 17px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 500; font-size: 13px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag.ok { background: rgba(63,185,80,.15); color: var(--green); }
.tag.err { background: rgba(248,81,73,.15); color: var(--red); }
.tag.warn { background: rgba(210,153,34,.15); color: var(--amber); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 220px; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto;
}
.plat-card {
  display: flex; align-items: center; gap: 14px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 10px;
}
.plat-emoji {
  width: 42px; height: 42px; border-radius: 10px; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--blue); border: 1px solid var(--line);
  flex-shrink: 0;
}
.plat-card .grow { flex: 1; min-width: 0; }
.plat-card .name { font-weight: 600; }
.price-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 16px;
  text-align: center; cursor: pointer; background: var(--panel2);
}
.price-card.sel { border-color: var(--blue); background: rgba(76,141,255,.08); }
.price-card .p { font-size: 22px; font-weight: 700; color: var(--blue); }
ol.tut { padding-left: 20px; line-height: 1.9; font-size: 13.5px; color: var(--dim); }
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line); color: var(--tx);
  padding: 10px 20px; border-radius: 10px; z-index: 99; display: none;
  max-width: 90vw;
}
.hero {
  text-align: center; padding: 60px 16px 30px;
}
.hero h1 { font-size: 34px; margin-bottom: 12px; }
.hero p { color: var(--dim); font-size: 16px; margin-bottom: 8px; }
.auth-box { max-width: 400px; width: calc(100% - 32px); margin: 20px auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button {
  flex: 1; margin: 0; padding: 8px 0; font-size: 13.5px;
  background: transparent; border: 1px solid var(--line); color: var(--dim);
}
.tabs button:hover { filter: none; border-color: var(--blue); color: var(--tx); }
.tabs button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
button.wide { width: 100%; margin-top: 10px; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; min-width: 0; }
.code-row button { white-space: nowrap; margin: 6px 0; }
.cap-img {
  width: 120px; height: 40px; flex: 0 0 120px;
  border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; object-fit: cover; background: var(--panel2);
}
.auth-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 12.5px; color: var(--dim); }
.auth-links span { cursor: pointer; }
.auth-links span:hover { color: var(--blue); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
code.k { background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

/* ================================================================
   工作台（/app）
   ================================================================ */
body.wb { background:
  radial-gradient(1200px 500px at 70% -10%, rgba(76,141,255,.07), transparent 60%),
  var(--bg);
}
.wb-main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 60px; }

/* 顶栏 */
.wb-top {
  border-bottom: 1px solid var(--line);
  background: rgba(17,24,35,.85); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.wb-top-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.brand-sub { color: var(--blue); font-weight: 600; font-size: 13px; margin-left: 6px; }

/* 右上角用户区 */
.wb-user { position: relative; display: flex; align-items: center; gap: 12px; }
.avatar-btn {
  display: flex; align-items: center; gap: 8px; margin: 0;
  background: transparent; border: 1px solid var(--line); border-radius: 24px;
  padding: 4px 10px 4px 4px; cursor: pointer;
}
.avatar-btn:hover { border-color: var(--blue); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #4C8DFF, #7B5BFF);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar-mail { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.caret { color: var(--dim); font-size: 11px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 150px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; display: none; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.menu.show { display: block; }
.menu button {
  display: block; width: 100%; margin: 0; background: transparent;
  color: var(--tx); text-align: left; border-radius: 8px; padding: 9px 12px;
  font-size: 13.5px;
}
.menu button:hover { background: rgba(76,141,255,.12); }
.menu .menu-danger:hover { background: rgba(248,81,73,.12); color: var(--red); }

/* 统计卡片 */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; transition: border-color .18s ease, transform .18s ease;
}
.stat:hover { border-color: rgba(76,141,255,.45); transform: translateY(-2px); }
.stat-num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat:nth-child(1) .stat-num { color: var(--green); }
.stat:nth-child(3) .stat-num { color: var(--blue); }
.stat-label { margin-top: 4px; }

/* 区块 */
.sec { margin-bottom: 30px; }
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.sec-head h2 { font-size: 18px; margin: 0; }
.add-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.add-btn[data-platform="trae"]:hover { border-color: #5B9BFF; color: #5B9BFF; }
.add-btn[data-platform="zhipu"]:hover { border-color: #A78BFA; color: #A78BFA; }
.add-btn[data-platform="qoder"]:hover { border-color: #F5A623; color: #F5A623; }

/* 通道卡片网格 */
.ch-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px;
}
.ch-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.ch-card:hover {
  border-color: rgba(76,141,255,.45); transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.ch-head { display: flex; align-items: center; gap: 12px; }
.ch-info { flex: 1; min-width: 0; }
.ch-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line); padding-top: 12px;
}
.ch-last { font-size: 12.5px; color: var(--tx); display: flex; align-items: center; gap: 6px; min-width: 0; }
.ch-last .dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-acts { display: flex; gap: 6px; flex-shrink: 0; }
button.sm { padding: 6px 12px; font-size: 12.5px; margin: 0; border-radius: 7px; }
button.danger:hover { border-color: var(--red); color: var(--red); }

/* 平台徽章（颜色按平台可扩展，未知平台走默认） */
.plat-badge {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
  background: rgba(76,141,255,.14); color: #6BA3FF;
  border: 1px solid rgba(76,141,255,.3);
}
.plat-badge.sm { width: 26px; height: 26px; border-radius: 7px; font-size: 10px; }
.plat-badge[data-platform="trae"] { background: rgba(59,130,246,.15); color: #5B9BFF; border-color: rgba(59,130,246,.35); }
.plat-badge[data-platform="zhipu"] { background: rgba(167,139,250,.15); color: #A78BFA; border-color: rgba(167,139,250,.35); }
.plat-badge[data-platform="qoder"] { background: rgba(245,166,35,.15); color: #F5A623; border-color: rgba(245,166,35,.35); }
.log-row[data-platform="trae"] .plat-badge { background: rgba(59,130,246,.15); color: #5B9BFF; border-color: rgba(59,130,246,.35); }
.log-row[data-platform="zhipu"] .plat-badge { background: rgba(167,139,250,.15); color: #A78BFA; border-color: rgba(167,139,250,.35); }
.log-row[data-platform="qoder"] .plat-badge { background: rgba(245,166,35,.15); color: #F5A623; border-color: rgba(245,166,35,.35); }
.log-row[data-platform="system"] .plat-badge { background: rgba(138,151,168,.14); color: var(--dim); border-color: var(--line); }

/* 状态点 */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.g { background: var(--green); box-shadow: 0 0 6px rgba(63,185,80,.7); }
.dot.r { background: var(--red); }
.dot.a { background: var(--amber); }

/* 筛选 chips + 记录流 */
.log-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; }
.chip {
  background: transparent; border: 1px solid var(--line); color: var(--dim);
  border-radius: 18px; padding: 5px 14px; font-size: 12.5px; margin: 0; cursor: pointer;
}
.chip:hover { color: var(--tx); border-color: var(--blue); }
.chip.on { background: rgba(76,141,255,.14); color: var(--blue); border-color: rgba(76,141,255,.45); }
.log-filters select { width: auto; margin: 0; padding: 6px 10px; font-size: 12.5px; }
.loglist {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
}
.log-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.log-row:last-child { border-bottom: none; }
.log-row:hover { background: rgba(76,141,255,.04); }
.log-time { flex-shrink: 0; width: 150px; font-variant-numeric: tabular-nums; }
.log-name { flex-shrink: 0; font-weight: 500; }
.log-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 续费 */
.renew-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.renew-row input { flex: 1; min-width: 200px; margin: 0; }
.renew-row button { margin: 0; white-space: nowrap; }

/* 空状态 */
.empty { text-align: center; padding: 44px 16px; grid-column: 1 / -1; }
.empty.slim { padding: 22px 16px; }
.empty-icon {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px;
  border: 1px dashed var(--line); color: var(--dim); font-size: 24px;
  display: flex; align-items: center; justify-content: center;
}
.empty-title { font-weight: 600; margin-bottom: 6px; }

/* 个人中心 */
.profile { margin-top: 12px; }
.p-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.p-row:last-child { border-bottom: none; }
.tx-red { color: var(--red); }

/* 骨架屏 */
.skel { position: relative; overflow: hidden; min-height: 72px; }
.skel-line {
  height: 13px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(90deg, var(--panel2) 25%, #1e2c40 50%, var(--panel2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
.w60 { width: 60%; } .w50 { width: 50%; } .w40 { width: 40%; } .w30 { width: 30%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skel-line { animation: none; }
  .stat:hover, .ch-card:hover { transform: none; }
}

/* 响应式 */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ch-grid { grid-template-columns: 1fr; }
  .log-time { width: auto; }
  .log-row { flex-wrap: wrap; row-gap: 4px; }
  .log-msg { flex-basis: 100%; white-space: normal; }
  .avatar-mail { display: none; }
}

/* 浅色主题（所有页面通用 body.light） */
body.light {
  --bg: #F4F6FA; --panel: #FFFFFF; --panel2: #EDF1F7; --line: #DDE4EE;
  --tx: #1C2530; --dim: #69758A; --blue: #2E7CF6; --green: #1F9D4D;
  --red: #D9483B; --amber: #A9701A;
}
body.wb.light {
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(46,124,246,.06), transparent 60%),
    var(--bg);
}
body.light .wb-top { background: rgba(255,255,255,.85); }
body.light .ch-card:hover { box-shadow: 0 8px 24px rgba(30,60,120,.10); }
body.light .menu { box-shadow: 0 10px 30px rgba(30,60,120,.14); }
body.light .toast { box-shadow: 0 8px 24px rgba(30,60,120,.14); }
body.light .skel-line {
  background: linear-gradient(90deg, var(--panel2) 25%, #dee6f2 50%, var(--panel2) 75%);
  background-size: 200% 100%;
}
.theme-btn { flex-shrink: 0; padding: 6px 10px; }

/* 深浅色切换浮动按钮（登录页/管理页，无顶栏） */
.theme-fab {
  position: fixed; top: 14px; right: 14px; z-index: 80;
  margin: 0; width: 38px; height: 38px; padding: 0;
  border-radius: 50%; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

