/* ================= 代理中心（v1.7） ================= */
/* ============ v1.61 视觉统一：代理后台主色从紫靛 → 蓝色（对齐数据驾驶舱） ============
   只覆盖品牌色 token 与品牌浅染底；中性色沿用 style.css。 */
:root {
  --brand: #2563eb;
  --brand-2: #06b6d4;
  --brand-3: #3b82f6;
  --grad: linear-gradient(120deg, #2563eb 0%, #3b82f6 48%, #06b6d4 100%);
  --grad-soft: linear-gradient(120deg, rgba(37,99,235,.12), rgba(6,182,212,.12));
  --brand-ink: #2563eb;
  --brand-ink-2: #1d4ed8;
  --tint-brand: #eff6ff;
  --tint-brand-fg: #2563eb;
  --tint-brand-soft: #eff6ff;
  --chip-on: #eff6ff;
}
[data-theme="dark"] {
  --brand: #60a5fa;
  --brand-2: #22d3ee;
  --brand-3: #93c5fd;
  --grad: linear-gradient(120deg, #60a5fa 0%, #3b82f6 48%, #22d3ee 100%);
  --grad-soft: linear-gradient(120deg, rgba(96,165,250,.22), rgba(34,211,238,.18));
  --brand-ink: #93c5fd;
  --brand-ink-2: #bfdbfe;
  --tint-brand: rgba(37,99,235,.22);
  --tint-brand-fg: #93c5fd;
  --tint-brand-soft: rgba(37,99,235,.16);
  --chip-on: #1e2a47;
}
/* v1.61：点击特效调色板跟随后台蓝色系。fx.js 三端共用，这里用更高优先级
   html:root / html[data-theme] 覆盖其默认紫色，只改后台、不影响前台皮肤。 */
html:root {
  --kxc-1:#2563eb;--kxc-2:#3b82f6;--kxc-3:#06b6d4;--kxc-4:#38bdf8;
  --kxc-5:#22c55e;--kxc-6:#f59e0b;--kxc-7:#f25c8a;
}
html[data-theme="dark"] {
  --kxc-1:#60a5fa;--kxc-2:#93c5fd;--kxc-3:#22d3ee;--kxc-4:#67e8f9;
  --kxc-5:#4ade80;--kxc-6:#fbbf24;--kxc-7:#fb7185;
}
.ag-body { background: var(--bg); }
.ag-body .hidden { display: none !important; }

/* ---------- 登录 ---------- */
.ag-login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden;
  background: radial-gradient(700px 360px at 50% 0%, rgba(37,99,235,.14), transparent 65%), var(--bg);
}
.ag-login-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(680px 420px at 18% 12%, rgba(37,99,235,.12), transparent 62%),
    radial-gradient(560px 380px at 82% 18%, rgba(6,182,212,.10), transparent 60%),
    radial-gradient(700px 500px at 50% 108%, rgba(56,189,248,.10), transparent 62%);
}
.ag-login-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(37,99,235,.10) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .35;
  animation: agGrid 26s linear infinite;
}
@keyframes agGrid { to { background-position: 260px 260px; } }
.ag-login-card {
  position: relative; width: min(420px, 100%); background: var(--card);
  border-radius: 20px; padding: 32px 30px 26px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.ag-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; letter-spacing: -.2px; }
.ag-brand .logo { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.ag-brand em {
  font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--brand-ink);
  background: rgba(37,99,235,.11); border-radius: 999px; padding: 2px 9px; margin-left: 2px;
}
.ag-login-card h1 { font-size: 25px; letter-spacing: -.6px; margin: 20px 0 6px; }
.ag-login-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; line-height: 1.6; }
.ag-login-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 18px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap;
}
.ag-login-foot b { color: var(--brand-ink); }
.ag-back { color: var(--muted); }
.ag-back:hover { color: var(--ink); }

