/* ============================================================
   石榴湾 AI 助理 — 统一样式表 (v3 Phone Frame)
   配色: 石榴红#B53431 | 金色#C8963E | 木色#5C3D2E | 石色#7A6A5A
   ============================================================ */

/* === 全局变量 === */
:root {
  --red: #B53431; --red-bright: #D94036; --gold: #C8963E; --gold-light: #E8C97A;
  --wood: #5C3D2E; --wood-light: #8B6F5E; --stone: #7A6A5A;
  --bg: #F5F0E8; --card-bg: #FFFCF8; --border: #E0D5C5;
  --shadow: 0 3px 16px rgba(92,61,46,0.1); --radius: 16px;
  --green: #5A8A4A; --green-light: #EAF4E2;
  --font: -apple-system,'PingFang SC','Microsoft YaHei',sans-serif;
  --phone-width: 420px;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: var(--font); font-size: 16px;
  background: linear-gradient(160deg, #0f0c29 0%, #1a1a2e 30%, #16213e 60%, #0f3460 100%);
  min-height: 100vh; color: var(--wood); line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  overflow: hidden;
}

/* ============================================================
   === 手机框架 ===
   ============================================================ */
.phone-frame {
  width: var(--phone-width); max-width: 100vw;
  height: 96vh;
  background: #0a0a0a;
  border-radius: 34px;
  box-shadow:
    0 0 0 3px #1a1a1a,
    0 0 0 6px #2a2a2a,
    0 0 0 8px #1a1a1a,
    0 20px 60px rgba(0,0,0,0.55),
    inset 0 0 2px rgba(255,255,255,0.05);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}

.phone-status-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 24px 6px;
  background: #0a0a0a;
  color: #e0e0e0;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}
.phone-status-bar .psb-time {
  font-size: 15px; font-weight: 800; letter-spacing: 0.5px;
}
.phone-status-bar .psb-icons {
  display: flex; align-items: center; gap: 7px;
}
.phone-signal {
  display: flex; align-items: flex-end; gap: 1.5px; height: 12px;
}
.phone-signal .bar {
  width: 2.5px; background: #e0e0e0; border-radius: 1px;
}
.phone-signal .bar:nth-child(1) { height: 4px; }
.phone-signal .bar:nth-child(2) { height: 6px; }
.phone-signal .bar:nth-child(3) { height: 9px; }
.phone-signal .bar:nth-child(4) { height: 12px; }
.phone-wifi { font-size: 12px; letter-spacing: -1px; }
.phone-battery {
  display: flex; align-items: center; gap: 3px;
}
.phone-battery-icon {
  width: 24px; height: 11px;
  border: 1.5px solid #e0e0e0; border-radius: 2.5px;
  position: relative; padding: 1.5px;
}
.phone-battery-icon::after {
  content: ''; position: absolute; top: 50%; transform: translateY(-50%);
  right: -3px; width: 2px; height: 5px;
  background: #e0e0e0; border-radius: 0 1px 1px 0;
}
.phone-battery-fill {
  height: 100%; background: #4CAF50; border-radius: 1px;
  width: 75%;
}
.phone-battery-text {
  font-size: 12px; font-weight: 700;
}

.phone-screen {
  flex: 1 0 0; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  position: relative;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* === 全局滚动条优化：去边框、去箭头、极简 === */
.phone-screen::-webkit-scrollbar,
#fw .content::-webkit-scrollbar,
.phone-frame *::-webkit-scrollbar {
  width: 4px;
}
.phone-screen::-webkit-scrollbar-track,
#fw .content::-webkit-scrollbar-track,
.phone-frame *::-webkit-scrollbar-track {
  background: transparent;
  border: none;
}
.phone-screen::-webkit-scrollbar-thumb,
#fw .content::-webkit-scrollbar-thumb,
.phone-frame *::-webkit-scrollbar-thumb {
  background: rgba(122,106,90,0.25);
  border-radius: 4px;
  border: none;
}
.phone-screen::-webkit-scrollbar-thumb:hover,
#fw .content::-webkit-scrollbar-thumb:hover,
.phone-frame *::-webkit-scrollbar-thumb:hover {
  background: rgba(122,106,90,0.4);
}
.phone-screen::-webkit-scrollbar-button,
#fw .content::-webkit-scrollbar-button,
.phone-frame *::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
.phone-screen::-webkit-scrollbar-corner,
#fw .content::-webkit-scrollbar-corner,
.phone-frame *::-webkit-scrollbar-corner {
  background: transparent;
}

.phone-home-bar {
  height: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0a0a0a;
}
.phone-home-indicator {
  width: 134px; height: 5px;
  background: #555;
  border-radius: 100px;
}

/* ============================================================
   === 主 Tab 栏 ===
   ============================================================ */
.mtb {
  display: flex; justify-content: center;
  background: linear-gradient(180deg,#3D2B1F,#5C3D2E);
  position: sticky; top: 0; z-index: 300;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.mtbtn {
  padding: 9px 28px; border: 0; background: none;
  font-size: 14px; font-weight: 800; color: rgba(255,255,255,.6);
  cursor: pointer; border-bottom: 3px solid transparent;
  transition: .2s; font-family: var(--font); letter-spacing: 1px;
}
.mtbtn:hover { color: rgba(255,255,255,.9); }
.mtbtn.on {
  color: var(--gold-light); border-bottom-color: var(--gold);
  background: rgba(255,255,255,.05);
}
.cw { display: none !important; }
.cw.on { display: flex !important; flex-direction: column; flex: 1 0 auto; min-height: 0; }
#fw { background: var(--bg); }
#aw { background: var(--bg); }

/* ========== Toast ========== */
.toast {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%) translateY(-20px);
  padding: 12px 24px; border-radius: 24px; font-size: 15px; font-weight: 700;
  z-index: 9999; pointer-events: none;
  transition: all .3s cubic-bezier(.175,.885,.32,1.275);
  opacity: 0; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.toast.sh { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-s { background: #4CAF50; color: #fff; }
.toast-e { background: #D94036; color: #fff; }
.toast-w { background: #FF9800; color: #fff; }
.toast-i { background: var(--wood); color: #fff; }

/* ========== QR 弹窗 ========== */
.qpo {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.6); z-index: 500;
  display: none; align-items: center; justify-content: center;
}
.qpo.sh { display: flex; }
.qp {
  background: white; border-radius: var(--radius); padding: 28px;
  text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.3);
  max-width: 330px; width: 90%;
}
.qp .qt { font-size: 18px; font-weight: 700; color: var(--wood); margin-bottom: 16px; }
.qp .qcw { display: flex; justify-content: center; margin-bottom: 16px; min-height: 200px; align-items: center; }
.qp .qa { display: flex; gap: 8px; justify-content: center; }
.qp .qa button { flex: 1; }

/* ========== 错误提示 ========== */
.eb {
  display: none; background: #FFF0F0; color: var(--red);
  padding: 10px 24px; font-size: 14px; border-bottom: 2px solid var(--red);
}

/* ============================================================
   ============== 共享组件 ==============
   ============================================================ */

/* 按钮 */
.btn {
  padding: 6px 14px; border: none; border-radius: 8px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .1s;
  font-family: var(--font); min-width: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: scale(.97); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover, .btn-red:active { background: var(--red-bright); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover, .btn-gold:active { background: #B5852E; }
.btn-outline { background: #fff; border: 2px solid var(--border); color: var(--wood); font-weight: 600; }
.btn-outline:active { border-color: var(--red); color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 30px; border-radius: 8px; }
.btn-block { width: 100%; }

/* 二维码按钮（金色高亮） */
.btn-qr { background: var(--gold); color: #fff; font-weight: 700; }
.btn-qr:hover, .btn-qr:active { background: #B5852E; }

/* AI语智按钮组 */
.yz-btn-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
}
.yz-btn-group .btn {
  max-width: 280px;
  width: 100%;
}
.btn-icon { min-width: 52px; min-height: 52px; font-size: 24px; padding: 0; }

/* 标签 */
.tag { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.tag-red { background: #FFF0F0; color: var(--red); }
.tag-gold { background: #FFF9F0; color: var(--gold); }
.tag-green { background: var(--green-light); color: var(--green); }
.tag-stone { background: #F0EBE2; color: var(--stone); }
.tag-wood { background: #F0EBE2; color: var(--wood); }

/* 卡片 */
.card { background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px; }
.card-title { font-size: 15px; font-weight: 800; color: var(--wood); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-title .icon { font-size: 18px; }

/* 表单 */
.form-group { margin-bottom: 12px; }
.form-label { font-size: 14px; font-weight: 800; color: var(--wood); margin-bottom: 5px; display: block; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; border: 2px solid var(--border);
  border-radius: 12px; font-size: 15px; outline: none;
  transition: border-color .15s; font-family: var(--font); background: #fff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); }
.form-textarea { resize: vertical; min-height: 72px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 120px; }
.form-edit-msg { font-size: 14px; color: var(--red); font-weight: 700; margin-left: 12px; }

/* 输入组 */
.input-group { display: flex; align-items: stretch; margin-bottom: 12px; }
.input-group input {
  flex: 1; padding: 10px 14px; border: 2px solid var(--border); border-right: none;
  border-radius: 12px 0 0 12px; font-size: 15px; outline: none;
  font-family: var(--font); background: #fff; min-width: 0;
}
.input-group input:focus { border-color: var(--red); }
.input-group .input-group-btn {
  padding: 12px 16px; border: none; border-radius: 0 12px 12px 0;
  background: var(--red); color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: var(--font); display: flex; align-items: center;
  justify-content: center; white-space: nowrap; transition: background .15s;
}
.input-group .input-group-btn:hover, .input-group .input-group-btn:active { background: var(--red-bright); }

/* 表格 */
.table-wrap { overflow-x: auto; margin-top: 10px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 8px; font-size: 13px; font-weight: 800; color: var(--stone); border-bottom: 3px solid var(--border); white-space: nowrap; background: #FFFBF5; }
td { padding: 8px; border-bottom: 2px solid #F0EBE2; font-size: 13px; }
tr:nth-child(even) { background: #FFFCF8; }
tr:hover { background: #FFF5EC; }
.action-cell { white-space: nowrap; text-align: center; }
.action-icon-btn { background: none; border: none; font-size: 17px; cursor: pointer; padding: 3px 5px; border-radius: 6px; transition: background .15s; line-height: 1; vertical-align: middle; }
.action-icon-btn:hover { background: var(--bg); }
.action-icon-btn.edit { color: #C8963E; }
.action-icon-btn.delete { color: #B53431; }

/* 知识库滑动卡片列表 */
.kb-swipe-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 0 10px; margin-top: 8px; }
.kb-swipe-toolbar .toolbar-left { font-size: 14px; font-weight: 700; color: var(--wood); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.kb-swipe-list { user-select: none; }
.kb-swipe-item { position: relative; overflow: hidden; margin-bottom: 8px; border-radius: 12px; background: #fff; box-shadow: 0 1px 5px rgba(92,61,46,0.08); touch-action: pan-y; }
.kb-swipe-inner { display: flex; transition: transform .25s cubic-bezier(.25,.8,.25,1); will-change: transform; }
.kb-swipe-item.swiped .kb-swipe-inner { transform: translateX(-128px); }
.kb-swipe-content { flex: 1 0 100%; min-width: 0; padding: 11px 12px; display: flex; align-items: flex-start; gap: 10px; }
.kb-swipe-check { flex-shrink: 0; padding-top: 2px; }
.kb-swipe-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--red); }
.kb-swipe-body { flex: 1; min-width: 0; }
.kb-swipe-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; }
.kb-swipe-onoff { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--green); flex-shrink: 0; }
.kb-swipe-onoff.off { color: #aaa; }
.kb-swipe-text { font-size: 13px; color: var(--wood); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
.kb-swipe-actions { flex: 0 0 128px; display: flex; align-items: stretch; }
.kb-swipe-actions button { flex: 1; border: none; font-size: 13px; font-weight: 700; color: #fff; cursor: pointer; font-family: var(--font); padding: 0; }
.kb-swipe-btn-edit { background: #C8963E; }
.kb-swipe-btn-del { background: #B53431; }
.kb-filter-row { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.kb-filter-row .form-input { padding: 8px 10px; font-size: 13px; }
.kb-filter-row .form-select { padding: 8px 6px; font-size: 12px; }

/* 开关 */
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.switch-label { font-size: 15px; font-weight: 800; color: var(--wood); }
.switch { width: 48px; height: 28px; border-radius: 14px; background: #ccc; position: relative; cursor: pointer; transition: .2s; flex-shrink: 0; }
.switch.on { background: var(--green); }
.switch::after { content: ''; width: 24px; height: 24px; border-radius: 50%; background: #fff; position: absolute; top: 2px; left: 2px; transition: .2s; }
.switch.on::after { left: 22px; }
.switch-sm { width: 38px !important; height: 22px !important; border-radius: 11px; }
.switch-sm::after { width: 16px; height: 16px; top: 3px; left: 3px; }
.switch-sm.on::after { left: 19px; }

/* 空状态 */
.empty { text-align: center; padding: 36px 20px; color: var(--stone); font-size: 15px; }

/* ============================================================
   ============== 前台工作台 (#fw) ==============
   ============================================================ */
#fw .tablet {
  width: 100%; flex: 1 0 auto; min-height: 0;
  background: var(--bg); border-radius: 0;
  box-shadow: none; display: flex; flex-direction: column;
  overflow: hidden; position: relative;
}
#fw .status-bar { display: flex; justify-content: space-between; align-items: center; padding: 2px 14px 0; font-size: 9px; color: var(--wood-light); background: #FFF8F0; font-weight: 500; }
#fw .header { display: flex; align-items: center; justify-content: space-between; padding: 0 14px 1px; background: #FFF8F0; }
#fw .header-title { font-family: Georgia,'STSong',serif; font-size: 14px; font-weight: 700; color: var(--red); letter-spacing: .5px; }
#fw .header-sub { font-size: 8px; color: var(--gold); font-weight: 600; }

/* 内容区 */
#fw .content { overflow-y: auto; padding: 2px 12px; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 0; }

/* 页面 */
#fw .page { display: none; }
#fw .page.active { display: block; }

/* 底部导航 */
#fw .nav { display: flex; background: #FFF8F0; border-top: 2px solid var(--border); padding: 0; flex-shrink: 0; }
#fw .nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 0; border: none; background: none; font-size: 10px; font-weight: 700; color: var(--stone); cursor: pointer; gap: 0; transition: .15s; min-height: 36px; font-family: var(--font); }
#fw .nav-item .nav-icon { font-size: 16px; line-height: 1; position: relative; }
#fw .nav-item.active { color: var(--red); }
#fw .nav-item.active::after { content: ''; display: block; width: 18px; height: 2px; background: var(--red); border-radius: 2px; margin-top: 1px; }

/* 通知栏 */
.notice-bar { margin: 2px 0 0; background: linear-gradient(135deg,#FFF8E8,#FFF0E0); border: 1.5px solid var(--gold-light); border-radius: 10px; overflow: hidden; }
.notice-bar-header { display: flex; align-items: center; justify-content: space-between; padding: 3px 10px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--red); }
.notice-bar-header .arrow { transition: transform .25s; font-size: 9px; }
.notice-bar.open .arrow { transform: rotate(180deg); }
.notice-bar-body { padding: 0 10px 4px; display: none; }
.notice-bar.open .notice-bar-body { display: block; }
.notice-item { background: #fff; border-radius: 6px; padding: 4px 8px; margin-bottom: 2px; border-left: 3px solid var(--gold-light); }
.notice-item .n-title { font-size: 12px; font-weight: 700; color: var(--wood); margin-bottom: 1px; }
.notice-item .n-content { font-size: 11px; color: #666; line-height: 1.4; }
.notice-item .n-meta { font-size: 9px; color: var(--stone); margin-top: 1px; display: flex; gap: 4px; }
.n-tag { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.n-tag-policy { background: #FFF0F0; color: var(--red); }
.n-tag-promo { background: #FFF8E8; color: var(--gold); }
.n-tag-event { background: #E8F4FF; color: #3B82F6; }
.n-tag-notice { background: #F0EBE2; color: var(--wood); }
.notice-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--red); color: #fff; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; margin-left: 6px; }

/* 场景选择 */
.scene-select { display: flex; gap: 4px; margin-bottom: 4px; }
.scene-btn { flex: 1; padding: 4px 2px; border: 2px solid var(--border); border-radius: 8px; background: #fff; font-size: 11px; font-weight: 700; color: var(--wood); cursor: pointer; text-align: center; transition: .15s; line-height: 1.2; word-break: keep-all; min-height: 28px; display: flex; align-items: center; justify-content: center; font-family: var(--font); }
.scene-btn.active { border-color: var(--red); color: var(--red); background: #FFF5F5; }

/* 语音监听 */
.listen-overlay { background: var(--red); color: #fff; padding: 6px 12px; border-radius: 12px; text-align: center; margin-bottom: 4px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .7; } }@keyframes slideDown { from{transform:translate(-50%,-100%);opacity:0} to{transform:translate(-50%,0);opacity:1} }
.listen-overlay .big-text { font-size: 17px; font-weight: 800; }
.listen-overlay .sub-text { font-size: 13px; margin-top: 2px; opacity: .9; }

/* 对话气泡 */
.talk-bubble { background: #fff; border-radius: 10px; padding: 8px 10px; margin-bottom: 4px; border-left: 4px solid var(--gold); font-size: 13px; color: var(--wood); line-height: 1.5; }
.talk-bubble .role { font-size: 11px; font-weight: 700; color: var(--gold); margin-bottom: 2px; }
.talk-bubble.customer { border-left-color: #E0A0A0; }

/* 对比框 */
.compare-box { display: flex; gap: 8px; margin: 8px 0; }
.compare-col { flex: 1; padding: 12px; border-radius: 12px; font-size: 14px; line-height: 1.7; background: #F9F5F0; border: 2px solid var(--border); }
.compare-col.ai { border-color: var(--gold); background: #FFFBF5; }
.compare-col .col-label { font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--stone); }

/* 报告行 */
.report-line { padding: 6px 10px; background: var(--card-bg); border-radius: 8px; margin-bottom: 4px; font-size: 14px; font-weight: 700; color: var(--wood); display: flex; align-items: center; gap: 8px; }
.report-line .rl-icon { font-size: 18px; }

/* 聚合看板 */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 0; }
.dash-card { background: linear-gradient(135deg, #fff, #FFF8F0); border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.04); }
.dash-card.full { grid-column: 1 / -1; }
.dash-card .dc-title { font-size: 13px; color: var(--stone); margin-bottom: 8px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.dash-card .dc-title .dc-icon { font-size: 16px; }
.dash-card .dc-metric { font-size: 28px; font-weight: 800; color: var(--red); line-height: 1.1; }
.dash-card .dc-sub { font-size: 12px; color: var(--stone); margin-top: 4px; }
.dash-card .dc-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.dash-card .dc-row:last-child { border-bottom: none; }
.dash-card .dc-row .dc-label { color: var(--stone); }
.dash-card .dc-row .dc-value { color: var(--wood); font-weight: 700; }
.dash-card .dc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dash-card .dc-actions .btn-sm { font-size: 12px; padding: 4px 10px; }

/* 产品网格（前台 — 2列 + 滚动） */
#fw .product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 55vh; overflow-y: auto; }
#fw .product-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: .15s; position: relative; }
#fw .product-card:active { transform: scale(.97); }
#fw .product-card .p-img { height: 110px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 44px; }
#fw .product-card .p-info { padding: 10px; }
#fw .product-card .p-name { font-size: 14px; font-weight: 700; color: var(--wood); }
#fw .product-card .p-price { font-size: 13px; color: var(--red); font-weight: 700; margin-top: 3px; }

.cart-add-btn { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; background: var(--red); color: #fff; border: none; border-radius: 50%; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 5; }
.cart-add-btn:active { background: var(--red-bright); }

/* 分类标签 */
.cat-tags { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.cat-tag { padding: 8px 14px; border-radius: 18px; font-size: 14px; font-weight: 700; border: 2px solid var(--border); background: #fff; color: var(--stone); cursor: pointer; font-family: var(--font); }
.cat-tag.active { background: var(--red); color: #fff; border-color: var(--red); }

/* 一句话卖点 */
.one-liner { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.one-liner .pt-btn { padding: 10px 14px; background: var(--card-bg); border: 2px solid var(--gold); border-radius: 10px; font-size: 15px; font-weight: 700; color: var(--wood); cursor: pointer; text-align: left; font-family: var(--font); }
.one-liner .pt-btn:active { background: #FFF5E8; }

/* 搭配推荐 */
.match-list { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.match-item { min-width: 90px; text-align: center; padding: 8px; background: var(--card-bg); border-radius: 12px; cursor: pointer; }
.match-item .mi-img { font-size: 28px; }
.match-item .mi-name { font-size: 13px; font-weight: 700; color: var(--wood); margin-top: 4px; }

/* 全屏详情 */
.full-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg); z-index: 50; display: flex; flex-direction: column; overflow-y: auto; }
.full-overlay .fo-header { display: flex; align-items: center; padding: 12px 14px; gap: 10px; background: #fff; box-shadow: var(--shadow); }
.fo-back { font-size: 16px; font-weight: 700; color: var(--red); cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.fo-body { padding: 14px; flex: 1; }
.fo-img { width: 100%; aspect-ratio: 4/3; background: #fff; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 72px; margin-bottom: 12px; cursor: pointer; }

/* 客户行 */
.client-row { display: flex; align-items: center; background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); cursor: pointer; border-left: 5px solid transparent; gap: 10px; }
.client-row.urgent { border-left-color: var(--red); background: #FFFBFB; }
.client-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--red); color: #fff; font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.client-info { flex: 1; min-width: 0; }
.client-name { font-size: 16px; font-weight: 700; color: var(--wood); }
.client-meta { font-size: 13px; color: var(--stone); margin-top: 2px; }
.client-right { text-align: right; flex-shrink: 0; }
.client-status { font-size: 13px; font-weight: 700; }

/* 星级 */
.stars { color: var(--gold); font-size: 17px; letter-spacing: 2px; }

/* 时间线 */
.timeline { padding: 0; }
.tl-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.tl-date { color: var(--stone); font-weight: 700; min-width: 40px; font-size: 13px; }
.tl-text { color: var(--wood); }
.tl-item.done .tl-text { color: var(--green); }

/* 语音提示 */
.voice-hint { text-align: center; padding: 3px 10px; font-size: 11px; color: var(--wood); background: var(--card-bg); border-radius: 8px; margin-bottom: 4px; cursor: pointer; }
.voice-hint strong { color: var(--red); }

/* 操作引导 */
.guide-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card-bg); border: 1.5px dashed #D0C8BB; border-radius: 12px; margin-bottom: 10px; }
.guide-icon { font-size: 28px; flex-shrink: 0; }
.guide-text { flex: 1; }
.guide-title { font-size: 15px; font-weight: 700; color: var(--wood); margin-bottom: 2px; }
.guide-sub { font-size: 13px; color: var(--stone); }

/* 客户选择浮层 */
.cust-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.cust-panel { width: 100%; max-height: 70%; background: var(--bg); border-radius: 20px 20px 0 0; padding: 20px 14px 14px; overflow-y: auto; animation: slideUp 0.25s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cust-panel-title { font-size: 17px; font-weight: 700; color: var(--wood); margin-bottom: 12px; text-align: center; }
.cust-search { margin-bottom: 10px; }
.cust-search input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; background: var(--card-bg); font-family: var(--font); }
.cust-list { max-height: 180px; overflow-y: auto; margin-bottom: 10px; }
.cust-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--card-bg); border-radius: 10px; margin-bottom: 6px; cursor: pointer; border: 2px solid transparent; }
.cust-item:hover, .cust-item.sel { border-color: var(--red); }
.cust-item-name { font-size: 16px; font-weight: 700; color: var(--wood); }
.cust-item-code { font-size: 12px; color: var(--stone); }
.cust-quick { padding: 10px; background: var(--card-bg); border-radius: 10px; margin-bottom: 10px; }
.cust-quick-row { display: flex; gap: 6px; margin-bottom: 6px; }
.cust-quick-row:last-child { margin-bottom: 0; }
.cust-quick input { flex: 1; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; font-family: var(--font); }
.cust-quick .btn { min-width: 56px; min-height: 36px; font-size: 14px; }

/* 清单徽章 */
.cart-badge { position: absolute; top: 46px; right: 12px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 10px; z-index: 50; cursor: pointer; display: none; pointer-events: auto; }

/* 清单抽屉 */
.cart-drawer-mask { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 109; display: none; }
.cart-drawer-mask.show { display: block; }
.cart-drawer { position: absolute; top: 0; right: 0; width: 85%; height: 100%; background: var(--bg); z-index: 110; box-shadow: -4px 0 20px rgba(0,0,0,0.2); display: none; flex-direction: column; animation: slideRight 0.25s ease; }
@keyframes slideRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.cart-drawer.show { display: flex; }
.cart-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cart-drawer-head .title { font-size: 17px; font-weight: 700; color: var(--wood); }
.cart-drawer-head .close { font-size: 20px; color: var(--stone); cursor: pointer; padding: 4px 8px; }
.cart-drawer-body { flex: 1; overflow-y: auto; padding: 10px 14px; }
.cart-drawer-foot { padding: 10px 14px; border-top: 1px solid var(--border); flex-shrink: 0; display: flex; gap: 8px; }
.cart-cust-info { font-size: 13px; color: var(--stone); margin-bottom: 10px; padding: 8px 10px; background: var(--card-bg); border-radius: 8px; }
.cart-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--card-bg); border-radius: 10px; margin-bottom: 6px; }
.cart-item-icon { font-size: 24px; flex-shrink: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 700; color: var(--wood); }
.cart-item-meta { font-size: 11px; color: var(--stone); margin-top: 2px; }
.cart-item-stars { color: var(--gold); font-size: 13px; cursor: pointer; }
.cart-item-del { color: var(--stone); font-size: 15px; cursor: pointer; padding: 4px; }
.cart-empty { text-align: center; padding: 36px 0; color: var(--stone); font-size: 14px; }
.cart-total { font-size: 13px; color: var(--wood); font-weight: 600; text-align: right; margin-top: 6px; }

/* 产品检测提示 */
.product-toast { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 6px 14px; border-radius: 18px; font-size: 13px; font-weight: 600; z-index: 60; white-space: nowrap; animation: fadeInOut 2.5s ease forwards; pointer-events: none; }
@keyframes fadeInOut { 0%{opacity:0;transform:translateX(-50%) translateY(-10px)} 15%{opacity:1;transform:translateX(-50%) translateY(0)} 85%{opacity:1} 100%{opacity:0} }

/* FAB 悬浮按钮 — 手机框架内相对定位 */
/* 统计网格（前台） */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
#fw .stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 14px 12px; box-shadow: var(--shadow); text-align: center; cursor: pointer; transition: .15s; border: 3px solid transparent; }
#fw .stat-card:active { transform: scale(.97); }
#fw .stat-card.active { border-color: var(--red); }
.stat-num { font-size: 24px; font-weight: 800; color: var(--red); }
.stat-label { font-size: 14px; font-weight: 700; color: var(--wood); margin-top: 2px; }

/* 离线标记 */
.offline-badge { display: inline-block; background: #F0E0D0; color: var(--stone); font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }

/* 搜索栏 */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-bar input { flex: 1; padding: 10px 14px; border: 2px solid var(--border); border-radius: 12px; font-size: 15px; outline: none; font-family: var(--font); }
.search-bar input:focus { border-color: var(--gold); }

/* ============================================================
   ============== 后台管理 (#aw) ==============
   ============================================================ */
#aw .topbar { background: #fff; border-bottom: 2px solid var(--border); padding: 8px 12px; display: flex; flex-direction: column; align-items: stretch; box-shadow: var(--shadow); gap: 6px; }
#aw .topbar-left { display: flex; align-items: center; gap: 8px; }
#aw .logo { font-family: Georgia,'STSong',serif; font-size: 17px; font-weight: 800; color: var(--red); white-space: nowrap; }
#aw .topbar-badge { font-size: 11px; color: var(--stone); background: #F0EBE2; padding: 4px 10px; border-radius: 10px; font-weight: 700; white-space: nowrap; }

#aw .tab-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; width: 100%; }
#aw .tab-btn { padding: 10px 2px; border: none; background: none; font-size: 13px; font-weight: 700; color: var(--stone); cursor: pointer; border-bottom: 3px solid transparent; transition: .15s; white-space: nowrap; text-align: center; font-family: var(--font); }
#aw .tab-btn:hover { color: var(--wood); }
#aw .tab-btn.active { color: var(--red); border-bottom-color: var(--red); background: #FFF8F8; }

#aw .main { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 12px; }
#aw .panel { display: none; }
#aw .panel.active { display: block; }

/* 统计行 */
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-item { background: var(--card-bg); border-radius: var(--radius); padding: 14px 12px; box-shadow: var(--shadow); text-align: center; }
.stat-item .num { font-size: 24px; font-weight: 800; color: var(--red); word-break: break-all; }
.stat-item .lbl { font-size: 13px; color: var(--stone); margin-top: 2px; font-weight: 700; white-space: nowrap; }

/* 模态框 */
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,0.2); width: 90%; max-width: 380px; max-height: 75vh; overflow-y: auto; padding: 22px; }
.modal-title { font-size: 18px; font-weight: 800; color: var(--wood); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* 销售排行 */
.rank-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; font-weight: 800; color: #fff; }
.rank-1 { background: linear-gradient(135deg,#D4A017,#C8963E); }
.rank-2 { background: linear-gradient(135deg,#B0B0B0,#909090); }
.rank-3 { background: linear-gradient(135deg,#CD7F32,#A0522D); }
.rank-other { background: var(--border); color: var(--stone); }
.sales-bar-wrap { flex: 1; height: 7px; background: #F0EBE2; border-radius: 4px; overflow: hidden; min-width: 30px; }
.sales-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.sales-bar-fill.gold { background: linear-gradient(90deg,var(--gold-light),var(--gold)); }
.sales-bar-fill.red { background: linear-gradient(90deg,#E88888,var(--red)); }
.sales-highlight { background: #FFFBF0 !important; }
.sales-highlight td { font-weight: 700; }
.sales-trend-up { color: var(--red); font-weight: 800; }
.sales-trend-flat { color: var(--stone); }
.sales-filter-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.sales-filter-row select { padding: 8px 12px; border: 2px solid var(--border); border-radius: 10px; font-size: 14px; background: #fff; font-family: var(--font); }

/* 销售排行榜表头 — 深色高对比度 */
#salesTable th { background: var(--wood); color: #fff; border-bottom-color: var(--wood); }

/* CRM 客户表格 — 列宽优化 */
#crmTable { table-layout: auto; }
#crmTable th:nth-child(2), #crmTable td:nth-child(2) { min-width: 56px; }
#crmTable th:nth-child(3), #crmTable td:nth-child(3) { min-width: 80px; }
#crmTable th:nth-child(6), #crmTable td:nth-child(6) { min-width: 70px; }
#crmTable th:nth-child(8), #crmTable td:nth-child(8) { min-width: 60px; }
#crmTable th:nth-child(11), #crmTable td:nth-child(11) { min-width: 80px; }
#crmTable td { overflow: hidden; text-overflow: ellipsis; max-width: 140px; }

/* 产品库（后台） */
#aw .product-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
#aw .product-card { background: #fff; border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow .2s; }
#aw .product-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.product-card-img { width: 100%; height: 160px; background: #F5F0E8; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--stone); font-size: 14px; border-radius: 12px 12px 0 0; }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 12px; }
.product-card-body .name { font-size: 15px; font-weight: 700; color: var(--wood); margin-bottom: 4px; }
.product-card-body .cat { font-size: 12px; color: var(--gold); margin-bottom: 4px; }
.product-card-body .price { font-size: 13px; color: var(--red); font-weight: 700; }
.product-card-body .desc { font-size: 12px; color: var(--stone); margin-top: 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.product-card-actions button { flex: 1; font-size: 12px; padding: 5px 0; }

/* 图片上传 */
.img-upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--stone); cursor: pointer; transition: .2s; background: #FAFAFA; margin-bottom: 10px; }
.img-upload-area:hover { border-color: var(--gold); color: var(--gold); }
.img-upload-area input { display: none; }
.img-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.img-preview-item { width: 72px; height: 72px; border-radius: 8px; overflow: hidden; position: relative; border: 2px solid var(--border); }
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-item .del { position: absolute; top: 2px; right: 2px; background: var(--red); color: #fff; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; line-height: 1; }

/* 通知管理标签 */
.notice-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.notice-type-policy { background: #FFF0F0; color: var(--red); border: 1px solid var(--red-bright); }
.notice-type-promo { background: #FFF8E8; color: #C8963E; border: 1px solid var(--gold-light); }
.notice-type-event { background: #E8F4FF; color: #3B82F6; border: 1px solid #93C5FD; }
.notice-type-notice { background: #F0EBE2; color: var(--wood); border: 1px solid var(--border); }
.notice-pin { color: var(--stone); font-size: 15px; cursor: pointer; }
.notice-pin.active { color: var(--red) !important; }

/* 响应式：小屏适配 */
@media (max-width: 440px) {
  .phone-frame { width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; border: none; box-shadow: none; }
  body { padding: 0; }
  .phone-screen { border-radius: 0; }
  .phone-status-bar { padding: 8px 20px 6px; }
  .phone-home-bar { height: 22px; }
  .modal { max-width: 92%; }
}