/* ===== 官网同源色板 ===== */
:root{
  --bg:#07090d;
  --card:#12181f;
  --card-2:#0e141b;
  --side:#0b1017;
  --line:rgba(255,255,255,.08);
  --text:#eef3f6;
  --muted:#93a1af;
  --cyan:#7ef0ff;
  --cyan-2:#b8f7ff;
  --ink:#062027;
  --gold:#ffe7a3;
  --ok:#9dffc3;
  --danger:#ffb4b4;
  --shadow:0 24px 80px rgba(0,0,0,.45);
}

/* 关键：防止 display:flex/grid 覆盖 hidden 属性 */
[hidden]{display:none !important}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
html{scroll-behavior:smooth; scroll-padding-top:20px}
body{
  background:
    radial-gradient(880px 380px at 18% -12%, rgba(126,240,255,.14), transparent 62%),
    var(--bg);
  color:var(--text);
  font-family:"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  font-size:15px; line-height:1.5;
  -webkit-text-size-adjust:100%;
}

/* ===== 布局骨架 ===== */
.shell{display:flex; min-height:100vh}

/* ===== 侧边导航 ===== */
.side{
  width:236px; flex:0 0 236px; background:var(--side);
  border-right:1px solid var(--line);
  position:sticky; top:0; height:100vh;
  display:flex; flex-direction:column;
  padding:18px 12px 14px;
}
.side-brand{display:flex; align-items:center; gap:11px; padding:4px 8px 16px; border-bottom:1px solid var(--line); margin-bottom:13px}
.logo{width:34px;height:34px;flex:0 0 auto}
.sb-text{min-width:0}
.sb-text h1{font-size:15px; margin:0; font-weight:650; white-space:nowrap}
.sb-text p{font-size:10.5px; margin:2px 0 0; color:var(--muted); letter-spacing:.4px; white-space:nowrap}

.navlist{display:flex; flex-direction:column; gap:3px}
.navitem{
  position:relative; display:flex; align-items:center; gap:11px;
  padding:9px 11px; border-radius:10px; font-size:13.5px; color:var(--muted);
  text-decoration:none; transition:color .18s ease, background .18s ease;
}
.navitem svg{width:18px;height:18px;flex:0 0 auto; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round}
.navitem:hover{color:var(--text); background:rgba(255,255,255,.04)}
.navitem.active{color:var(--cyan); background:rgba(126,240,255,.09)}
.navitem.active::before{content:""; position:absolute; left:0; top:50%; transform:translateY(-50%); width:3px; height:18px; border-radius:0 3px 3px 0; background:var(--cyan)}
.navitem .txt{white-space:nowrap}

