/* 多租户版布局（叠加在 style.css 之上，不修改原有样式） */
:root {
  --bg: #0b0f18;
  --panel: #141a26;
  --panel-2: #1a2130;
  --line: #232c3e;
  --text: #d6deeb;
  --muted: #8b97ad;
  --accent: #5b8cff;
  --green: #28c76f;
  --warn: #f6c445;
}

.hidden { display: none !important; }

.app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 212px;
  flex: 0 0 212px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  box-sizing: border-box;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none;
  font-size: 13.5px; cursor: pointer; transition: all .16s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: rgba(91, 140, 255, .14); color: #a9c1ff; }
.nav-item .ico { width: 16px; text-align: center; opacity: .85; }

.who {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 10px; border-top: 1px solid var(--line);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #5b8cff, #b57bff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px;
}
.who-name { font-size: 13px; font-weight: 600; }
.who-role { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- 主区 ---------- */
.main-body { flex: 1; min-width: 0; padding: 16px 20px 40px; box-sizing: border-box; }

.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.input-date {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}

.freshness {
  font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 8px;
}
.freshness.warn { color: var(--warn); border-color: rgba(246, 196, 69, .4); }

.pane { animation: fade .18s ease; }
@keyframes fade { from { opacity: .6; } to { opacity: 1; } }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 25px; font-weight: 700; margin: 6px 0 4px; letter-spacing: .3px; }
.kpi-sub { font-size: 11.5px; color: var(--muted); }
.kpi-foot { font-size: 11px; color: #6f7c93; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* ---------- 产品卡片 ---------- */
.product-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.product-tabs { display: flex; gap: 6px; }
.ptab {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.ptab.active { background: rgba(91, 140, 255, .16); color: #a9c1ff; border-color: rgba(91, 140, 255, .5); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.product-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.pc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pc-avatar {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #ff9d4d, #ff6a3d);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
}
.pc-title { font-size: 14.5px; font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-income { margin-bottom: 10px; }
.pc-label { display: block; font-size: 11.5px; color: var(--muted); }
.pc-value { font-size: 22px; font-weight: 700; color: #ff7a59; }
.pc-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 3px 0; }
.pc-row .green { color: var(--green); }
.pc-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 12px 0; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line);
}
.pc-metrics div { text-align: center; }
.pc-metrics b { display: block; font-size: 15px; }
.pc-metrics span { font-size: 11px; color: var(--muted); }
.pc-owner { font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.pc-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- 通用小件 ---------- */
.badge {
  display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  background: rgba(139, 151, 173, .16); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: rgba(40, 199, 111, .16); color: var(--green); }
.code-box {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  background: var(--panel-2); border: 1px dashed var(--line); border-radius: 6px;
  padding: 3px 8px; cursor: pointer; color: #a9c1ff; display: inline-block;
}
.code-box.small { font-size: 11px; }
.code-box.copied { border-color: var(--green); color: var(--green); }
.muted, .pc-none { color: #6f7c93; font-size: 12px; }
.warn-text { color: var(--warn); }
.green { color: var(--green); }
.empty { color: #6f7c93; text-align: center; padding: 18px 0; font-size: 12.5px; }
.link { color: var(--accent); text-decoration: none; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }
.ops { white-space: nowrap; display: flex; gap: 6px; }

/* ---------- 表单/抽屉补充 ---------- */
.drawer-narrow .drawer-panel { max-width: 460px; }
.hint { font-size: 11px; color: #6f7c93; margin-top: 4px; }
.req { color: #ff7a59; font-style: normal; }
.form-row select { width: 100%; }

.game-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px;
}
.game-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.game-ops { display: flex; gap: 6px; }

.log-row { display: flex; gap: 8px; align-items: center; font-size: 11.5px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.log-time { color: #6f7c93; flex: 0 0 auto; }
.log-kind { color: var(--muted); flex: 0 0 auto; }
.log-status { flex: 0 0 auto; padding: 1px 6px; border-radius: 4px; background: rgba(139,151,173,.14); }
.log-status.ok { color: var(--green); }
.log-status.fail { color: #ff7a59; }
.log-msg { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.alert-item { display: flex; gap: 8px; font-size: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.alert-time { color: #6f7c93; flex: 0 0 auto; }
.alert-item.warn .alert-msg { color: var(--warn); }
.alert-item.error .alert-msg { color: #ff7a59; }
.alert-msg { color: var(--muted); }

@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 176px; flex-basis: 176px; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-basis: auto; }
  .nav { flex-direction: row; overflow-x: auto; }
  .kpi-row { grid-template-columns: 1fr; }
}

/* ===== 平台二维码弹层 ===== */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(4, 8, 16, .72); }
.modal-card { position: relative; width: 380px; max-width: calc(100vw - 32px); background: #141a26; border: 1px solid #232c3e; border-radius: 12px; padding: 16px 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 15px; color: #e6eefb; }
.modal-body { text-align: center; }
.qr-box { background: #fff; border-radius: 10px; padding: 10px; display: inline-block; }
.qr-box img { display: block; width: 260px; height: 260px; object-fit: contain; }
.qr-tip { margin-top: 10px; font-size: 12px; color: #8b97ad; font-family: Consolas, monospace; word-break: break-all; }
.modal-actions { margin-top: 14px; display: flex; justify-content: center; gap: 10px; }
.modal .hint { margin-top: 10px; font-size: 12px; color: #6f7c93; line-height: 1.6; text-align: left; }