:root{
  --bg:#060a12; --panel:#0e1523; --panel2:#111a2b; --line:#1d2940; --line2:#27364f;
  --text:#e9effc; --muted:#8a9ab8; --muted2:#64748f;
  --accent:#2ee6c5; --blue:#5b8cff; --violet:#a97bff; --gold:#ffb020; --red:#ff5d73; --green:#38e0a4;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:
    radial-gradient(1200px 600px at 82% -12%, rgba(91,140,255,.14), transparent 60%),
    radial-gradient(900px 500px at 4% 0%, rgba(46,230,197,.10), transparent 55%),
    var(--bg);
  color:var(--text); font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  font-size:13px; display:flex; flex-direction:column; min-height:100%;
}
b{font-weight:700}
.hidden{display:none!important}

/* ---------------- 顶栏 ---------------- */
.top{
  display:flex; align-items:center; gap:18px; padding:14px 20px;
  border-bottom:1px solid var(--line); background:rgba(9,14,24,.85); backdrop-filter:blur(8px);
  position:sticky; top:0; z-index:20; flex-wrap:wrap;
}
.brand{display:flex; align-items:center; gap:12px; min-width:250px}
.logo{
  font:800 12px/1 "Segoe UI",sans-serif; letter-spacing:2px; padding:9px 11px; border-radius:9px;
  border:1px solid rgba(46,230,197,.35); color:var(--accent); background:rgba(46,230,197,.07);
}
.brand h1{font-size:16px; margin:0; letter-spacing:.5px}
.brand p{margin:3px 0 0; font-size:11.5px; color:var(--muted2); letter-spacing:1px}
.lockup{display:flex; align-items:center; gap:9px; padding:7px 12px; border-radius:10px;
  background:rgba(255,255,255,.035); border:1px solid rgba(255,255,255,.09)}
