/* ==================== 门店巡桌桌访系统 样式 ==================== */

:root {
  --brand: #e8532d;
  --brand-dark: #c9441f;
  --bg: #f5f6f8;
  --nav-h: 56px;
}

body {
  background: var(--bg);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fdeee8 0%, #f5f6f8 60%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 28px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
}
.login-logo { font-size: 48px; text-align: center; }
.login-title { font-size: 20px; font-weight: 700; text-align: center; margin: 8px 0 2px; }
.login-sub { color: #999; text-align: center; font-size: 13px; margin-bottom: 24px; }

/* ---------- 顶部导航 ---------- */
.app-navbar {
  background: var(--brand);
  height: var(--nav-h);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.app-navbar .navbar-brand { font-weight: 700; }
.app-main { padding-top: calc(var(--nav-h) + 12px); padding-bottom: 80px; max-width: 1100px; }

/* 顶部主菜单（默认隐藏，JS 检测宽度 >=768px 时显示 flex） */
.nav-main { display: none; margin-left: 16px; flex-wrap: nowrap; white-space: nowrap; }
.nav-main .nav-link { color: rgba(255,255,255,.85); font-size: 15px; padding: 8px 12px; border-radius: 8px; }
.nav-main .nav-link:hover { color: #fff; background: rgba(255,255,255,.15); }
.nav-main .nav-link.active { color: #fff; font-weight: 700; background: rgba(0,0,0,.15); }
.nav-main .dropdown-menu { border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); border: none; min-width: 150px; }
.nav-main .dropdown-menu .dropdown-item { padding: 9px 16px; font-size: 14px; }
.nav-main .dropdown-menu .dropdown-item:hover { background: #fdeee8; color: var(--brand); }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1030;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 0 6px;
  color: #888;
  text-decoration: none;
  font-size: 11px;
}
.bottom-nav a span { display: block; font-size: 20px; line-height: 1.2; }
.bottom-nav a.active { color: var(--brand); font-weight: 600; }
.bottom-nav a.nav-add span { font-size: 24px; }

/* ---------- 卡片与通用 ---------- */
.card { border: none; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.05); margin-bottom: 14px; }
.card-header {
  background: #fff; border-bottom: 1px solid #f0f0f0;
  font-weight: 600; padding: 12px 16px; border-radius: 12px 12px 0 0 !important;
}
.card-body { padding: 14px 16px; }

.stat-card { text-align: center; padding: 14px 8px; }
.stat-card .stat-num { font-size: 24px; font-weight: 700; color: #222; }
.stat-card .stat-label { font-size: 12px; color: #999; margin-top: 2px; }
.stat-card.accent .stat-num { color: var(--brand); }

.section-title { font-size: 16px; font-weight: 700; margin: 18px 0 10px; }

/* ---------- 管理中心卡片 ---------- */
.admin-card { display: block; background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.05); color: inherit; }
.admin-card:active { background: #fafafa; }
.admin-icon { font-size: 32px; }

/* ---------- 记录列表 ---------- */
.record-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.04);
  text-decoration: none; color: inherit;
}
.record-item:active { background: #fafafa; }
.record-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.record-main { flex: 1; min-width: 0; }
.record-title { font-weight: 600; font-size: 15px; }
.record-sub { color: #999; font-size: 12px; margin-top: 2px; }
.record-amount { font-weight: 700; color: var(--brand); font-size: 16px; flex-shrink: 0; }
.tag {
  display: inline-block; background: #fdeee8; color: var(--brand);
  border-radius: 10px; font-size: 11px; padding: 1px 8px; margin: 2px 3px 0 0;
}

/* ---------- 环比 ---------- */
.cmp-up { color: #2e9e44; font-weight: 700; }
.cmp-down { color: #d43c33; font-weight: 700; }
.cmp-flat { color: #999; }

/* ---------- 表格 ---------- */
.table { font-size: 13px; }
.table th { white-space: nowrap; color: #666; font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }

/* ---------- 图表容器 ---------- */
.chart-box { width: 100%; height: 300px; }
.chart-box.sm { height: 220px; }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-bar select, .filter-bar input { max-width: 160px; }

/* ---------- 报告页（免登录公开） ---------- */
.report-page { padding: 16px; max-width: 640px; margin: 0 auto; }

/* ---------- 标签云 ---------- */
.tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tagcloud .tag { font-size: 13px; padding: 4px 12px; border-radius: 16px; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 767px) {
  .filter-bar select, .filter-bar input { max-width: 46%; flex: 1; }
  .d-md-flex { display: flex !important; }
  .chart-box { height: 260px; }
}

.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.toast-container { z-index: 2000; }

/* ---------- 全局底部署名条 ---------- */
.footer-brand {
  text-align: center;
  color: #b0b6bf;
  font-size: 12px;
  line-height: 1.7;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px);
  background: #fff;
  border-top: 1px solid #f0f0f0;
  z-index: 1020;
}
.footer-brand .fb-line1 { font-weight: 500; color: #9aa1ab; }
/* 登录页 */
.login-page .footer-brand { position: fixed; left: 0; right: 0; bottom: 0; background: transparent; border-top: none; }
/* 主应用：固定在底部导航上方 */
#page-app .footer-brand { position: fixed; left: 0; right: 0; bottom: 0; }
/* 桌面端（无底部导航）署名贴底；移动端（有底部导航）署名在导航上方 */
@media (min-width: 768px) {
  #page-app .footer-brand { bottom: 0; }
}
@media (max-width: 767px) {
  #page-app .footer-brand { bottom: 52px; }
}
/* 报告页 */
.report-page .footer-brand { margin-top: 20px; border-radius: 10px; background: #fff; }

/* ==================== LTV × RFM 顾客分层矩阵（数字营销化） ==================== */

/* 看板四象限矩阵：2×2 网格 */
.quadrant-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 767px) {
  .quadrant-matrix { grid-template-columns: 1fr; }
}
.quadrant-cell {
  border: 1px solid #eef0f3;
  border-top: 4px solid var(--q-accent, #888);
  border-radius: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
  transition: transform .15s ease, box-shadow .15s ease;
}
.quadrant-cell:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(30, 40, 60, .08); }
.quadrant-head { display: flex; align-items: center; gap: 10px; }
.quadrant-emoji { font-size: 26px; line-height: 1; }
.quadrant-name { font-weight: 700; font-size: 15px; }
.quadrant-name small { font-weight: 400; font-size: 11px; }
.quadrant-strategy { font-size: 12px; color: var(--q-accent, #555); font-weight: 600; margin-top: 2px; }
.quadrant-nums {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 10px;
  text-align: center;
}
.quadrant-nums div { background: #fff; border: 1px solid #f0f1f4; border-radius: 8px; padding: 6px 2px; }
.quadrant-nums b { display: block; font-size: 15px; color: #26303d; }
.quadrant-nums small { font-size: 10px; color: #9aa1ab; }
.quadrant-bar { height: 5px; background: #f0f1f4; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.quadrant-bar div { height: 100%; border-radius: 3px; transition: width .4s ease; }
.quadrant-summary { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.quadrant-summary .badge { font-size: 12px; font-weight: 400; }

/* 顾客详情页：LTV 文字化解释条 */
.ltv-explain {
  border-left: 4px solid #e8532d;
  background: #fafbfc;
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
}
.ltv-explain-title { font-weight: 600; font-size: 13.5px; color: #26303d; }
.ltv-explain-sub { font-size: 11.5px; color: #9aa1ab; margin-top: 2px; }

/* 顾客详情页：四象限运营建议卡 */
.quadrant-card {
  border: 1px solid #eef0f3;
  border-left: 4px solid var(--q-accent, #888);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}
.quadrant-card-head { display: flex; align-items: center; gap: 10px; }
.quadrant-desc { font-size: 12.5px; color: #5c6672; margin-top: 8px; line-height: 1.6; }
.quadrant-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* 顾客列表：象限徽章 */
.quadrant-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 600;
  vertical-align: middle;
}
.ltv-text { font-size: 12px; margin-top: 2px; }

/* ==================== 历史顾客支出导入页 ==================== */
#import-page .imp-tip { background: #f7f9fc; border: 1px dashed #d4dae3; border-radius: 8px; }
#import-page textarea { font-family: Menlo, Consolas, monospace; font-size: 12.5px; }
#import-page .tag { background: #eef3fb; color: #3a6db5; border: 1px solid #d6e2f3; }
