/* OneBiz 擎营 · 移动端演示（仿原生 App） */
:root {
  --navy: #0e1a30;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --line: #eaecf0;
  --bg: #f7f8fb;
  --blue: #2563eb;
  --blue-soft: #eef4ff;
  --teal: #0d9488;
  --teal-soft: #e6f7f4;
  --amber: #b54708;
  --amber-soft: #fff6e8;
  --red: #b42318;
  --red-soft: #fef3f2;
  --green: #067647;
  --green-soft: #ecfdf3;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #e8edf6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  overflow: hidden;
}

/* ---------- 手机外框（桌面查看时呈现设备效果） ---------- */
.app-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  max-height: 920px;
  background: #fff;
  border-radius: 46px;
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(15, 27, 51, .28), 0 0 0 10px #0d1526, 0 0 0 12px #2a3346;
  display: flex;
  flex-direction: column;
  transform: translateZ(0);
}

@media (max-width: 520px) {
  body { background: #fff; display: block; }
  .app-shell {
    max-width: none;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ---------- 状态栏 ---------- */
.statusbar {
  flex: 0 0 auto;
  height: calc(44px + var(--safe-top));
  padding: var(--safe-top) 26px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  position: relative;
  z-index: 30;
}
.statusbar .sb-right { display: flex; align-items: center; gap: 6px; }
.statusbar svg { display: block; }

/* ---------- 导航栏 ---------- */
.appbar {
  flex: 0 0 auto;
  min-height: 52px;
  padding: 2px 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  position: relative;
  z-index: 25;
}
.appbar h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.3px; flex: 1; }
.appbar .sub { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.appbar .actions { display: flex; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
}
.icon-btn:active { background: #f2f4f7; }
.back-btn {
  width: 36px; height: 36px; margin-left: -6px; border: none; background: none;
  display: grid; place-items: center; cursor: pointer; color: var(--ink);
}

/* ---------- 内容区 ---------- */
.screen {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  padding: 14px 16px calc(96px + var(--safe-bottom));
  position: relative;
}
.screen.no-tabbar { padding-bottom: calc(16px + var(--safe-bottom)); }
.screen::-webkit-scrollbar { width: 0; }

/* push 页面滑入动画 */
.push-screen {
  position: absolute;
  inset: calc(44px + var(--safe-top)) 0 0 0;
  background: var(--bg);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.32, .72, 0, 1);
  will-change: transform;
}
.push-screen.show { transform: translateX(0); }
.push-screen .screen { padding-bottom: calc(12px + var(--safe-bottom)); }

/* ---------- 通用卡片 ---------- */
.card {
  background: #fff; border-radius: 16px; padding: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04); border: 1px solid #f2f4f7;
}
.card + .card { margin-top: 12px; }
.card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 650; }
.card p { margin: 4px 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 20px 2px 10px; font-size: 15px; font-weight: 650;
}
.section-title .more { font-size: 12px; color: var(--blue); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- 问候 + AI 入口 ---------- */
.greet { padding: 4px 2px 12px; }
.greet .hi { font-size: 13px; color: var(--muted); }
.greet .name { font-size: 24px; font-weight: 750; letter-spacing: -.4px; margin-top: 2px; }
.greet .meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--blue-soft); color: #1d4ed8;
}

.ai-input {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #e4e7ec; border-radius: 16px;
  padding: 14px 14px; margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .08);
  cursor: text;
}
.ai-input .dot-ai {
  width: 30px; height: 30px; border-radius: 10px; flex: 0 0 30px;
  background: linear-gradient(135deg, #2563eb, #0d9488); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.ai-input .ph { flex: 1; color: #98a2b3; font-size: 14px; }
.ai-input .mini { display: flex; gap: 6px; color: #98a2b3; }

/* ---------- KPI 横向滑动 ---------- */
.kpi-scroll {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 16px 6px;
  margin: 0 -16px 4px; scroll-snap-type: x mandatory;
}
.kpi-scroll::-webkit-scrollbar { display: none; }
.kpi {
  flex: 0 0 132px; scroll-snap-align: start;
  background: #fff; border: 1px solid #f2f4f7; border-radius: 14px; padding: 12px 13px;
}
.kpi b { display: block; font-size: 20px; letter-spacing: -.4px; }
.kpi span { font-size: 11px; color: var(--muted); }
.kpi .delta { font-size: 11px; font-weight: 650; margin-top: 4px; display: block; }
.up { color: var(--red); }
.down { color: var(--green); }

/* ---------- 待办 ---------- */
.todo { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid #f2f4f7; align-items: flex-start; }
.todo:last-child { border-bottom: none; padding-bottom: 0; }
.todo:first-child { padding-top: 2px; }
.todo .flag { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex: 0 0 8px; }
.flag.red { background: #f04438; }
.flag.amber { background: #f79009; }
.flag.blue { background: #2e90fa; }
.todo .t { flex: 1; }
.todo .t b { display: block; font-size: 14px; font-weight: 600; }
.todo .t span { font-size: 12px; color: var(--muted); }
.todo .go { color: #98a2b3; font-size: 18px; align-self: center; }

/* ---------- 应用宫格 ---------- */
.grid-apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; }
.app-item { display: flex; flex-direction: column; align-items: center; gap: 7px; cursor: pointer; }
.app-ico {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  font-size: 18px; color: #fff; box-shadow: 0 6px 14px rgba(16, 24, 40, .12);
}
.app-item span { font-size: 11.5px; color: var(--ink-2); }
.app-item:active .app-ico { transform: scale(.94); transition: .1s; }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 35;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid rgba(234, 236, 240, .9);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #98a2b3; font-size: 10.5px; font-weight: 600; cursor: pointer;
}
.tab.active { color: var(--blue); }
.tab svg { width: 23px; height: 23px; }

/* ---------- 聊天 ---------- */
.chat { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.msg { display: flex; gap: 8px; }
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 10px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #2563eb, #0d9488);
}
.msg.user .avatar { background: #344054; }
.bubble {
  max-width: 84%; background: #fff; border: 1px solid #f2f4f7; border-radius: 14px;
  padding: 11px 13px; font-size: 14px; line-height: 1.65; box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.msg.user .bubble { background: var(--blue); color: #fff; border-color: transparent; border-bottom-right-radius: 5px; }
.msg .bubble { border-bottom-left-radius: 5px; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: 6px 0; padding-left: 18px; }
.bubble li { margin: 3px 0; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag {
  font-size: 10.5px; padding: 2px 7px; border-radius: 999px;
  background: #f2f4f7; color: var(--ink-2);
  display: inline-flex; align-items: center; align-self: center; flex: 0 0 auto; white-space: nowrap;
}
.tag.blue { background: var(--blue-soft); color: #1d4ed8; }
.tag.teal { background: var(--teal-soft); color: var(--teal); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.green { background: var(--green-soft); color: var(--green); }

.evidence-btn {
  margin-top: 10px; width: 100%; text-align: left;
  border: 1px dashed #d0d5dd; background: #fcfcfd; border-radius: 10px;
  padding: 9px 11px; font-size: 12px; color: var(--ink-2); display: flex; justify-content: space-between;
}
.evidence-btn:active { background: #f9fafb; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip {
  border: 1px solid #d7e3fb; background: #f5f9ff; color: #1d4ed8;
  padding: 8px 12px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
}
.chip:active { background: #e8f1ff; }

.composer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center;
}
.composer .field {
  flex: 1; height: 40px; background: #f2f4f7; border-radius: 999px;
  display: flex; align-items: center; padding: 0 14px; color: #98a2b3; font-size: 14px;
}
.composer .send {
  width: 40px; height: 40px; border-radius: 999px; border: none; background: var(--blue);
  display: grid; place-items: center; color: #fff;
}

/* ---------- 底部弹层 ---------- */
.backdrop {
  position: absolute; inset: 0; background: rgba(16, 24, 40, .45); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .24s;
}
.backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 55;
  background: #fff; border-radius: 22px 22px 0 0;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.32,.72,0,1);
  max-height: 78%; display: flex; flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
.sheet.show { transform: translateY(0); }
.sheet .grabber { width: 38px; height: 4px; border-radius: 2px; background: #e4e7ec; margin: 10px auto 6px; }
.sheet-head { padding: 6px 18px 12px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f2f4f7; }
.sheet-head b { font-size: 16px; }
.sheet-body { padding: 14px 18px 20px; overflow-y: auto; font-size: 13.5px; color: var(--ink-2); }
.ev-item { padding: 10px 0; border-bottom: 1px dashed #eaecf0; display: flex; gap: 10px; }
.ev-item:last-child { border-bottom: none; }
.ev-item .num {
  flex: 0 0 20px; height: 20px; border-radius: 6px; background: var(--blue-soft);
  color: #1d4ed8; font-size: 11px; font-weight: 700; display: grid; place-items: center; margin-top: 1px;
}

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 96px; transform: translate(-50%, 12px);
  background: rgba(16, 24, 40, .92); color: #fff; font-size: 12.5px;
  padding: 9px 14px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 60; white-space: nowrap; max-width: 86%;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 分段控件 ---------- */
.segmented {
  display: flex; background: #f2f4f7; border-radius: 12px; padding: 3px; gap: 2px;
  margin-bottom: 14px; overflow-x: auto;
}
.segmented::-webkit-scrollbar { display: none; }
.seg {
  flex: 0 0 auto; padding: 7px 12px; border-radius: 9px; font-size: 12.5px;
  color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.seg.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08); }

/* ---------- 智能体列表 ---------- */
.agent {
  display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid #f2f4f7; align-items: center;
  cursor: pointer;
}
.agent:last-child { border-bottom: none; }
.agent .ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 15px; color: #fff; flex: 0 0 40px;
}
.agent .info { flex: 1; min-width: 0; }
.agent .info b { font-size: 14px; display: block; }
.agent .info span { font-size: 11.5px; color: var(--muted); display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .lvl { font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: #f2f4f7; color: var(--ink-2); }
.lvl.A3 { background: var(--green-soft); color: var(--green); }
.lvl.A2 { background: var(--blue-soft); color: #1d4ed8; }
.lvl.A1 { background: var(--amber-soft); color: var(--amber); }
.lvl.A0 { background: #f2f4f7; color: var(--muted); }

/* ---------- 经营 ---------- */
.chartbox { margin-top: 6px; }
.chartbox svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

.bar-row { margin-top: 10px; }
.bar-row .label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar { height: 7px; border-radius: 999px; background: #f2f4f7; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; }

/* ---------- 我的 ---------- */
.profile {
  display: flex; gap: 14px; align-items: center; padding: 4px 2px 16px;
}
.profile .big-avatar {
  width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(135deg, #0e1a30, #2563eb);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
}
.profile .name { font-size: 18px; font-weight: 700; }
.profile .role { font-size: 12px; color: var(--muted); margin-top: 3px; }
.list-group { background: #fff; border-radius: 16px; overflow: hidden; border: 1px solid #f2f4f7; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid #f2f4f7; font-size: 14px;
}
.list-row:last-child { border-bottom: none; }
.list-row .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; }
.list-row .label { flex: 1; }
.list-row .value { font-size: 12.5px; color: var(--muted); flex: 0 0 auto; white-space: nowrap; }
.list-row .chev { color: #d0d5dd; }
.list-row:active { background: #f9fafb; }

@media (max-width: 520px) {
  .statusbar { display: flex; height: calc(38px + var(--safe-top)); font-size: 13px; }
}