.side-foot{margin-top:auto; padding-top:13px; border-top:1px solid var(--line)}
.side-user{display:flex; align-items:center; gap:10px; padding:6px 8px 10px}
.avatar{
  width:32px;height:32px;flex:0 0 auto; border-radius:50%;
  background:linear-gradient(135deg,var(--cyan),#4fd8ff); color:var(--ink);
  display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700;
}
.u-info{min-width:0}
.u-mail{font-size:12px; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.u-role{font-size:10.5px; color:var(--muted)}
.side-actions{display:flex; gap:8px; padding:0 8px}
.btn-ghost{
  font-size:12.5px; text-decoration:none; color:var(--muted);
  border:1px solid var(--line); padding:5px 13px; border-radius:999px;
  transition:all .18s ease;
}
.btn-ghost:hover{border-color:rgba(126,240,255,.5); color:var(--cyan)}

/* ===== 内容区 ===== */
.content{flex:1; min-width:0; padding:22px 26px 50px}
.page-head{display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; margin-bottom:20px}
.page-head h2{font-size:24px; margin:0; font-weight:650; letter-spacing:-.2px}
.page-head p{margin:4px 0 0; color:var(--muted); font-size:13px}
.ph-right{margin-left:auto; display:flex; gap:9px; align-items:center}
.pill{
  padding:5px 12px; border-radius:999px; font-size:12px; color:var(--muted);
  border:1px solid var(--line); background:var(--card); white-space:nowrap;
}
.pill.live{color:var(--ok); border-color:rgba(157,255,195,.28); background:rgba(157,255,195,.08)}
.dot{display:inline-block; width:6px; height:6px; border-radius:50%; background:var(--ok); margin-right:6px; vertical-align:1px; box-shadow:0 0 7px rgba(157,255,195,.7)}

.card{
  background:var(--card); border:1px solid var(--line); border-radius:14px;
  padding:18px; box-shadow:var(--shadow);
}
.card-head{display:flex; align-items:center; gap:10px; margin-bottom:15px; flex-wrap:wrap}
.card-head h3{font-size:15.5px; margin:0; font-weight:640}
.card-head .aside{margin-left:auto; color:var(--muted); font-size:12px}
.stack{display:flex; flex-direction:column; gap:16px}
.hint{color:var(--muted); font-size:12px; margin:14px 0 0; line-height:1.6}
.sub-head{font-size:14px; margin:22px 0 12px; font-weight:640}

/* ===== 4 大 KPI ===== */
.kpi{display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:16px}
.kpi-card{
  background:linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.01));
  border:1px solid var(--line); border-radius:14px; padding:15px 16px;
  box-shadow:var(--shadow); transition:border-color .2s ease, transform .2s ease;
}
.kpi-card:hover{border-color:rgba(126,240,255,.3); transform:translateY(-2px)}
.kpi-lbl{font-size:12.5px; color:var(--muted)}
.kpi-num{
  font-size:29px; font-weight:680; margin-top:9px; letter-spacing:-.6px;
  font-variant-numeric:tabular-nums; line-height:1.1; color:var(--ac,var(--cyan));
}
.kpi-foot{display:flex; align-items:center; gap:8px; margin-top:8px; flex-wrap:wrap}
.delta{font-size:11.5px; font-weight:600}
.delta.up{color:var(--ok)}
.delta.flat{color:var(--muted)}
.kpi-foot .to{font-size:11px; color:var(--muted)}
/* KPI / 次要指标配色：class 驱动，避免 inline style 触犯 CSP */
.kpi-card.k-ok{--ac:#9dffc3}
.kpi-card.k-cyan{--ac:#7ef0ff}
.kpi-card.k-cyan2{--ac:#b8f7ff}
.kpi-card.k-gold{--ac:#ffe7a3}
.mini.k-cyan{--ac:#7ef0ff}
.mini.k-gold{--ac:#ffe7a3}
.mint-result .mt10{margin-top:10px}

/* ===== 次要指标 ===== */
.stat-grid{display:grid; grid-template-columns:repeat(5,1fr); gap:11px}
.mini{
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0));
  border:1px solid var(--line); border-radius:11px; padding:12px 13px;
}
.mini .m-lbl{font-size:11.5px; color:var(--muted)}
.mini .m-num{
  font-size:20px; font-weight:660; margin-top:6px; letter-spacing:-.3px;
  font-variant-numeric:tabular-nums; color:var(--ac,var(--cyan));
}

/* ===== 表格 ===== */
.table-wrap{overflow-x:auto; -webkit-overflow-scrolling:touch}
table{width:100%; border-collapse:collapse; font-size:13px; min-width:560px}
thead th{
  text-align:left; font-weight:600; font-size:11px; letter-spacing:.6px;
  text-transform:uppercase; color:var(--muted);
  padding:0 11px 9px; border-bottom:1px solid var(--line); white-space:nowrap;
}
tbody td{padding:10px 11px; border-bottom:1px solid rgba(255,255,255,.05); white-space:nowrap}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover{background:rgba(126,240,255,.035)}
.code-cell{font-family:Consolas,"Courier New",monospace; font-size:12px; color:var(--cyan-2)}

/* 状态标签（app.js 生成） */
.tag{display:inline-block; padding:1.5px 8px; border-radius:999px; font-size:11.5px; border:1px solid var(--line); color:var(--muted)}
.tag-admin{background:rgba(255,231,163,.12); color:var(--gold); border-color:rgba(255,231,163,.3)}
.tag-user{background:rgba(255,255,255,.05); color:var(--muted)}
.tag-unused{background:rgba(126,240,255,.12); color:var(--cyan); border-color:rgba(126,240,255,.28)}
.tag-redeemed{background:rgba(157,255,195,.12); color:var(--ok); border-color:rgba(157,255,195,.28)}
.tag-revoked{background:rgba(255,180,180,.12); color:var(--danger); border-color:rgba(255,180,180,.28)}

/* ===== 趋势图 ===== */
.range{display:inline-flex; align-items:center; gap:7px; color:var(--muted); font-size:12px}
select{background:var(--card-2); color:var(--text); border:1px solid var(--line); border-radius:9px; padding:5px 10px; font-size:12.5px; outline:none}
select:focus{border-color:rgba(126,240,255,.5)}
.legend{display:flex; flex-wrap:wrap; gap:15px; margin-bottom:12px}
.lg{display:inline-flex; align-items:center; gap:7px; font-size:12.5px; color:var(--muted)}
.lg i{width:14px; height:3px; border-radius:2px; display:inline-block}
/* 图例色块：用 class 而非 inline style（CSP style-src 'self' 会拦截内联样式） */
.i-signups{background:#7ef0ff}
.i-minted{background:#ffe7a3}
.i-redeemed{background:#9dffc3}
.chart{width:100%}
.chart svg{width:100%; height:auto; display:block}

/* ===== 发放表单 ===== */
.mint-form{display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end}
.mint-form label{display:flex; flex-direction:column; gap:6px; font-size:12.5px; color:var(--muted)}
.mint-form input,.mint-form select{
  background:var(--card-2); border:1px solid var(--line); border-radius:9px;
  padding:8px 11px; font-size:13.5px; color:var(--text); outline:none; min-width:112px;
}
.mint-form input:focus,.mint-form select:focus{border-color:rgba(126,240,255,.5)}
.btn-primary{
  border:0; border-radius:10px; padding:9px 22px; font-size:14px; font-weight:650;
  background:linear-gradient(135deg,var(--cyan),var(--cyan-2));
  color:var(--ink); cursor:pointer; letter-spacing:.3px;
  box-shadow:0 6px 20px rgba(126,240,255,.24);
  transition:transform .18s ease, box-shadow .18s ease;
}
.btn-primary:hover{transform:translateY(-1px); box-shadow:0 10px 26px rgba(126,240,255,.34)}
.btn-primary:disabled{opacity:.6; cursor:default; transform:none}
.error{margin:12px 0 0; font-size:13px; color:var(--danger)}

/* ===== 发放结果 ===== */
.mint-result{
  margin-top:14px; padding:13px 15px; border-radius:11px; font-size:13px;
  background:rgba(157,255,195,.07); border:1px solid rgba(157,255,195,.22);
}
.mint-result .meta{margin:0 0 10px; color:var(--ok); font-size:12.5px}
.mint-result .row{display:flex; align-items:center; gap:10px; padding:5px 0; flex-wrap:wrap}
.codeline{font-family:Consolas,"Courier New",monospace; font-size:12.5px; color:var(--cyan-2); word-break:break-all}
.copy-btn{
  border:1px solid rgba(126,240,255,.3); background:rgba(126,240,255,.08); color:var(--cyan);
  border-radius:8px; padding:3px 11px; font-size:11.5px; cursor:pointer; transition:all .18s ease;
}
.copy-btn:hover{background:rgba(126,240,255,.18)}

.empty{margin:14px 0 0; font-size:13px; color:var(--muted); text-align:center}

/* ===== 无权限 ===== */
.denied{
  max-width:420px; margin:14vh auto; padding:34px 28px; text-align:center;
  background:var(--card); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow);
}
.denied .lock{width:44px; height:44px; margin-bottom:12px}
.denied h2{font-size:19px; margin:0 0 8px; font-weight:650}
.denied p{margin:0 0 20px; color:var(--muted); font-size:13.5px}
.denied .btn-primary{display:inline-block; text-decoration:none; padding:9px 24px}

/* ===== 移动端 ===== */
.mtop{display:none}
.tabbar{display:none}

@media (max-width:1200px){
  .stat-grid{grid-template-columns:repeat(3,1fr)}
}
@media (max-width:1100px){
  .side{width:76px; flex:0 0 76px; padding:16px 10px}
  .sb-text,.navitem .txt,.u-info{display:none}
  .side-brand{justify-content:center}
  .navitem{justify-content:center; padding:10px}
  .side-user{justify-content:center; padding:6px 0 10px}
  .side-actions{flex-direction:column; padding:0}
  .side-actions .btn-ghost{padding:5px 8px; font-size:11.5px}
  .content{padding:20px 18px 40px}
  .kpi{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:768px){
  .shell{display:block}
  body{padding-bottom:66px}
  .side{display:none}
  .content{padding:0 14px calc(28px + env(safe-area-inset-bottom))}
  .mtop{
    display:flex; align-items:center; gap:10px; padding:10px 14px;
    position:sticky; top:0; z-index:20;
    background:rgba(7,9,13,.92); -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px);
    margin:0 -14px;
    border-bottom:1px solid var(--line);
  }
  .mtop .logo{width:28px;height:28px}
  .mtop-title{font-size:15px}
  .mtop-sp{flex:1}
  .page-head{margin:16px 0 15px}
  .page-head h2{font-size:20px}
  .ph-right{margin-left:0; width:100%}
  .stack{gap:13px}
  .card{padding:14px; border-radius:13px}
  .card-head{margin-bottom:12px}
  .card-head h3{font-size:14.5px}
  .card-head .aside{margin-left:0; width:100%; font-size:11.5px}
  .kpi{grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:13px}
  .kpi-card{padding:12px 13px; border-radius:12px}
  .kpi-num{font-size:24px; margin-top:7px}
  .stat-grid{grid-template-columns:repeat(2,1fr); gap:9px}
  .mini{padding:11px 12px}
  .mini .m-num{font-size:18px}
  table{font-size:12.5px; min-width:480px}
  thead th{padding:0 9px 8px; font-size:10.5px}
  tbody td{padding:9px}
  .legend{gap:11px; margin-bottom:10px}
  .mint-form{gap:9px}
  .mint-form label{flex:1 1 calc(50% - 5px)}
  .mint-form input,.mint-form select{min-width:0; width:100%}
  .btn-primary{width:100%; padding:11px; margin-top:2px}
  .sub-head{margin:18px 0 10px; font-size:13.5px}
  .hint{font-size:11.5px}
  .denied{margin:8vh 14px}
  .tabbar{
    display:flex; position:fixed; left:0; right:0; bottom:0; z-index:30;
    background:rgba(11,16,23,.97); -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px);
    border-top:1px solid var(--line);
    padding:7px 2px calc(7px + env(safe-area-inset-bottom));
  }
  .tabbar a{
    flex:1; display:flex; flex-direction:column; align-items:center; gap:3px;
    text-decoration:none; color:var(--muted); font-size:10.5px; padding:3px 0;
  }
  .tabbar a svg{width:20px;height:20px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round}
  .tabbar a.active{color:var(--cyan)}
}