.lockup img{display:block; filter:brightness(0) invert(1); opacity:.95}
.lg-honor{height:15px}
.lg-wpp{height:12px}
.lg-x{color:#6f83a8; font-size:12px; line-height:1}

/* ---------------- 品牌 KV ---------------- */
.kv{
  position:relative; margin:14px 20px 0; padding:24px 30px; border-radius:16px; overflow:hidden;
  display:flex; align-items:center; justify-content:space-between; gap:28px;
  background:linear-gradient(112deg,#050a16 0%,#0a1329 42%,#000050 100%);
  border:1px solid rgba(120,150,255,.20);
  box-shadow:0 24px 60px -40px rgba(0,0,80,.9), inset 0 1px 0 rgba(255,255,255,.05);
}
.kv::before{content:""; position:absolute; right:-8%; top:-70%; width:520px; height:520px; border-radius:50%;
  background:radial-gradient(circle,rgba(46,230,197,.20),transparent 62%); pointer-events:none}
.kv::after{content:""; position:absolute; left:-6%; bottom:-80%; width:460px; height:460px; border-radius:50%;
  background:radial-gradient(circle,rgba(91,140,255,.24),transparent 66%); pointer-events:none}
.kv-main{position:relative; z-index:1}
.kv-tag{display:inline-block; font-size:10.5px; letter-spacing:3px; color:#9fb4e8;
  border:1px solid rgba(159,180,232,.32); padding:4px 11px; border-radius:999px}
.kv h2{margin:13px 0 7px; font-size:26px; font-weight:800; letter-spacing:1.5px;
  background:linear-gradient(90deg,#ffffff,#d6e3ff 55%,#8ee9dc);
  -webkit-background-clip:text; background-clip:text; color:transparent}
.kv p{margin:0; font-size:12.5px; color:#93a6c9; letter-spacing:.6px}
.kv-side{position:relative; z-index:1; display:grid; grid-template-columns:auto auto; gap:9px 18px;
  padding-left:24px; border-left:1px solid rgba(120,150,255,.18); font-size:11.5px; color:#7f93b8}
.kv-side b{color:#dbe6fb; font-weight:600}
@media (max-width:1000px){
  .kv{flex-direction:column; align-items:flex-start; gap:14px}
  .kv-side{border-left:0; padding-left:0}
  .brand{min-width:0}
}
.meta{display:flex; gap:8px; flex-wrap:wrap; flex:1}
.chip{
  border:1px solid var(--line); background:#0a1421; border-radius:8px; padding:6px 10px;
  font-size:11.5px; color:var(--muted); white-space:nowrap;
}
.chip b{color:#cfe0f8; font-weight:600; margin-left:4px}
.chip.dot{display:flex; align-items:center; gap:6px}
.chip.dot i{width:7px; height:7px; border-radius:50%; background:var(--muted2); display:inline-block}
.chip.dot.ok i{background:var(--green); box-shadow:0 0 8px rgba(56,224,164,.8)}
.chip.dot.bad i{background:var(--red); box-shadow:0 0 8px rgba(255,93,115,.8)}
.chip.dot.busy i{background:var(--gold); animation:pulse 1s infinite}
@keyframes pulse{50%{opacity:.25}}
.actions{display:flex; align-items:center; gap:8px}
.btn{
  border:1px solid var(--line2); background:#0d1626; color:#c3d3ea; border-radius:8px;
  padding:8px 13px; font-size:12.5px; cursor:pointer; font-family:inherit; transition:.15s; white-space:nowrap;
}
.btn:hover{border-color:var(--accent); color:#eaf6ff; background:#0f1c2e}
.btn.primary{
  background:linear-gradient(135deg, rgba(46,230,197,.18), rgba(91,140,255,.22));
  border-color:rgba(46,230,197,.45); color:#d8fff8; font-weight:700;
}
.btn.primary:hover{background:linear-gradient(135deg, rgba(46,230,197,.3), rgba(91,140,255,.34))}
.btn:disabled{opacity:.45; cursor:not-allowed}
.seg{display:inline-flex; background:#0a1321; border:1px solid var(--line); border-radius:9px; padding:3px}
.seg button{
  border:0; background:transparent; color:var(--muted); font-family:inherit; font-size:12px;
  padding:5px 11px; border-radius:7px; cursor:pointer; transition:.15s; white-space:nowrap;
}
.seg button.on{background:rgba(91,140,255,.18); color:#dce9ff; box-shadow:inset 0 0 0 1px rgba(91,140,255,.35)}
.seg button:hover{color:#e6f0ff}

/* ---------------- 提示条 ---------------- */
.banner{
  margin:10px 20px 0; padding:10px 14px; border-radius:10px; font-size:12.5px; line-height:1.6;
  border:1px solid rgba(255,93,115,.45); background:rgba(255,93,115,.08); color:#ffd6dd;
}
.banner.warn{border-color:rgba(255,176,32,.45); background:rgba(255,176,32,.08); color:#ffe9c2}
.banner code{color:#fff; background:rgba(255,255,255,.08); padding:1px 5px; border-radius:4px}

/* ---------------- 主体 ---------------- */
main{display:flex; gap:14px; padding:14px 20px 20px; align-items:flex-start; flex:1 0 auto}
.rail{
  width:352px; flex:0 0 352px; border:1px solid var(--line); border-radius:14px;
  background:linear-gradient(180deg, rgba(17,26,43,.9), rgba(11,18,30,.9));
  padding:12px; position:sticky; top:78px; max-height:calc(100vh - 100px); overflow:auto;
}
.rail-hd{display:flex; justify-content:space-between; align-items:baseline; padding:2px 4px 10px; font-size:12px; color:var(--muted); letter-spacing:.5px}
.rail-hd span{font-size:11px; color:var(--muted2)}
.sec{
  border:1px solid var(--line); border-radius:11px; background:#0b1322; margin-bottom:10px;
  transition:.15s; overflow:hidden;
}
.sec:last-child{margin-bottom:0}
.sec.active{border-color:rgba(46,230,197,.5); box-shadow:0 0 0 1px rgba(46,230,197,.18), 0 8px 26px -18px rgba(46,230,197,.6)}
.sec-hd{display:flex; align-items:center; gap:11px; padding:13px 13px; cursor:pointer; user-select:none}
.sec-hd:hover{background:rgba(91,140,255,.06)}
.sec-ico{
  flex:0 0 36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center;
  color:var(--accent); border:1px solid rgba(46,230,197,.28);
  background:linear-gradient(160deg, rgba(46,230,197,.14), rgba(91,140,255,.10));
}
.sec-ico svg{width:19px; height:19px; display:block}
.sec.active .sec-ico{border-color:rgba(46,230,197,.6); color:#d8fff8; background:linear-gradient(160deg, rgba(46,230,197,.26), rgba(91,140,255,.18))}
.sec-info{min-width:0; flex:1}
.sec-info .t{font-size:13.5px; font-weight:700; letter-spacing:.3px}
.sec-hd .caret{margin-left:auto; color:var(--muted2); font-size:16px; transition:.2s; line-height:1}
.sec.active .caret{transform:rotate(90deg); color:var(--accent)}
.up{color:var(--green)} .down{color:var(--red)} .flat{color:var(--muted2)}

.panel{
  flex:1; min-width:0; border:1px solid var(--line); border-radius:14px;
  background:linear-gradient(180deg, rgba(17,26,43,.85), rgba(9,15,26,.85)); padding:0 0 14px;
}
.panel-hd{display:flex; align-items:center; gap:12px; padding:14px 16px 12px; border-bottom:1px solid var(--line); flex-wrap:wrap}
.panel-hd h2{font-size:15px; margin:0; letter-spacing:.4px}
.panel-sub{font-size:11.5px; color:var(--muted2)}
.panel-hd .seg{margin-left:auto}
#detail-body{padding:14px 16px 0}

.kpi-strip{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; margin-bottom:14px}
.big-kpi{
  border:1px solid var(--line); border-radius:11px; padding:11px 13px;
  background:linear-gradient(160deg, rgba(20,32,52,.9), rgba(11,18,30,.9)); position:relative; overflow:hidden;
}
.big-kpi::after{content:""; position:absolute; inset:auto 0 0 0; height:2px; background:linear-gradient(90deg,var(--accent),var(--blue)); opacity:.5}
.big-kpi .lb{font-size:11px; color:var(--muted); margin-bottom:6px}
.big-kpi .vl{font-size:22px; font-weight:800; font-variant-numeric:tabular-nums}
.big-kpi .dt{font-size:11px; margin-top:5px}

.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px}
.grid-2 .wide{grid-column:1/-1}
.card{
  border:1px solid var(--line); border-radius:12px; background:rgba(10,17,29,.75); padding:12px 13px 8px; min-width:0;
}
.card-hd{display:flex; align-items:baseline; gap:8px; margin-bottom:8px}
.card-hd .ct{font-size:12.5px; font-weight:700; display:flex; align-items:center; gap:7px}
.card-hd .ct::before{content:""; width:3px; height:12px; border-radius:2px; background:linear-gradient(180deg,var(--accent),var(--blue))}
.card-hd .cs{font-size:10.5px; color:var(--muted2); margin-left:auto}
.card-body{overflow-x:auto}
.chart{width:100%; min-width:0; display:block; overflow:visible}

/* 图表 */
.chart{width:100%; display:block; overflow:visible}
.chart text{fill:var(--muted); font-size:10.5px; font-family:inherit}
.chart .axis{stroke:var(--line2); stroke-width:1}
.chart .gline{stroke:var(--line); stroke-width:1; stroke-dasharray:2 4}
.chart .vlab{fill:#cfe0f8; font-size:10.5px}
.legend{display:flex; gap:14px; flex-wrap:wrap; font-size:11px; color:var(--muted); padding:4px 2px 8px}
.legend i{width:9px; height:9px; border-radius:2px; display:inline-block; margin-right:5px; vertical-align:middle}
.legend .dash i{height:0; border-top:2px dashed; background:none!important; border-radius:0}

/* 表格 */
.tbl-wrap{overflow:auto; border:1px solid var(--line); border-radius:11px; background:rgba(8,14,24,.6)}
table{width:100%; border-collapse:collapse; font-size:12px; min-width:640px}
thead th{
  position:sticky; top:0; background:#0d1727; color:var(--muted); font-weight:600; font-size:11px;
  text-align:right; padding:9px 10px; border-bottom:1px solid var(--line); white-space:nowrap; z-index:1;
}
thead th:first-child{text-align:left}
tbody td{padding:8px 10px; border-bottom:1px solid rgba(29,41,64,.6); text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap}
tbody td:first-child{text-align:left; color:#dbe7f9; max-width:260px; overflow:hidden; text-overflow:ellipsis}
tbody tr:hover{background:rgba(91,140,255,.07)}
tbody tr:last-child td{border-bottom:0}
td .sub{display:block; font-size:10px; margin-top:2px}
.tag{
  font-size:10px; padding:1px 5px; border-radius:4px; border:1px solid var(--line2);
  color:var(--muted); background:#0b1420; margin-left:6px;
}
.empty{padding:34px 10px; text-align:center; color:var(--muted2); font-size:12px; line-height:1.9}
.empty b{color:#c8d8ee}

.toast{
  position:fixed; right:20px; bottom:22px; z-index:60; display:flex; flex-direction:column; gap:8px; align-items:flex-end;
}
.toast div{
  background:#101c2e; border:1px solid var(--line2); color:#dfeafb; border-radius:10px;
  padding:10px 14px; font-size:12.5px; box-shadow:0 16px 40px -18px #000; animation:rise .2s ease-out;
  max-width:420px;
}
.toast div.ok{border-color:rgba(56,224,164,.5)}
.toast div.err{border-color:rgba(255,93,115,.55); color:#ffd9df}
@keyframes rise{from{opacity:0; transform:translateY(8px)}}

footer{padding:10px 22px 16px; color:var(--muted2); font-size:11px; display:flex; gap:16px; flex-wrap:wrap}

@media (max-width:960px){
  main{flex-direction:column; align-items:stretch; padding:12px}
  .rail{width:100%; flex:0 0 auto; position:static; max-height:none; overflow:visible; display:grid; grid-template-columns:1fr 1fr; gap:10px}
  .rail-hd{grid-column:1/-1}
  .sec{margin-bottom:0}
  .grid-2{grid-template-columns:1fr}
}
@media (max-width:720px){
  .rail{grid-template-columns:1fr}
  .meta{display:none}
}

/* ---------------- 时间区间 / 筛选 ---------------- */
.daterange{display:flex; align-items:center; gap:6px}
.daterange input[type=date]{
  background:#0a1321; border:1px solid var(--line2); color:#cfe0f8; border-radius:7px;
  padding:5px 7px; font-size:11.5px; font-family:inherit; color-scheme:dark;
}
.daterange .sep{color:var(--muted2); font-size:11px}
.btn.mini{padding:6px 10px; font-size:11.5px}

.filters{display:flex; gap:8px; align-items:center; padding:0 16px 10px; flex-wrap:wrap}
.filters.hidden{display:none}
.flt{position:relative}
.flt-btn{
  display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line2); background:#0b1524;
  color:#c3d3ea; border-radius:8px; padding:6px 10px; font-size:12px; cursor:pointer; font-family:inherit;
}
.flt-btn:hover{border-color:var(--accent)}
.flt-btn .flt-name{color:var(--muted)}
.flt-btn .flt-val{color:#dce9ff; font-weight:600; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.flt-btn i{color:var(--muted2); font-style:normal; font-size:10px}
.flt-pop{
  position:absolute; top:calc(100% + 6px); left:0; z-index:30; width:240px; background:#0a1321;
  border:1px solid var(--line2); border-radius:10px; padding:8px; box-shadow:0 12px 30px rgba(0,0,0,.5);
}
.flt-pop.hidden{display:none}
.flt-search{
  width:100%; box-sizing:border-box; background:#08101c; border:1px solid var(--line); border-radius:6px;
  color:#dce9ff; padding:5px 8px; font-size:11.5px; font-family:inherit; margin-bottom:6px;
}
.flt-list{max-height:230px; overflow:auto}
.flt-item{display:flex; align-items:center; gap:7px; padding:4px; font-size:11.5px; color:#c3d3ea; cursor:pointer; border-radius:5px}
.flt-item:hover{background:rgba(91,140,255,.12)}
.flt-item input{accent-color:#5b8cff}
.flt-empty{font-size:11px; color:var(--muted2); padding:6px 4px}

/* ---------------- KPI 两行 ---------------- */
.kpi-strip{display:flex; flex-direction:column; gap:10px}
.kpi-row{display:grid; gap:10px}
.kpi-row.cols4{grid-template-columns:repeat(4,1fr)}
.kpi-row.cols5{grid-template-columns:repeat(5,1fr)}
.big-kpi.clickable{cursor:pointer; transition:.15s}
.big-kpi.clickable:hover{border-color:rgba(91,140,255,.5)}
.big-kpi.on{border-color:rgba(46,230,197,.5); box-shadow:inset 0 0 0 1px rgba(46,230,197,.2)}

/* ---------------- 趋势图交互 ---------------- */
.trend-wrap{position:relative}
.chart .hover-line{stroke:rgba(205,224,255,.5); stroke-width:1; stroke-dasharray:3 3; pointer-events:none}
.trend-tip{
  position:absolute; top:6px; left:0; z-index:5; min-width:158px; pointer-events:none;
  background:rgba(8,14,24,.96); border:1px solid var(--line2); border-radius:9px; padding:8px 10px;
  font-size:11.5px; line-height:1.7; box-shadow:0 10px 26px rgba(0,0,0,.5);
}
.trend-tip.hidden{display:none}
.trend-tip .tt-d{font-weight:700; color:#dce9ff; margin-bottom:3px}
.trend-tip .tt-r{display:flex; align-items:center; gap:6px; white-space:nowrap}
.trend-tip .tt-r i{width:7px; height:7px; border-radius:2px; display:inline-block}
.trend-tip .tt-r.dim{color:var(--muted2)}
.trend-pick{display:inline-flex; align-items:center; gap:6px; margin-left:auto}
.trend-pick .dot{width:8px; height:8px; border-radius:2px; display:inline-block}
.trend-pick .dot.a{background:#2ee6c5}
.trend-pick .dot.b{background:#5b8cff}
.tkey{
  background:#0a1321; border:1px solid var(--line2); color:#cfe0f8; border-radius:6px;
  padding:3px 6px; font-size:11px; font-family:inherit; cursor:pointer;
}
@media (max-width:1180px){
  .kpi-row.cols5{grid-template-columns:repeat(3,1fr)}
}

/* ---------------- 商品明细 ---------------- */
.item-hd{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:8px}
.item-note{font-size:11px; color:var(--muted2)}
.item-host{max-height:520px; overflow:auto}
.item-tbl{width:100%; border-collapse:collapse; font-size:12px}
.item-tbl th{
  position:sticky; top:0; z-index:1; background:#0d1727; color:var(--muted);
  font-weight:500; text-align:right; padding:9px 10px; white-space:nowrap;
}
.item-tbl th.sortable{cursor:pointer; user-select:none}
.item-tbl th.sortable:hover{color:var(--accent)}
.item-tbl th:first-child,.item-tbl th:nth-child(2){text-align:left}
.item-tbl td{
  padding:9px 10px; text-align:right; white-space:nowrap; color:#e6f0ff;
  border-top:1px solid rgba(255,255,255,.05);
}
.item-tbl td.na{color:var(--muted2)}
.item-tbl td b{font-weight:600}
.item-tbl td .sub{display:block; font-size:10px; margin-top:2px}
.item-tbl tr.spu-row{cursor:pointer}
.item-tbl tr.spu-row:hover{background:rgba(91,140,255,.08)}
.item-tbl tr.spu-row.open{background:rgba(46,230,197,.05)}
.item-tbl tr.sku-child td{background:rgba(91,140,255,.035); font-size:11.5px}
.item-tbl tr.sku-child .item-name{color:#c6d6ee}
.caret{display:inline-block; width:13px; color:var(--muted2); font-size:10px; margin-right:2px}
.item-cell{text-align:left!important; min-width:240px}
.item-cell.indent{padding-left:30px}
.item-cell>div{display:inline-block; vertical-align:middle}
.item-ico{
  width:30px; height:30px; margin-right:8px; border-radius:7px; background:rgba(255,255,255,.05);
  display:inline-flex; align-items:center; justify-content:center;
}
.item-meta{max-width:270px}
.item-name{overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#e6f0ff}
.item-sku{font-size:10.5px; color:var(--muted2); margin-top:2px}
.trend-btn{
  padding:4px 10px; border-radius:6px; font-size:11.5px; cursor:pointer; font-family:inherit;
  border:1px solid rgba(46,230,197,.35); background:rgba(46,230,197,.08); color:#2ee6c5;
}
.trend-btn:hover{background:rgba(46,230,197,.18)}

/* ---------------- 单品趋势弹层 ---------------- */
.modal-mask{
  position:fixed; inset:0; z-index:90; padding:24px; display:flex; align-items:center;
  justify-content:center; background:rgba(4,10,20,.72);
}
.modal-mask.hidden{display:none}
.modal{
  width:min(940px,94vw); background:#0e1726; border:1px solid rgba(120,160,220,.18);
  border-radius:14px; padding:16px 18px 18px; box-shadow:0 24px 60px rgba(0,0,0,.55);
}
.modal-hd{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px}
.modal-title{font-size:14px; color:#e6f0ff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.modal-actions{display:flex; align-items:center; gap:10px; flex:0 0 auto}
.modal-body .trend-wrap{min-height:280px}

/* ---------------- 指标框补充 ---------------- */
.big-kpi .dt2{font-size:11px; color:var(--muted); margin-top:3px}
.big-kpi .vl.long{font-size:16px; letter-spacing:-.3px}

/* ---------------- 分品类明细表 ---------------- */
.rtb-tbl-hd{display:flex; justify-content:flex-end; margin:-2px 0 8px}
.rtb-tbl-host{min-width:0}
.rtb-tbl{width:100%; border-collapse:collapse; font-size:12px; min-width:1080px}
.rtb-tbl th{
  position:sticky; top:0; z-index:1; background:#0d1727; color:var(--muted);
  font-weight:500; text-align:right; padding:8px 10px; white-space:nowrap;
}
.rtb-tbl th:first-child{text-align:left}
.rtb-tbl th.sortable{cursor:pointer; user-select:none}
.rtb-tbl th.sortable:hover{color:var(--accent)}
.rtb-tbl td{
  padding:8px 10px; text-align:right; white-space:nowrap;
  border-top:1px solid rgba(255,255,255,.05); font-variant-numeric:tabular-nums;
}
.rtb-tbl td:first-child{text-align:left}
.rtb-tbl tr.cat-row{cursor:pointer}
.rtb-tbl tr.cat-row:hover{background:rgba(91,140,255,.08)}
.rtb-tbl tr.cat-row.open{background:rgba(46,230,197,.06)}
.cat-cell{color:#e6f0ff; font-weight:600}
.cat-cell .drill{display:inline-block; width:16px; color:var(--accent)}
.prod-row td{color:#c3d3ea; background:rgba(255,255,255,.015)}
.prod-cell{padding-left:30px!important; max-width:300px; overflow:hidden; text-overflow:ellipsis}

/* ---------------- 类目分析 ---------------- */
.analysis{font-size:12px; line-height:1.85; color:#c9d8ee}
.analysis .ana-line{margin:0 0 6px}
.analysis .ana-tips{margin:8px 0 0; padding-left:18px; color:#b9cbe6}
.analysis .ana-tips li{margin-bottom:5px}
.analysis b{color:#eaf2ff}