/* ---------- 骨架 ---------- */
.ag-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.ag-side {
  background: #11182b; color: #cdd4e4; border-right: 1px solid rgba(255,255,255,.06);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.ag-side-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; letter-spacing: -.3px; color: #fff; }
.ag-side-brand .logo { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.ag-side-tag {
  display: inline-block; margin-top: 8px; font-size: 11.5px; font-weight: 700; color: #93c5fd;
  background: rgba(96,165,250,.14); border-radius: 8px; padding: 3px 9px; letter-spacing: .4px;
}

/* 侧边余额卡 */
.ag-wallet {
  border-radius: 16px; padding: 15px 16px 14px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 55%, #3b82f6 100%);
  box-shadow: 0 14px 28px rgba(37,99,235,.28);
}
.ag-wallet::after {
  content: ""; position: absolute; right: -30px; top: -40px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255,255,255,.14);
}
.ag-wallet-label { font-size: 11.5px; opacity: .82; letter-spacing: .3px; }
.ag-wallet-num { font-size: 27px; font-weight: 800; letter-spacing: -.8px; margin: 2px 0 10px; font-variant-numeric: tabular-nums; }
.ag-wallet-actions { display: flex; gap: 7px; }
.ag-w-btn {
  /* 这个按钮永远压在紫色渐变钱包卡上（白底 94%），文字必须固定深靛蓝，
     不能跟随深色模式提亮，否则白底浅紫直接看不见 */
  flex: 1; background: rgba(255,255,255,.94); color: #1d4ed8; border-color: transparent;
  font-size: 12.5px; padding: 6px 8px; border-radius: 9px; font-weight: 700;
}
.ag-w-btn:hover { background: var(--card); }
.ag-w-btn.ghost { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.32); }
.ag-w-btn.ghost:hover { background: rgba(255,255,255,.26); }

