:root {
  --bg: #0f1115; --panel: #181b22; --panel2: #1f232c; --line: #2a2f3a;
  --ink: #e8eaed; --muted: #9aa3b2; --accent: #4f8cff; --accent2: #28324a;
  --good: #2ecc71; --warn: #f5a623; --bad: #ff5a5a; --info: #5ad1e0;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, "Segoe UI", "PingFang SC", system-ui, sans-serif; }
button { cursor: pointer; border: none; border-radius: 8px; background: var(--accent); color: #fff; padding: 7px 14px; font-size: 13px; }
button.ghost { background: var(--accent2); color: var(--ink); }
button:hover { filter: brightness(1.1); }
select, input { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 13px; }
a { color: var(--accent); }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 17px; }
.brand .tag { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 8px; }
.controls { display: flex; gap: 10px; align-items: center; }
.controls label { color: var(--muted); font-size: 12px; display: flex; gap: 5px; align-items: center; }

main { padding: 22px; max-width: 1280px; margin: 0 auto; }
.hidden { display: none !important; }

h2 { font-size: 16px; margin: 0 0 14px; }
h3 { font-size: 14px; margin: 0; }
.section { margin-bottom: 26px; }
.muted { color: var(--muted); }
.crumb { color: var(--muted); margin-bottom: 14px; }
.crumb a { cursor: pointer; }

/* 卡片网格 */
.grid { display: grid; gap: 14px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* 健康分卡 */
.score-card { text-align: center; }
.score-card .dim { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.score-card .num { font-size: 34px; font-weight: 700; }
.score-card .sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* 诊断横幅 */
.diag { border-left: 4px solid var(--accent); padding: 14px 16px; border-radius: 10px; background: var(--panel); margin-bottom: 20px; }
.diag.availability { border-color: #a878ff; }
.diag.fulfillment { border-color: var(--bad); }
.diag.conversion { border-color: var(--warn); }
.diag.traffic { border-color: var(--info); }
.diag.healthy { border-color: var(--good); }
.diag .head { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.diag .stoploss { margin-top: 10px; padding: 9px 12px; background: rgba(255,90,90,.12); border-radius: 8px; color: #ffb3b3; font-size: 13px; }

/* 图表容器 */
.chart { width: 100%; height: 300px; }
.chart.sm { height: 220px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--panel2); }
tr.store-row.expanded { background: var(--panel2); }
tr.detail-row > td { background: #14171d; padding: 0; border-bottom: 2px solid var(--accent2); }
.detail { padding: 14px 16px; text-align: left; }
.detail .why { font-weight: 700; margin-bottom: 10px; }
.detail .finding { margin: 8px 0; padding-left: 4px; border-left: 2px solid var(--line); padding: 4px 0 4px 10px; }
.detail .finding b { font-size: 13px; }
.detail .sugg { color: #9be8c4; font-size: 12px; margin-top: 3px; }
.detail .ev { margin-top: 10px; }
.detail .ev h4 { margin: 0 0 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.detail .chip { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; margin: 0 5px 5px 0; font-size: 12px; }

.bar { height: 8px; border-radius: 4px; background: var(--accent2); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: 4px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.pill.high { background: rgba(255,90,90,.18); color: #ff9b9b; }
.pill.medium { background: rgba(245,166,35,.18); color: #ffce85; }
.pill.info { background: rgba(90,209,224,.16); color: #9be8f2; }
.pill.availability { background: rgba(168,120,255,.2); color: #c9aaff; }
.pill.traffic { background: rgba(90,209,224,.16); color: #9be8f2; }
.pill.conversion { background: rgba(245,166,35,.18); color: #ffce85; }
.pill.fulfillment { background: rgba(255,90,90,.18); color: #ff9b9b; }
.pill.brand { background: rgba(79,140,255,.18); color: #a9c6ff; }
.pill.store { background: var(--accent2); color: var(--muted); }

/* 动作看板 */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1000px) { .kanban { grid-template-columns: 1fr 1fr; } }
.col h3 { margin-bottom: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.action { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 10px; }
.action .title { font-size: 13px; font-weight: 600; margin: 4px 0; }
.action .meta { font-size: 11px; color: var(--muted); }
.action .act-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.action .act-btns button { padding: 4px 9px; font-size: 11px; }
.verdict { font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.verdict.effective { background: rgba(46,204,113,.18); color: #84e3ad; }
.verdict.ineffective { background: rgba(255,90,90,.18); color: #ff9b9b; }
.verdict.pending { background: var(--accent2); color: var(--muted); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(620px, 92vw); max-height: 88vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { background: var(--accent2); color: var(--muted); }
.tab.active { background: var(--accent); color: #fff; }
.tab-panel { display: flex; flex-direction: column; gap: 10px; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.result { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12px; white-space: pre-wrap; min-height: 20px; }
.frow { display: grid; grid-template-columns: 1fr 1.2fr 1.1fr .8fr .9fr .8fr; gap: 6px; }
.frow.head { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.frow input, .frow select { padding: 5px 7px; font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 40px; }