/* 侧边导航 */
.ag-nav { display: grid; gap: 3px; }
.ag-nav button {
  display: flex; align-items: center; gap: 9px; border: 0; background: none; text-align: left;
  padding: 10px 12px; border-radius: 9px; font-size: 14px; color: #a9b2c7; transition: .16s; font-weight: 500;
}
.ag-nav button i { font-style: normal; font-size: 15px; opacity: .85; }
.ag-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.ag-nav button.on {
  background: linear-gradient(120deg, #2563eb, #3b82f6); color: #fff;
  font-weight: 700; box-shadow: 0 8px 18px rgba(37,99,235,.35);
}
.ag-side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.ag-me { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ag-me-avatar {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 14px; flex: 0 0 auto;
}
.ag-me b { display: block; font-size: 13.5px; line-height: 1.3; color: #e6ebf5; }
.ag-me span { font-size: 11.5px; color: #9aa3ba; }

/* ---------- 主区 ---------- */
.ag-main { padding: 22px 26px 60px; min-width: 0; }
.ag-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.ag-top-left { display: flex; align-items: center; gap: 10px; }
.ag-top h2 { margin: 0; font-size: 20px; letter-spacing: -.5px; }
.ag-menu { display: none; border: 1px solid var(--line); background: var(--card); border-radius: 10px; width: 36px; height: 34px; font-size: 16px; }
.ag-scrim { display: none; } /* v1.61.2 抽屉遮罩，桌面端不渲染 */
.ag-top-right { display: flex; align-items: center; gap: 10px; }
.ag-invite {
  display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--line-2); background: var(--bg-soft);
  border-radius: 11px; padding: 6px 11px; font-size: 12.5px; color: var(--ink-2);
}
.ag-invite span { color: var(--muted); }
.ag-invite b { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; color: var(--brand-ink-2); }
.ag-invite i { font-style: normal; color: #2563eb; font-weight: 700; }
.ag-invite:hover { border-color: #a5a8f0; background: var(--bg-soft); }

/* KPI */
.ag-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.ag-kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px;
  position: relative; overflow: hidden; box-shadow: 0 1px 2px rgba(16,24,40,.03); transition: box-shadow .16s, border-color .16s;
}
/* v1.61：KPI 卡去掉左侧渐变条与 hover 上浮，对齐数据驾驶舱的白卡简约 */
.ag-kpi:hover { box-shadow: 0 8px 22px rgba(23,29,64,.07); border-color: #dbeafe; }
.ag-kpi-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ag-kpi-num { font-size: 24px; font-weight: 800; letter-spacing: -.8px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ag-kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ag-kpi-num small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }

/* 卡片栅格 */
.ag-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.ag-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.ag-card + .ag-card { margin-top: 0; }
/* v1.20.2：补齐 span-1 ~ span-12 全量跨度
   以前只写了 span-5/7/12，公告通知页用的 span-6 没有规则，卡片掉进 12 列栅格只占 1 列（约 82px），
   标题/正文全被挤成竖条溢出错乱。补齐后任何 span-N 都有对应跨度，新增页面不会再踩。 */
.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-10 { grid-column: span 10; }
.span-11 { grid-column: span 11; }
.span-12 { grid-column: span 12; }
.ag-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ag-card-head h3 { margin: 0; font-size: 14.5px; letter-spacing: -.2px; display: flex; align-items: center; gap: 7px; }
/* v1.61：去掉标题竖条，对齐数据驾驶舱的简约卡片头 */
.ag-muted { font-size: 12px; color: var(--muted); font-weight: 400; }

/* 动账列表 */
.ag-list { display: flex; flex-direction: column; }
.ag-list-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--chip); font-size: 13px;
}
.ag-list-item:last-child { border-bottom: 0; }
.ag-list-item .t { font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ag-list-item .n { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-list-item .m { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-plus { color: var(--ok); }
.ag-minus { color: var(--tint-rose-fg); }
.ag-list-item .d { color: #9aa1b2; font-size: 11.5px; white-space: nowrap; }

/* 邀请卡 */
.ag-invite-box { border: 1px dashed var(--line-2); border-radius: 14px; padding: 16px; background: var(--bg-soft); text-align: center; }
.ag-invite-code {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 26px; font-weight: 800;
  letter-spacing: 5px; color: var(--brand-ink-2); line-height: 1.2;
}
.ag-invite-link { font-size: 11.5px; color: var(--muted); margin: 6px 0 12px; word-break: break-all; }
.ag-invite-ops { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
/* v1.20.1：代理自己改邀请码的内联编辑行 */
.ag-code-edit { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.ag-code-edit .input { max-width: 210px; text-transform: uppercase; letter-spacing: 2px; font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; text-align: center; }
.ag-tip {
  margin-top: 12px; font-size: 12.5px; color: #6b7280; background: var(--field);
  border-radius: 10px; padding: 9px 11px; line-height: 1.6;
}

/* 到期客户 */
.ag-expire { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ag-expire-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px;
}
.ag-expire-item .who { flex: 1; min-width: 0; }
.ag-expire-item b { font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-expire-item span { font-size: 11.5px; color: var(--muted); }
.ag-expire-item .btn { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.ag-expire-item.warn { border-color: #fde3c0; background: var(--tint-amber); }
.ag-expire-item.dead { border-color: #fbd5dd; background: var(--tint-pink); }

/* 工具条 */
.ag-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.ag-toolbar-left, .ag-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input.sm { padding: 8px 11px; font-size: 13.5px; width: 200px; background: var(--card); }
.table-wrap { overflow-x: auto; }
.pager { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; background: var(--chip); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--card); color: var(--brand-ink); box-shadow: 0 2px 8px rgba(16,24,40,.08); }

/* 表格和徽标 */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 8px; border-bottom: 1px solid var(--chip); color: var(--ink-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .u { font-weight: 700; color: var(--ink); }
.table .sub { font-size: 11.5px; color: var(--muted); }
.ag-badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: var(--chip); color: var(--ink-2);
}
.ag-badge.ok { background: rgba(18,161,80,.10); color: var(--tint-green-fg); }
.ag-badge.warn { background: rgba(217,119,6,.12); color: var(--tint-yellow-fg); }
.ag-badge.dead { background: rgba(225,29,72,.10); color: var(--tint-rose-fg); }
.ag-badge.brand { background: rgba(37,99,235,.12); color: var(--brand-ink-2); }
.ag-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.ag-actions .btn { padding: 4px 9px; font-size: 12px; border-radius: 8px; }
.ag-empty { padding: 26px 10px; text-align: center; color: var(--muted); font-size: 13px; }

/* 开通套餐 */
.ag-buy-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.ag-buy-left { position: sticky; top: 16px; }
.ag-cust-pick { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.ag-cust-item {
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; cursor: pointer; transition: .15s;
  display: flex; align-items: center; gap: 9px; background: var(--card);
}
.ag-cust-item:hover { border-color: var(--line-2); background: var(--field); }
.ag-cust-item.on { border-color: #2563eb; background: rgba(37,99,235,.06); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.ag-cust-item .ic {
  width: 28px; height: 28px; border-radius: 9px; background: var(--field); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 12.5px; flex: 0 0 auto;
}
.ag-cust-item .info { min-width: 0; flex: 1; }
.ag-cust-item b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-cust-item span { font-size: 11.5px; color: var(--muted); }
.ag-pkgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ag-pkg {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: .18s;
  background: var(--card); position: relative;
}
.ag-pkg:hover { border-color: var(--line-2); box-shadow: 0 8px 20px rgba(23,29,64,.06); transform: translateY(-1px); }
.ag-pkg.on { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.14); }
.ag-pkg-name { font-weight: 800; font-size: 14.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ag-pkg-name em { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--tint-yellow-fg); background: var(--tint-yellow); border-radius: 999px; padding: 1px 7px; }
.ag-pkg-meta { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.ag-pkg-price { display: flex; align-items: baseline; gap: 7px; }
.ag-pkg-price b { font-size: 20px; letter-spacing: -.6px; color: var(--brand-ink-2); font-variant-numeric: tabular-nums; }
.ag-pkg-price s { font-size: 12px; color: #a3aab9; }
.ag-pkg-unit { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ag-pkg-feat { margin: 10px 0 0; padding: 0; list-style: none; font-size: 11.5px; color: #6b7280; display: grid; gap: 3px; }
.ag-pkg-feat li::before { content: "·"; margin-right: 5px; color: #a5a8f0; }
.ag-buy-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); flex-wrap: wrap;
}
.ag-buy-bar b { font-size: 24px; letter-spacing: -.8px; color: var(--brand-ink-2); margin-left: 8px; font-variant-numeric: tabular-nums; }

/* 余额页 */
.ag-wallet-card { background: linear-gradient(160deg, var(--bg-soft), var(--card) 55%); }
.ag-big-money { font-size: 38px; font-weight: 800; letter-spacing: -1.4px; color: var(--brand-ink-2); font-variant-numeric: tabular-nums; }
.ag-wallet-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.ag-amount-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ag-amount {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 16px;
  font-size: 14px; font-weight: 700; color: var(--ink-2); transition: .15s;
}
.ag-amount:hover { border-color: var(--line-2); }
.ag-amount.on { border-color: #2563eb; background: rgba(37,99,235,.07); color: var(--brand-ink-2); }
.ag-recharge-row { display: flex; gap: 9px; flex-wrap: wrap; }
.ag-recharge-row .input { flex: 1; min-width: 160px; }
.ag-qr-box {
  margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  background: var(--bg-soft); text-align: center;
}
.ag-qr-box h4 { margin: 0 0 4px; font-size: 14px; }
.ag-qr-box .amt { font-size: 26px; font-weight: 800; color: var(--brand-ink-2); letter-spacing: -.8px; }
.ag-qr-imgs { display: flex; gap: 18px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.ag-qr-imgs figure { margin: 0; }
.ag-qr-imgs img { width: 148px; height: 148px; object-fit: contain; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.ag-qr-imgs figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ag-qr-ops { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.ag-qr-note { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }

/* 弹窗辅助 */
.ag-modal-row { display: flex; gap: 10px; }
.ag-modal-row > * { flex: 1; }
.ag-pay-link { display: inline-block; margin-top: 10px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .ag-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-7, .span-6, .span-5 { grid-column: span 12; }
  .ag-buy-wrap { grid-template-columns: 1fr; }
  .ag-buy-left { position: static; }
}
@media (max-width: 860px) {
  .ag-shell { grid-template-columns: 1fr; }
  .ag-side {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 250px; height: 100vh;
    transform: translateX(-104%); transition: transform .24s ease; box-shadow: 0 20px 50px rgba(6,10,30,.22);
  }
  .ag-side.open { transform: translateX(0); }
  /* v1.61.2 抽屉遮罩：与 .ag-side.open 联动，点遮罩收回 */
  .ag-scrim {
    display: block; position: fixed; inset: 0; z-index: 59;
    background: rgba(6,10,30,.48);
    opacity: 0; pointer-events: none; transition: opacity .24s ease;
  }
  .ag-side.open ~ .ag-scrim { opacity: 1; pointer-events: auto; }
  .ag-main { padding: 16px 14px 50px; }
  .ag-menu { display: inline-block; }
  .ag-top h2 { font-size: 17px; }
  .ag-invite span, .ag-invite i { display: none; }
  .ag-toolbar-left .input.sm, .ag-toolbar-left select.input.sm { width: 148px; }
}
@media (max-width: 560px) {
  .ag-kpis { grid-template-columns: 1fr 1fr; gap: 9px; }
  .ag-kpi-num { font-size: 20px; }
  .ag-invite-code { font-size: 22px; letter-spacing: 3px; }
  .ag-pkgs { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .ag-login-bg::after { animation: none; }
}

/* ---------- v1.8 代理端公告 ---------- */
.ag-nav button { position: relative; }
.ag-nav-dot {
  position: absolute; top: 8px; right: 10px; width: 7px; height: 7px; border-radius: 50%;
  background: #f43f5e; box-shadow: 0 0 0 3px rgba(244,63,94,.18);
  animation: agDotPulse 1.8s ease-in-out infinite;
}
@keyframes agDotPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.82); } }

.ag-notice-list { display: grid; gap: 10px; max-height: 520px; overflow: auto; }
.ag-notice-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: var(--card); transition: box-shadow .2s ease, border-color .2s ease;
}
.ag-notice-item:hover { box-shadow: 0 8px 20px rgba(23,29,64,.07); }
.ag-notice-item.pinned { border-color: rgba(245,158,11,.4); background: linear-gradient(180deg, rgba(254,252,232,.7), var(--card) 55%); }
.ag-ni-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.ag-ni-head b { font-size: 14px; }
.ag-ni-time { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ag-ni-body { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.ag-ni-ops { display: flex; gap: 8px; margin-top: 8px; }
.ag-ni-ops .btn { font-size: 12px; padding: 5px 10px; }

@media (max-width: 860px) {
  .ag-notice-list { max-height: none; }
}

/* 复选框行（发布公告弹窗用） */
.ag-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2); margin: 4px 0 6px; cursor: pointer;
}
.ag-check input { width: 16px; height: 16px; accent-color: #2563eb; cursor: pointer; }

/* ================= v1.9：实况图 ================= */
.ag-live-card { margin-bottom: 14px; padding: 18px 20px 14px; overflow: hidden; }
.ag-live-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ag-live-head h3 { display: flex; align-items: center; gap: 9px; font-size: 15.5px; margin: 0 0 3px; }
.ag-live-head p { margin: 0; font-size: 12px; }
.ag-live-head p b { color: var(--brand-ink); }
.ag-live-ops { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 「实时」呼吸点 */
.ag-live-dot {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  color: var(--ok); background: rgba(18,161,80,.10); border-radius: 999px; padding: 2px 8px;
}
.ag-live-dot i {
  width: 6px; height: 6px; border-radius: 50%; background: #12a150;
  box-shadow: 0 0 0 0 rgba(18,161,80,.55); animation: agLivePulse 1.9s ease-out infinite;
}
@keyframes agLivePulse {
  0% { box-shadow: 0 0 0 0 rgba(18,161,80,.55); }
  70% { box-shadow: 0 0 0 7px rgba(18,161,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(18,161,80,0); }
}

/* 分段选择器 */
.ag-seg { display: inline-flex; background: var(--field); border-radius: 10px; padding: 3px; gap: 2px; }
.ag-seg button {
  border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--muted); padding: 6px 11px; border-radius: 8px; cursor: pointer;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
.ag-seg button:hover { color: var(--ink); }
.ag-seg button.on { background: var(--card); color: var(--brand-ink-2); box-shadow: 0 1px 3px rgba(23,29,64,.12); }

/* 指标数字 */
.ag-live-nums { display: flex; gap: 22px; flex-wrap: wrap; margin: 14px 0 6px; }
.ag-live-num { min-width: 92px; }
.ag-live-num span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.ag-live-num b {
  font-size: 21px; letter-spacing: -.5px; font-variant-numeric: tabular-nums;
  color: var(--ink); /* v1.61：实况数字从渐变文字改纯色，对齐数据驾驶舱 */
}
.ag-live-num em { font-style: normal; font-size: 11.5px; color: var(--muted); margin-left: 4px; }

/* 图表容器 */
.ag-chart { position: relative; width: 100%; height: 210px; margin-top: 6px; }
.ag-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ag-chart .gl { stroke: var(--chip); stroke-width: 1; }
.ag-chart .gl-base { stroke: #e2e5f2; }
.ag-chart .area { opacity: .9; }
.ag-chart .ln {
  fill: none; stroke: url(#liveGrad); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
}
.ag-chart .ln-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: agLineDraw 1s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes agLineDraw { to { stroke-dashoffset: 0; } }
.ag-chart .pt { fill: #fff; stroke: #2563eb; stroke-width: 2; opacity: 0; animation: agDotIn .32s ease forwards; }
@keyframes agDotIn { to { opacity: 1; } }
.ag-chart .pt-last { fill: #2563eb; stroke: #fff; stroke-width: 2.4; }
.ag-chart .pt-last-ring {
  fill: none; stroke: rgba(37,99,235,.45); stroke-width: 2;
  transform-box: fill-box; transform-origin: center; animation: agRing 1.8s ease-out infinite;
}
@keyframes agRing { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(2.1); opacity: 0; } }
.ag-chart .xl { font-size: 10.5px; fill: #9aa3b8; }
.ag-chart .yl { font-size: 10px; fill: #b6bccd; }
.ag-chart .hit { fill: transparent; cursor: pointer; }
.ag-chart .bar { fill: url(#liveBar); opacity: 0; animation: agBarIn .6s cubic-bezier(.2,.9,.3,1) forwards; transform-box: fill-box; transform-origin: bottom; }
@keyframes agBarIn { from { opacity: .2; transform: scaleY(.05); } to { opacity: 1; transform: scaleY(1); } }
.ag-chart-tip {
  position: absolute; pointer-events: none; z-index: 3; min-width: 96px;
  background: rgba(13,20,36,.94); color: #fff; border-radius: 9px; padding: 7px 10px;
  font-size: 11.5px; line-height: 1.55; opacity: 0; transform: translate(-50%, -8px);
  transition: opacity .14s ease; white-space: nowrap; box-shadow: 0 8px 22px rgba(8,12,28,.3);
}
.ag-chart-tip.on { opacity: 1; }
.ag-chart-tip b { font-size: 13px; }
.ag-chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12.5px; color: var(--muted);
}

/* ================= v1.9：我的卡密 ================= */
.ag-card-intro {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap; margin-bottom: 14px; padding: 16px 20px;
  background: linear-gradient(120deg, rgba(37,99,235,.07), rgba(6,182,212,.06) 60%, var(--card));
  border-color: rgba(37,99,235,.18);
}
.ag-intro-main h3 { margin: 0 0 5px; font-size: 15.5px; }
.ag-intro-main p { margin: 0; font-size: 12.5px; line-height: 1.7; max-width: 720px; }
.ag-intro-side { display: flex; gap: 12px; }
.ag-mini {
  min-width: 104px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 13px; text-align: center;
}
.ag-mini span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.ag-mini b { font-size: 17px; letter-spacing: -.4px; color: var(--brand-ink-2); font-variant-numeric: tabular-nums; }

.ag-card-stats { display: flex; gap: 20px; flex-wrap: wrap; padding: 0 2px 12px; font-size: 12.5px; color: var(--muted); }
.ag-card-stats b { color: var(--ink); font-size: 14px; margin-left: 3px; }

.ag-card-code {
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 12.5px; letter-spacing: .6px;
  color: var(--ink-strong); background: var(--field); border-radius: 6px; padding: 2px 7px; cursor: pointer;
  border: 1px dashed transparent; transition: border-color .16s ease, background .16s ease;
}
.ag-card-code:hover { border-color: #c7cbe8; background: #eef0fa; }

.ag-card-pkg { font-weight: 600; }
.ag-card-pkg small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }

/* 生成卡片弹窗里的成本预览 */
.ag-cost-box {
  margin: 4px 0 8px; border-radius: 12px; padding: 12px 14px; font-size: 13px;
  background: linear-gradient(120deg, rgba(37,99,235,.08), rgba(6,182,212,.07));
  border: 1px solid rgba(37,99,235,.16);
}
.ag-cost-box .row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.ag-cost-box .row b { color: var(--brand-ink-2); }
.ag-cost-box .total { border-top: 1px dashed rgba(37,99,235,.28); margin-top: 6px; padding-top: 7px; font-weight: 700; }
.ag-cost-box .total b { font-size: 17px; }

/* ================= v1.9：点击特效 ================= */
.ag-fx {
  position: fixed; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  pointer-events: none; z-index: 9998; border: 2px solid rgba(37,99,235,.7);
  animation: agFxRing .62s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes agFxRing {
  0% { transform: scale(.25); opacity: .95; }
  100% { transform: scale(2.1); opacity: 0; }
}
.ag-spark {
  position: fixed; width: 5px; height: 5px; border-radius: 50%; pointer-events: none;
  z-index: 9997; animation: agSparkFly .66s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes agSparkFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}

/* KPI 数字滚动 */
.ag-kpi-num.pop { animation: agNumPop .42s cubic-bezier(.2,.9,.3,1); }
@keyframes agNumPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.11); }
  100% { transform: scale(1); }
}

@media (max-width: 860px) {
  .ag-live-nums { gap: 14px; }
  .ag-live-num { min-width: 74px; }
  .ag-chart { height: 180px; }
  .ag-card-intro { flex-direction: column; align-items: stretch; }
  .ag-intro-side { justify-content: space-between; }
  .ag-mini { flex: 1; }
}
@media (max-width: 560px) {
  .ag-live-head { flex-direction: column; }
  .ag-live-ops { width: 100%; }
  .ag-seg { flex: 1; overflow-x: auto; }
  .ag-seg button { padding: 6px 8px; font-size: 12px; white-space: nowrap; }
  .ag-chart { height: 160px; }
  .ag-live-num b { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .ag-live-dot i, .ag-chart .pt-last-ring, .ag-chart .bar { animation: none !important; }
  .ag-chart .ln-draw { animation: none !important; stroke-dashoffset: 0 !important; }
  .ag-chart .pt, .ag-chart .bar { opacity: 1 !important; }
  .ag-fx, .ag-spark { display: none !important; }
  .ag-kpi-num.pop { animation: none !important; }
}

/* ==================================================================
   v1.12 深色模式（代理端）
   ================================================================== */
[data-theme="dark"] .ag-side { background: #0a0e19; border-right-color: var(--line); }
[data-theme="dark"] .ag-nav button:hover { background: rgba(255,255,255,.06); }
[data-theme="dark"] .ag-menu { background: var(--card); color: var(--ink); }
[data-theme="dark"] .ag-invite { background: rgba(37,99,235,.14); border-color: rgba(59,130,246,.45); }
[data-theme="dark"] .ag-invite:hover { background: rgba(37,99,235,.22); border-color: var(--brand); }
[data-theme="dark"] .ag-top { background: rgba(17,23,38,.9); border-bottom-color: var(--line); }
[data-theme="dark"] .ag-login-card { background: var(--card); }
[data-theme="dark"] .ag-card,
[data-theme="dark"] .ag-kpi,
[data-theme="dark"] .ag-invite-box { background: var(--card); }
[data-theme="dark"] .ag-w-btn:hover { background: rgba(255,255,255,.1); }
[data-theme="dark"] .ag-table th { background: var(--bg-soft); }
[data-theme="dark"] .ag-table tr:hover td { background: rgba(255,255,255,.035); }

/* v1.41 深色模式白边收口：hover 浅底与到期提醒的浅色描边在深色下会发白 */
[data-theme="dark"] .ag-card-code:hover { background: var(--chip); }
[data-theme="dark"] .ag-expire-item.warn { border-color: rgba(245,158,11,.38); }
[data-theme="dark"] .ag-expire-item.dead { border-color: rgba(244,63,94,.38); }
