* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 品牌配色（同时同步 Element Plus 主色，登录 el-* 与全局一致） */
  --pri: #2563eb; --pri-d: #1e40af; --pri-l: #eff4ff;
  --grad-pri: linear-gradient(135deg, #3b82f6, #2563eb);
  --grad-ok: linear-gradient(135deg, #22c55e, #16a34a);
  --grad-warn: linear-gradient(135deg, #fb923c, #ea580c);
  --text: #1f2430; --sub: #8792a6; --line: #e8ebf1; --canvas: #f5f7fb;
  --ok: #16a34a; --warn: #ea580c; --warn-bg: #fff5e9;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 16px rgba(16,24,40,.05);
  --shadow-lg: 0 8px 30px rgba(16,24,40,.10);
  --r: 12px; --r-sm: 9px;

  /* Element Plus 主色对齐 */
  --el-color-primary: #2563eb;
  --el-color-primary-light-3: #5b8cf5;
  --el-color-primary-light-5: #8db0f8;
  --el-color-primary-light-7: #bfd4fb;
  --el-color-primary-light-8: #d7e3fd;
  --el-color-primary-light-9: #eff4ff;
  --el-color-primary-dark-2: #1e40af;
  --el-border-radius-base: 9px;
}

[v-cloak] { display: none; }
html, body { width: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 500px at 100% -10%, #e8effb 0%, transparent 60%),
              radial-gradient(900px 420px at -10% 0%, #eef6ee 0%, transparent 55%),
              var(--canvas);
  background-attachment: fixed;
  color: var(--text); font-size: 15px; -webkit-font-smoothing: antialiased;
}

/* ===== 登录 ===== */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 24px; text-align: center; }
.login .logo { font-size: 40px; line-height: 1.4; margin-bottom: 22px; }
.login-card { max-width: 340px; margin: 0 auto; border-radius: 16px; }
.login .el-form-item { margin-bottom: 16px; }
.login-btn { width: 100%; font-weight: 600; letter-spacing: 2px; }
.login .hint { margin-top: 16px; font-size: 13px; color: var(--sub); }

/* ===== 通用按钮 ===== */
.btn { display: inline-block; padding: 12px 18px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--text); font-size: 15px; cursor: pointer; font-family: inherit;
  transition: transform .12s ease, box-shadow .18s ease, background-color .18s, border-color .18s, color .18s;
  box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.btn:hover { border-color: var(--pri); color: var(--pri); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad-pri); color: #fff; border: none; box-shadow: 0 4px 14px rgba(37,99,235,.28); }
.btn.primary:hover { box-shadow: 0 6px 18px rgba(37,99,235,.36); filter: brightness(1.03); color: #fff; }
.btn.primary:active { transform: translateY(1px); }
.btn.ghost { background: var(--pri-l); color: var(--pri); border-color: transparent; }
.btn.ghost:hover { background: #e2ebff; color: var(--pri-d); }
.btn.danger { background: #fff; color: #d64545; border-color: #f0d3d3; }
.btn.danger:hover { border-color: #d64545; color: #d64545; background: #fff5f5; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn[disabled]:active { transform: none; }

/* ===== 应用骨架 ===== */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px;
  background: var(--grad-pri); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .brand .ic { font-size: 20px; }
.topbar .who { font-size: 13px; color: var(--sub); display: flex; align-items: center; gap: 4px; }
.topbar .who a { margin-left: 10px; color: var(--pri); text-decoration: none; font-weight: 600; }
.topbar .who a:hover { text-decoration: underline; }

.main { flex: 1; padding: 18px; padding-bottom: 76px; max-width: 920px; margin: 0 auto; width: 100%; }
.page h3 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.page h3::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--grad-pri); }

/* ===== 首页 ===== */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card { background: var(--card, #fff); border-radius: var(--r); padding: 16px 10px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.6); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card b { display: block; font-size: 22px; color: var(--pri-d); font-weight: 800; }
.card.acc b { background: var(--grad-pri); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card span { font-size: 12px; color: var(--sub); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.quick .q { background: #fff; border-radius: var(--r); padding: 22px 0; text-align: center;
  font-size: 26px; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, box-shadow .15s; border: 1px solid rgba(255,255,255,.6); }
.quick .q:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.quick .q span { display: block; font-size: 14px; color: var(--text); margin-top: 6px; }

/* —— 首页近 7 天营收小图 —— */
.trend { background: #fff; border-radius: var(--r); padding: 16px; margin-top: 16px; box-shadow: var(--shadow); }
.trend h4 { margin: 0 0 12px; font-size: 14px; color: var(--text); }
.trend-bars { display: flex; gap: 8px; align-items: flex-end; height: 120px; }
.tb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.tb .bar { width: 100%; height: 78px; background: var(--bg); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.tb .bar i { display: block; width: 100%; background: linear-gradient(180deg, var(--pri), var(--pri-d)); border-radius: 8px 8px 0 0; min-height: 2px; transition: height .6s ease; }
.tb.today .bar i { background: linear-gradient(180deg, #f59e0b, #d97706); }
.tb em { font-style: normal; font-size: 11px; color: var(--sub); white-space: nowrap; }
.tb span { font-size: 10px; color: var(--sub); }
.tb:first-child span, .tb:last-child span { color: var(--text); }

.pending { background: linear-gradient(180deg, #fff, #fbfcff); border-radius: var(--r); padding: 14px;
  margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.pending .row { display: flex; justify-content: space-between; padding: 6px 0; }
.pending b { color: var(--pri-d); }
.pending .go { color: var(--pri); font-size: 13px; text-decoration: none; font-weight: 600; }

/* ===== 上传 / 报表 ===== */
.upload { background: #fff; border: 2px dashed #d8dee9; border-radius: var(--r); padding: 34px 16px;
  text-align: center; color: var(--sub); margin-bottom: 12px; cursor: pointer; transition: border-color .18s, background .18s; }
.upload:hover { border-color: var(--pri); background: var(--pri-l); }
.upload img.preview { max-width: 100%; max-height: 240px; border-radius: var(--r-sm); }
.upload span { display: block; margin-top: 6px; }
.parsed { margin-top: 18px; }
.parsed h4 { font-size: 14px; color: var(--sub); margin-bottom: 8px; }

/* ===== 表格 ===== */
.tblwrap { overflow-x: auto; background: #fff; border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 420px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f7f9fc; color: var(--sub); font-weight: 600; font-size: 12px; letter-spacing: .3px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: none; }
tr.warn td { background: var(--warn-bg); color: var(--warn); }
table .cell-actions button { margin: 0 4px; }
table .em { font-style: normal; color: var(--sub); }

/* ===== 月份选择栏 ===== */
.monthbar { display: flex; gap: 10px; margin-bottom: 12px; }
.monthbar input { flex: 1; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 15px; background: #fff; }
.monthbar input:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.monthbar .btn { flex: 0 0 auto; }

/* ===== 状态文本 / 提示 ===== */
.ok { color: var(--ok); margin-top: 12px; font-weight: 600; }
.err { color: #d64545; margin-top: 12px; font-size: 14px; }
.hint { color: var(--sub); font-size: 13px; margin-top: 12px; }
.msg { margin-top: 10px; font-size: 14px; }
.msg.ok { color: var(--ok); } .msg.err { color: #d64545; }

/* ===== 底部导航（仅手机显示；桌面默认隐藏） ===== */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); z-index: 30; }
.tabbar { display: none; }   /* 默认隐藏，手机端显示（见下方媒体查询） */
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 7px 0 9px; font-size: 11px; color: var(--sub); text-decoration: none; }
.tabbar a .tab-ic { font-size: 20px; line-height: 1; }
.tabbar a.on { color: var(--acc-d); font-weight: 600; }

/* 「更多」全部功能网格 */
/* ===== 顶部导航（药丸） ===== */
.topnav { position: sticky; top: 0; z-index: 19; background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; gap: 6px; padding: 8px 12px; }
.topnav a { flex: none; padding: 9px 16px; font-size: 14px; color: var(--sub); text-decoration: none; border-radius: 999px; transition: background .15s, color .15s; white-space: nowrap; }
.topnav a:hover { color: var(--pri); background: var(--pri-l); }
.topnav a.on { color: #fff; font-weight: 700; background: var(--grad-pri); box-shadow: 0 4px 10px rgba(37,99,235,.25); }

/* ===== 子导航 ===== */
.subnav { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.subnav button { flex: none; border: 1px solid var(--line); background: #fff; color: var(--sub); border-radius: 999px; padding: 8px 16px; font-size: 13px; cursor: pointer; transition: all .15s; font-family: inherit; }
.subnav button:hover { border-color: var(--pri); color: var(--pri); }
.subnav button.on { background: var(--grad-pri); color: #fff; border-color: transparent; box-shadow: 0 4px 10px rgba(37,99,235,.22); }

/* ===== 表单 ===== */
.form { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.form label { display: block; font-size: 13px; color: var(--sub); margin: 12px 0 4px; }
.form input, .form select, .form textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 15px; background: #fff; transition: border-color .15s, box-shadow .15s; font-family: inherit; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.cardset { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cardsel { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; cursor: pointer; text-align: center; font-size: 13px; transition: all .15s; background: #fff; }
.cardsel.on { border-color: var(--pri); background: var(--pri-l); color: var(--pri-d); font-weight: 600; }

/* ===== 顶部提示横幅 ===== */
.banner { background: var(--warn-bg); color: var(--warn); border: 1px solid #f3ddb0; border-radius: var(--r); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.banner.ok { background: #eaf7ee; color: #1f8a4c; border-color: #bfe6cc; }

/* ===== 底部抽屉 / 弹层 ===== */
.mask { position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 50; display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(2px); }
.sheet { position: relative; width: 100%; max-width: 460px; background: #fff; border-radius: 18px 18px 0 0; padding: 20px 18px 28px; animation: up .2s ease; box-shadow: var(--shadow-lg); }
@keyframes up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { font-size: 17px; margin: 0 0 6px; }
.sheet .x { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 24px; color: var(--sub); cursor: pointer; }
.sheet .amt { font-size: 32px; font-weight: 800; color: #173f2f; margin: 8px 0 16px; }
.sheet .qr { display: block; width: 200px; height: 200px; margin: 6px auto 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }

/* ===== 列表卡片 ===== */
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; box-shadow: var(--shadow); overflow: hidden; }
.list .li { padding: 12px 14px; border-bottom: 1px solid var(--line); transition: background .12s; }
.list .li:last-child { border-bottom: none; }
.list .li:hover { background: #fafbff; }
.list .lh { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; }
.list .ld { font-size: 13px; color: var(--sub); margin-top: 3px; }
.list .lb { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
/* 列表行下方的操作按钮组（收银/改/删…）。模板里一直在用 .acts，但样式表里没有这条，
   于是按钮直接贴在信息行下沿、没有上边距。跟上面的 .lb 同一套间距，保持一致。 */
.list .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
/* 次要信息（单号、备注等）压暗。em 默认斜体，这里连同斜体一起去掉 */
.muted { font-style: normal; color: var(--sub); }

/* ===== 状态徽标 ===== */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip.pending { background: var(--warn-bg); color: var(--warn); margin: 0; box-shadow: none; }
.chip.confirmed { background: #e8f6ee; color: #16a34a; }
.chip.cancelled { background: #fdeeee; color: #d64545; }

/* ===== 盘点网格 ===== */
.stocktake-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stocktake-grid .sg { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow); }
.sg .nm { font-size: 13px; margin-bottom: 6px; font-weight: 600; }
.sg input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 15px; }
.sg input:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ===== AI 管家 ===== */
.butler { display: flex; flex-direction: column; min-height: 46vh; }
.butler .chat { flex: 1; overflow-y: auto; max-height: 52vh; padding: 6px 2px 10px; display: flex; flex-direction: column; gap: 10px; }
.butler .b { display: flex; }
.butler .b.me { justify-content: flex-end; }
.butler .bubble { max-width: 84%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.butler .bubble.who { background: #f2ede3; color: #333; border-top-left-radius: 4px; }
.butler .bubble.me { background: var(--grad-pri); color: #fff; border-top-right-radius: 4px; box-shadow: 0 4px 10px rgba(37,99,235,.22); }
.butler .qrow { display: flex; gap: 8px; margin-top: 10px; }
.butler .qrow input { flex: 1; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 15px; }
.butler .qrow input:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ===== 商品维护：材料配方 ===== */
.recipe-rows { display: flex; flex-direction: column; gap: 8px; }
.rrow { display: flex; gap: 8px; align-items: center; }
.rrow select { flex: 1.4; padding: 9px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 14px; background: #fff; }
.rrow input { flex: 0.9; padding: 9px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 14px; }

/* ===== 设置 / 上传控件 ===== */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.imgrow { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
img.thumb { width: 52px; height: 44px; object-fit: cover; border-radius: 8px; background: #f2f4f7; }
.env-thumb { width: 72px; height: 52px; object-fit: cover; border-radius: 8px; background: #f2f4f7; }
.sheet.wide { max-width: 560px; }

/* ===== 手机端（置于末尾，保证覆盖优先生效） ===== */
@media (max-width: 800px) {
  .topnav { display: none; }
  .tabbar { display: flex; }
  .main { padding-bottom: 88px; }
  .topbar { padding: 10px 14px; }
  .topbar .brand { font-size: 15px; }
  .topbar .who { font-size: 12px; }
}

/* ===== AI 管家：工具确认卡 ===== */
.tc-text { white-space: pre-wrap; }
.tool-card { margin-top: 10px; border: 1px solid var(--pri-l); background: #f7faff;
  border-radius: 12px; padding: 12px; text-align: left; }
.tc-head { font-weight: 700; color: var(--pri-d); font-size: 14px; }
.tc-args { margin: 6px 0 8px; font-size: 13px; color: var(--text); }
.tc-ops { display: flex; gap: 8px; }
.tc-btn { flex: 1; } .tc-btn.ok { background: var(--grad-pri); color: #fff; }
.tc-op-state { color: var(--sub); font-size: 13px; }
.tc-done { color: var(--ok); font-size: 13px; white-space: pre-wrap; }
.tc-cancel { color: var(--sub); font-size: 13px; }

/* =====================================================================
   OpenCode 风格 · AI-first 移动工作台（首页工作台 + 底部 AI 中央 + agent 视图）
   借鉴 local opencode：蓝 accent、灰阶中性、13px 正文、440/530 字重、tracking 收紧
   ===================================================================== */
:root {
  --acc: #3b5cf6; --acc-d: #2f46c8; --acc-l: #eef1ff;
  --ink: #1a1d27; --ink-2: #6b7280; --ink-3: #9ca3af;
  --line2: rgba(70,80,100,.12); --card2: #fff;
  --fh: 13px; --tracking: -0.04px;
}

/* —— 首页 · 工作台 —— */
.page-home { padding-top: 4px; }
.stat-strip { display: grid; grid-template-columns: 3fr 2fr 2fr; gap: 10px; margin-bottom: 14px; background: var(--card2); border: 1px solid var(--line2); border-radius: 12px; padding: 16px 14px; box-shadow: var(--shadow); }
.stat-strip .s { text-align: center; }
.stat-strip .s + .s { border-left: 1px solid var(--line2); }
.stat-strip b { display: block; font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: var(--tracking); }
.stat-strip b.big { font-size: 22px; background: linear-gradient(135deg, var(--acc), var(--acc-d)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-strip span { font-size: 11px; color: var(--ink-2); }
.wkt-title { font-size: 14px; color: var(--ink-2); margin: 20px 0 10px; }
.wgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wcard { background: var(--card2); border: 1px solid var(--line2); border-radius: 10px; padding: 16px 8px 14px; text-align: center; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.wcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--acc); }
.wcard .wic { font-size: 24px; line-height: 1; }
.wcard b { font-size: 13px; color: var(--ink); font-weight: 530; letter-spacing: var(--tracking); }
.wcard small { font-size: 11px; color: var(--ink-3); }

/* —— 底部导航：AI 中央凸起（小药丸，行内不破高度）—— */
.tabbar a.center { position: relative; flex: 1.1; color: var(--acc-d); font-weight: 640; padding: 6px 0 4px; }
.tabbar a.center .tab-ic { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 26px; border-radius: 13px; font-size: 18px; }
.tabbar a.center::before { content:""; position:absolute; top:4px; left:50%; transform:translateX(-50%); width:42px; height:26px; border-radius:13px; background:linear-gradient(135deg,var(--acc),var(--acc-d)); box-shadow:0 6px 14px rgba(59,92,246,.35); z-index:0; }
.tabbar a.center.on::before { box-shadow:0 7px 16px rgba(59,92,246,.5); }
.tabbar a.more { flex: 0 0 auto; }

/* —— Agent 视图（opencode 式）—— */
.page-agent { display: flex; flex-direction: column; height: calc(100vh - 118px); padding: 0 2px; }
.agent-wrap { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.agent-h { font-size: 16px; margin-bottom: 8px; }
.agent-h .em { font-size: 12px; font-weight: 400; }
.conv-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.conv-title { font-size: 13px; color: var(--ink-2); background: var(--card2); border: 1px solid var(--line2); border-radius: 20px; padding: 4px 12px; }
.conv-new { background: var(--acc); color: #fff; border: none; border-radius: 20px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.conv-new:hover { opacity: .9; }
.conv-picker { position: relative; }
.conv-cur { cursor: pointer; font-size: 13px; color: var(--acc-d); padding: 4px 10px; border-radius: 20px; }
.conv-menu { position: absolute; z-index: 20; left: auto; right: 0; top: calc(100% + 6px); min-width: 220px; max-width: min(320px, calc(100vw - 24px)); max-height: 300px; overflow-y: auto; background: var(--card2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 8px 24px rgba(20,25,40,.14); padding: 6px; }
.conv-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.conv-item:hover { background: var(--line2); }
.conv-item.on { background: var(--acc); color: #fff; }
.conv-item .ct { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conv-item .cm { font-size: 11px; opacity: .7; }
.conv-item .c-del { background: none; border: none; color: inherit; font-size: 14px; cursor: pointer; opacity: .6; }
.conv-item .c-del:hover { opacity: 1; }
.conv-empty { padding: 10px; font-size: 13px; color: var(--ink-3); text-align: center; }
.kb-draw { background: var(--card2); border: 1px solid var(--line2); border-radius: 10px; padding: 6px 12px; margin-bottom: 10px; }
.kb-draw summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 4px 0; }
.kb-draw .form { border: none; box-shadow: none; padding: 10px 0 4px; margin-bottom: 0; }
.kb-draw .list { margin-bottom: 8px; }

.amessages { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 2px 8px; display: flex; flex-direction: column; gap: 16px; }
.ahint { color: var(--ink-3); font-size: 13px; padding: 22px 4px; text-align: center; line-height: 1.6; }
.ahint.think { color: var(--acc-d); }
.amsg { width: 100%; }
.amsg.me .meta { text-align: right; }
.amsg .meta { font-size: 11px; color: var(--ink-3); letter-spacing: var(--tracking); margin-bottom: 8px; }
.ablock { width: 100%; }
.atext .md { font-size: var(--chat-fs, 17px); line-height: 1.68; color: var(--ink); white-space: pre-wrap; word-break: break-word; letter-spacing: var(--tracking); }
.atext .caret { color: var(--acc); animation: caretblink .9s step-start infinite; }
@keyframes caretblink { 50% { opacity: 0; } }
/* 照片识别中 · 小旋转指示 */
.mkspin { display: inline-block; width: 13px; height: 13px; margin-right: 7px; vertical-align: -2px; border: 2px solid rgba(230,86,26,.22); border-top-color: #e0561a; border-radius: 50%; animation: mkspin .7s linear infinite; }
@keyframes mkspin { to { transform: rotate(360deg); } }

/* 工具块：查询 chip + 写操作确认卡 */
.atools { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.toolchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); background: #f6f7fb; border: 1px solid var(--line2); border-radius: 999px; padding: 4px 11px; width: fit-content; }
.toolchip .ti { font-size: 12px; }
.toolchip .tstat { font-size: 11px; color: var(--ink-2); }
.toolchip .tstat.done { color: var(--ok); }
.atools .tool-card { margin-top: 4px; }

/* composer 输入卡 */
.composer { background: var(--card2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 4px 16px rgba(20,25,40,.08); padding: 10px 12px; margin-top: 8px; }
.c-input textarea { width: 100%; border: 0; outline: 0; resize: none; font-size: 14px; line-height: 1.6; color: var(--ink); font-family: inherit; background: transparent; min-height: 26px; max-height: 120px; letter-spacing: var(--tracking); }
.c-input textarea::placeholder { color: var(--ink-3); }
.c-bar { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.c-ic { border: 0; background: transparent; font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; }
.c-ic.on { filter: drop-shadow(0 0 4px var(--acc)); }
.c-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.c-chips .chip { border: 1px solid var(--line2); background: var(--acc-l); color: var(--acc-d); border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; font-family: inherit; transition: all .15s; }
.c-chips .chip:hover { border-color: var(--acc); }
.c-send { flex: 0 0 auto; margin-left: auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--acc); color: #fff; font-size: 18px; cursor: pointer; box-shadow: 0 4px 10px rgba(59,92,246,.35); transition: all .15s; }
.c-send:hover { background: var(--acc-d); }
.c-send:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.c-voice { margin-top: 10px; border-top: 1px solid var(--line2); padding-top: 10px; }
.c-voice textarea { width: 100%; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; resize: none; }
.c-voice .btn { margin-top: 8px; }
/* 语音识别框下面那两个按钮（询问 AI / 存为备注）。.btn 是 inline-block，
   不排一行的话两个按钮会紧贴在一起、还跟着文字基线晃 */
.c-voice-btns { display: flex; align-items: center; gap: 8px; }
.c-voice-btns .btn { margin-top: 8px; }

/* —— 拍照/AI 汇总：composer 附照 + 消息图片 —— */
.c-photo { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.c-photo img { width: 52px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line2); }
.c-photo .chip { font-size: 11px; }
.c-photo .x { margin-left: auto; border: 0; background: transparent; color: var(--ink-3); font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 6px; }
.am-photo { display: block; max-width: min(46vw, 200px); border-radius: 10px; border: 1px solid var(--line2); margin: 2px 0 4px; }
.amsg.me .am-photo { margin-left: auto; }

/* 确认卡参数列表（罗列字段，供成员核对） */
.tc-args { display: flex; flex-direction: column; gap: 4px; }
.tc-kv { display: flex; gap: 8px; font-size: 13px; }
.tc-kv .k { color: var(--ink-2); flex: 0 0 78px; }
.tc-kv .v { color: var(--ink); flex: 1; word-break: break-word; }

/* 确认卡可编辑表单（AI 弹卡后可再次填写/修改，提交后只读） */
.tc-args .tc-field { display: flex; align-items: flex-start; gap: 8px; margin-top: 2px; }
.tf-label { flex: 0 0 78px; font-size: 13px; color: var(--ink-2); padding-top: 6px; }
.tf-label .req { color: #e34; margin-right: 2px; }
.tf-ctl { flex: 1; min-width: 0; }
.tf-ctl input[type="text"], .tf-ctl input[type="number"], .tf-ctl input[type="date"], .tf-ctl select, .tf-ctl textarea {
  width: 100%; box-sizing: border-box; font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--pri-l); border-radius: 6px; background: #fff; color: var(--ink);
}
.tf-ctl textarea { resize: vertical; }
.tf-ctl input:disabled, .tf-ctl select:disabled, .tf-ctl textarea:disabled { background: #f2f4f7; color: var(--ink-2); }
.tf-ctl .tf-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); padding-top: 6px; }
.tf-ctl .tf-check input { width: 16px; height: 16px; }
.tf-empty { font-size: 12px; color: var(--ink-2); padding: 4px 0; }

/* —— AI 待审批页 —— */
.page-approve { padding-top: 6px; }
.page-h { font-size: 16px; }
.page-h small { font-size: 12px; font-weight: 400; color: var(--ink-2); }
.appr-photo { display: block; width: 100%; max-width: 260px; border-radius: 10px; border: 1px solid var(--line2); margin-bottom: 8px; }
.appr-photo-sm { display: block; width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line2); margin: 2px 0 4px; }
/* —— 收银机指令队列（管理员审核 第三个 tab）—— */
.cmd-counts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
/* —— 报销列表：单据图缩略图（点开看大图） —— */
.exp-thumb-link { display: inline-block; vertical-align: middle; margin: 2px 0 0 2px; }
.exp-thumb { width: 60px; height: 45px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line2); background: #f5f6f8; cursor: zoom-in; }
.exp-thumb:hover { border-color: var(--pri); }

/* —— 确认卡：单据图（可更换） —— */
.tc-photo { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.tf-photo-img { width: 88px; height: 66px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line2); background: #f5f6f8; }
.tf-photo-btn { flex: 0 0 auto; font-size: 12px; padding: 5px 10px; border: 1px solid var(--pri); color: var(--pri-d);
  background: #fff; border-radius: 6px; cursor: pointer; }
.tf-photo-btn:active { background: var(--pri-l); }

/* —— 报表/文档导出页 —— */
.page-export { padding-top: 6px; }
.exp-family { margin-bottom: 18px; }
.exp-fam-h { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.exp-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.exp-type { display: flex; align-items: center; gap: 6px; padding: 12px 10px; border: 1px solid var(--line2); border-radius: 10px; background: var(--card2); color: var(--ink); font-size: 13px; cursor: pointer; text-align: left; transition: all .15s; font-family: inherit; }
.exp-type:hover { border-color: var(--acc); }
.exp-type.on { border-color: var(--acc); background: var(--acc-l); color: var(--acc-d); font-weight: 600; }
.exp-type .xicon { font-size: 18px; line-height: 1; }
.exp-type.lock { opacity: .5; cursor: not-allowed; }
.exp-type .xlock { margin-left: auto; font-size: 12px; opacity: .7; }
.exp-filter { margin-top: 14px; border-top: 1px solid var(--line2); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.ef-row { display: flex; flex-direction: column; gap: 4px; }
.ef-row label { font-size: 12px; color: var(--ink-2); }
.ef-row input, .ef-row select { width: 100%; border: 1px solid var(--line2); border-radius: 8px; padding: 9px 10px; font-size: 14px; font-family: inherit; }
.exp-go { width: 100%; }
/* 聊天流里的 /export/ 下载链接 */
.exp-link { color: var(--acc); text-decoration: none; font-weight: 600; border-bottom: 1px dashed var(--acc); }
.exp-link:hover { color: var(--acc-d); }

/* 员工账号·行内编辑 */
.ed-card { margin-top: 10px; padding: 12px; background: var(--bg2, #f7f8fa); border: 1px solid var(--line2, #e6e8eb); border-radius: 10px; }
.ed-card > div { margin-bottom: 8px; }
.ed-card label { font-size: 13px; color: var(--muted, #8b93a1); display: block; margin-bottom: 3px; }
.ed-card .ck { display: flex; align-items: center; gap: 6px; color: var(--text, #333); }
.ed-card input[type="text"], .ed-card input[type="password"] { width: 100%; }
.ed-acts { display: flex; gap: 8px; margin-top: 6px; }
.page-staff .ed-card .el-select { width: 100%; }

/* —— 知识库记忆（page-kb）—— */
.kb-search { width: 100%; padding: 9px 12px; border: 1px solid var(--line2, #e6e8eb); border-radius: 10px; margin: 12px 0 10px; font-size: 14px; background: var(--bg); }
.page-kb .ed-card label.chk, .page-kb .ed-card .c-card .chk { display: block; }
.page-kb .ed-card .chk { display: flex; align-items: center; gap: 6px; }
.page-kb .ed-card input[type="text"], .page-kb .ed-card input, .page-kb .ed-card textarea { width: 100%; }

/* —— 语音会议（page-meetings）—— */
.meet-upload-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.pe .meet-upload-row .btn, .meet-upload-row .btn { flex: 1; }
.pm { margin-top: 8px; border-top: 1px solid var(--line2, #e6e8eb); padding-top: 8px; }
.pm-sec { font-weight: 600; font-size: 13px; color: var(--ink-2, #444); margin: 8px 0 4px; }
.pm-pre { white-space: pre-wrap; word-break: break-word; background: var(--bg2, #f7f8fa); border: 1px solid var(--line2, #e6e8eb); border-radius: 8px; padding: 10px; font-size: 13px; max-height: 300px; overflow: auto; }
.pm-md { font-size: 14px; line-height: 1.7; }
.pm-md h4 { margin: 8px 0 4px; font-size: 14px; }
.pm-md strong { font-weight: 700; }
.meet-spn { width: 76px; padding: 5px 6px; border: 1px solid var(--line2, #e6e8eb); border-radius: 8px; font-size: 13px; }

/* 说话人对话 + 每人发言统计 */
.sp-dlg { margin: 4px 0 8px; }
.sp-line { display: flex; align-items: flex-start; gap: 6px; padding: 4px 6px; border-radius: 8px; margin-bottom: 2px; font-size: 13.5px; line-height: 1.55; }
.sp-line:nth-child(even) { background: var(--bg2, #f7f8fa); }
.sp-tag { flex: none; min-width: 46px; text-align: center; color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.sp-text { word-break: break-word; }
.sp-stats { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.sp-stat { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.sp-stat-name { flex: none; width: 48px; color: var(--ink-2, #444); font-weight: 600; }
.sp-stat-dur { flex: none; color: var(--ink-3, #888); }
.sp-bar { flex: 1; height: 10px; background: var(--bg2, #f7f8fa); border: 1px solid var(--line2, #e6e8eb); border-radius: 999px; overflow: hidden; }
.sp-fill { height: 100%; background: #cbd5e1; border-radius: 999px; min-width: 4px; transition: width .3s; }

/* 说话人配色：speaker_id 0..9；负数归到 sp9（灰） */
.sp0 { background: #2563eb; } .sp1 { background: #16a34a; } .sp2 { background: #ea580c; }
.sp3 { background: #9333ea; } .sp4 { background: #0d9488; } .sp5 { background: #dc2626; }
.sp6 { background: #ca8a04; } .sp7 { background: #db2777; } .sp8 { background: #4f46e5; }
.sp9 { background: #6b7280; }
.sp-tag.sp0, .sp-tag.sp1, .sp-tag.sp2, .sp-tag.sp3, .sp-tag.sp4,
.sp-tag.sp5, .sp-tag.sp6, .sp-tag.sp7, .sp-tag.sp8, .sp-tag.sp9 { color: #fff; }

/* —— 长文档记忆—— */
.kb-docs { margin-top: 18px; border-top: 1px solid var(--line2, #e6e8eb); padding-top: 12px; }
.docs-h { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--ink-2, #444); }
.doc-up { display: flex; flex-direction: column; gap: 8px; }
.doc-up input { padding: 9px 12px; border: 1px solid var(--line2, #e6e8eb); border-radius: 10px; font-size: 14px; background: var(--bg); }

/* —— 我的（个人中心） —— */
.page-me { max-width: 560px; }
.me-card { display: flex; align-items: center; gap: 14px; padding: 18px 16px;
  background: var(--bg2, #fff); border: 1px solid var(--line2, #e6e8eb); border-radius: 16px; }
.me-ava { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444); }
.me-info { display: flex; flex-direction: column; }
.me-name { font-size: 17px; color: var(--ink, #222); }
.me-role { font-size: 13px; color: var(--ink-2, #666); margin-top: 2px; }
.me-role em { font-style: normal; color: #ef4444; margin-left: 4px; }
.me-list { margin-top: 16px; background: var(--bg2, #fff); border: 1px solid var(--line2, #e6e8eb); border-radius: 16px; overflow: hidden; }
.me-row { display: flex; align-items: center; gap: 10px; padding: 15px 16px; color: var(--ink, #222);
  text-decoration: none; font-size: 15px; }
.me-row + .me-row { border-top: 1px solid var(--line2, #e6e8eb); }
.me-row:active { background: rgba(0,0,0,.03); }
.me-ic { font-size: 18px; }
.me-arrow { margin-left: auto; color: var(--ink-2, #999); font-size: 18px; }
.me-tip { margin-top: 18px; font-size: 12px; line-height: 1.7; color: var(--ink-2, #888); text-align: center; }
/* 「我的」页：管家字号调档（小/中/大） */
.me-font { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.me-font .fbtn { border: 1px solid var(--line2, #e3e6ea); background: var(--bg2, #fff); color: var(--ink-2, #555);
  min-width: 38px; padding: 6px 0; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; line-height: 1; transition: all .15s; }
.me-font .fbtn.on { border-color: var(--pri, #2563eb); background: var(--pri, #2563eb); color: #fff; }

/* 移动端微调：agent 视口撑满去掉底部 padding 干扰 */
@media (max-width: 800px) {
  .page-agent { height: calc(100vh - 92px); }
  .stat-strip { padding: 13px 10px; }
  .tc-kv { font-size: 12px; }
  .tc-kv .k { flex: 0 0 68px; }
  .tf-label { flex: 0 0 68px; }
}

/* —— 聊天气泡 · 交互式（2026-09-02 管家消息左侧浅气泡 / 老板消息右侧橙气泡，勿改上方旧规则）—— */
.amsg { display: flex; flex-direction: column; }
.amsg.ai { align-items: flex-start; }   /* 管家消息靠左 */
.amsg.me { align-items: flex-end; }     /* 老板消息靠右 */

/* 管家消息：左侧，头一个小厨 + 浅色圆角气泡（尾部在左） */
.amsg.ai .meta { text-align: left; }
.amsg.ai .ablock.atext {
  display: flex; gap: 8px; align-items: flex-start;
  color: var(--ink); max-width: 82%; width: fit-content; margin-right: auto;
}
.amsg.ai .ablock.atext::before {
  content: "🧑‍🍳"; flex: 0 0 auto; font-size: 19px; line-height: 1; margin-top: 2px;
}
.amsg.ai .ablock.atext .md {
  background: #eef2f9; border: 1px solid #e2e8f4; border-radius: 16px; border-top-left-radius: 6px;
  padding: 9px 13px; box-shadow: 0 1px 4px rgba(20,25,40,.06); min-width: 0;
}
.amsg.ai .md strong, .amsg.ai .md em { color: #e0561a; }
.amsg.ai .md strong { font-weight: 700; }

/* 老板消息：右侧，头像戴墨镜 + 暖橙渐变圆角气泡（尾部在右） */
.amsg.me .meta { text-align: right; }
.amsg.me .ablock.atext {
  display: flex; gap: 8px; align-items: flex-start; flex-direction: row-reverse;
  max-width: 82%; width: fit-content; margin-left: auto;
}
.amsg.me .ablock.atext::before {
  content: "🧑‍💼"; flex: 0 0 auto; font-size: 20px; line-height: 1; margin-top: 2px;
}
.amsg.me .ablock.atext .md {
  background: linear-gradient(135deg, #f67b1d, #ff9a3c); color: #fff;
  border-radius: 16px; border-top-right-radius: 6px; padding: 9px 13px;
  box-shadow: 0 2px 10px rgba(246,123,29,.22); min-width: 0;
}
.amsg.me .ablock.atext .md .caret { color: #fff; }

/* —— 会话抽屉（猫导式：左上 ☰ 拉出，含新建会话 + 聊天记录） —— */
.agent-head { display: flex; align-items: center; gap: 10px; }
.agent-menu { flex: 0 0 auto; background: var(--card2); border: 1px solid var(--line2); border-radius: 10px; padding: 4px 10px; font-size: 16px; line-height: 1; cursor: pointer; }
.agent-menu:hover { border-color: var(--acc); }
.drawer-mask { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.35); }
.drawer { position: fixed; left: 0; top: 0; bottom: 0; width: min(80vw, 340px); z-index: 41; background: #fff; box-shadow: 4px 0 24px rgba(0,0,0,.16); display: flex; flex-direction: column; padding: 0 0 6px; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line2); }
.drawer-avatar { font-size: 24px; }
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-x { margin-left: auto; border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.drawer-new { margin: 14px 16px; width: calc(100% - 32px); padding: 10px; border-radius: 22px; font-size: 14px; }
.drawer-section { font-size: 12px; color: var(--ink-3); padding: 2px 18px 6px; }
.drawer-list { flex: 1; overflow-y: auto; padding: 0 8px; }
.drawer-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.drawer-item:hover { background: var(--line2); }
.drawer-item.on { background: var(--acc); color: #fff; }
.drawer-item .ct { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.drawer-item .cm { font-size: 11px; opacity: .7; }
.drawer-item .c-del { background: none; border: none; color: inherit; font-size: 15px; cursor: pointer; opacity: .6; }
.drawer-item .c-del:hover { opacity: 1; }
.drawer-foot { padding: 12px 18px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line2); }
.fade-enter-active, .fade-leave-active { transition: opacity .2s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
.drawer-enter-active, .drawer-leave-active { transition: transform .25s ease, opacity .25s ease; }
.drawer-enter-from, .drawer-leave-to { transform: translateX(-100%); opacity: .5; }

/* —— 聊天流 markdown（.md-chat，white-space:normal + renderMd 输出块级） —— */
.atext .md.md-chat { white-space: normal; }
.md-chat h4 { font-size: 15px; margin: 10px 0 4px; }
.md-chat ul { margin: 0 0 8px; padding-left: 22px; }
.md-chat li { margin: 2px 0; }
.md-chat code { background: var(--line2, #eef0f3); padding: 1px 5px; border-radius: 5px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.md-chat .exp-link, .md-chat a.xlink { color: var(--acc-d); text-decoration: underline; cursor: pointer; }
.md-chat pre { background: #f6f7fb; border: 1px solid var(--line2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 0 0 8px; }
.md-chat pre code { background: transparent; padding: 0; font-size: 12px; }
.md-chat table { border-collapse: collapse; margin: 0 0 8px; width: 100%; font-size: 13px; }
.md-chat th, .md-chat td { border: 1px solid var(--line2); padding: 6px 9px; text-align: left; white-space: normal; }
.md-chat th { background: #f6f7fb; }
.md-chat blockquote { margin: 0 0 8px; padding: 4px 12px; border-left: 3px solid var(--line2); color: var(--ink-2); }
.md-chat del { color: var(--ink-3); }
.md-chat input[type=checkbox] { margin-right: 6px; }
.md-chat p { margin: 0 0 8px; }
.md-chat > :last-child { margin-bottom: 0; }

/* —— 确认卡日期：快捷今天/昨天/明天 + 自研日历弹层（跨浏览器可靠） —— */
.tf-date { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.tf-date-quick { display: flex; gap: 8px; }
.tf-date-quick button {
  flex: 1; padding: 7px 0; font-size: 14px; color: #444; background: #fff;
  border: 1px solid var(--line2, #e5e8ef); border-radius: 8px; cursor: pointer;
}
.tf-date-quick button.on { color: #fff; background: #e0561a; border-color: #e0561a; font-weight: 600; }
.tf-date-field {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--line2, #e5e8ef); border-radius: 8px;
  background: #fff; font-size: 15px; color: #222; cursor: pointer;
}
.tf-date-field .ph { color: var(--ink-3, #aaa); }
.tf-date-field i { font-style: normal; color: var(--ink-3, #aaa); }
.tf-date-field.off { background: #f5f6f9; color: #999; cursor: not-allowed; }

.tfcal-mask { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center; }
.tfcal { width: min(420px, 92vw); background: #fff; border-radius: 18px 18px 0 0;
  padding: 14px 16px 22px; }
.tfcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tfcal-title { font-size: 17px; font-weight: 700; color: #222; }
.tfcal-btn { font-size: 15px; color: #888; background: none; border: none; padding: 6px 10px; cursor: pointer; }
.tfcal-ok { color: #e0561a; font-weight: 600; }
.tfcal-quick { display: flex; gap: 8px; margin-bottom: 10px; }
.tfcal-quick button { flex: 1; padding: 8px 0; font-size: 14px; color: #444;
  border: 1px solid var(--line2, #e5e8ef); border-radius: 8px; background: #fff; cursor: pointer; }
.tfcal-quick button:active { background: #f0f2f7; }
.tfcal-nav { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 8px; }
.tfcal-now { font-size: 12px; color: #999; }
.tfcal-week { display: grid; grid-template-columns: repeat(7,1fr); text-align: center;
  font-size: 12px; color: #999; padding: 4px 0 6px; }
.tfcal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.tfcal-d { height: 40px; border: none; background: none; font-size: 15px; color: #333;
  cursor: pointer; border-radius: 8px; }
.tfcal-d.blank { visibility: hidden; }
.tfcal-d.sel { background: #e0561a; color: #fff; font-weight: 700; }
.tfcal-d:not(.blank):active { background: #f0f2f7; }
.tfcal-enter-active, .tfcal-leave-active { transition: opacity .2s ease, transform .2s ease; }
.tfcal-enter-from, .tfcal-leave-to { opacity: 0; transform: translateY(24px); }

/* P0/P1：错误边界降级提示（该区域渲染/生命周期异常时显示，页面其他部分存活） */
.eb-fail { margin: 10px 12px; padding: 12px 14px; border: 1px solid #ffd8a8; border-left: 4px solid #e0561a;
  background: #fff7ed; border-radius: 10px; color: #9a4b12; font-size: 13px; line-height: 1.5; }

/* =====================================================================
   Agent 视图：锁定一屏，composer 吸底
   ---------------------------------------------------------------------
   旧方案用魔法数 `height: calc(100vh - 118/92px)`，在微信/手机地址栏伸缩时
   100vh 偏大，且没扣掉 .main 自己的上下内边距 → 正文略微超出一屏 → 整页可滚动
   → 输入框跟着页面跑（"聊天框不固定"）。
   改为：给应用根容器（agent 视图生效时）锁 100dvh + 隐藏整页滚动，让
   .page-agent 填满剩余可用高，只有 .amessages 内部滚动；.composer 靠 flex:none
   钉在底部。dvh 实时跟踪地址栏，避免偏移。
   ===================================================================== */
.app-agent { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.app-agent .main { flex: 1; min-height: 0; }
/* 覆盖上面移动/桌面两条 calc()：page-agent 填满 .main 内容区，不再超一屏 */
.app-agent .page-agent { height: 100%; }
/* 长消息不把兄弟挤压成一条缝，直接让容器溢出出滚动条 */
.amsg { flex: none; }
/* 桌面端无底栏，收紧 .main 底部留白，避免 composer 距屏幕底过高 */
@media (min-width: 801px) { .app-agent .main { padding-bottom: 12px; } }

/* =====================================================================
   聊天消息防横向溢出（"左右摇摆"）
   ---------------------------------------------------------------------
   AI 回复经 renderMd 渲染成 markdown，里面命中两条全局泄漏导致消息区可横向滚动：
     1) 全局 `table { min-width:420px }` —— 聊天里一张宽表把气泡撑破；
     2) markdown 里的 `<img>` 没有任何 max-width —— 一张宽图整个溢出去。
   溢出冒到 `.amessages`（overflow-x 由 auto 计算），于是消息区能左右滑动。
   以下把消息内表格/图片/代码块都约束在气泡内，并给 `.amessages` 加 x 剪切做兜底。
   ===================================================================== */
.ablock.atext { min-width: 0; }
.ablock.atext .md.md-chat { min-width: 0; max-width: 100%; }
.ablock.atext .md.md-chat table {
  min-width: 0; max-width: 100%; display: block; overflow-x: auto; }
.ablock.atext .md.md-chat img { max-width: 100%; height: auto; display: block; }
.ablock.atext .md.md-chat pre { max-width: 100%; }
.amessages { overflow-x: hidden; }

/* —— 图片上传中的即时预览态 —— */
.c-photo img.uploading { opacity: .55; }
.chip.uploading { background: #eef2ff; color: #5b6cf5;
  display: inline-flex; align-items: center; gap: 5px; }
.chip.uploading::before { content: ""; width: 10px; height: 10px;
  border: 2px solid #c9d3ff; border-top-color: #5b6cf5; border-radius: 50%;
  animation: chipspin .7s linear infinite; }
@keyframes chipspin { to { transform: rotate(360deg); } }

/* —— 对客单：金额用 flex 排布，避免 float 在窄屏重叠 —— */
.list .ld.lrow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.list .ld.lrow .xt { min-width: 0; overflow-wrap: anywhere; }
.list .ld .amt { color: var(--pri-d); font-weight: 700; white-space: nowrap; float: none; }

/* —— 页面自说明备注：让人一眼知道这页干嘛的 —— */
.page-lead { font-size: 12.5px; line-height: 1.65; color: var(--sub);
  background: #f5f8ff; border: 1px solid var(--line2); border-left: 3px solid var(--acc);
  border-radius: 8px; padding: 9px 12px; margin: 0 0 14px; }
.page-lead b { color: var(--ink); }
.sec-note { font-size: 12px; font-weight: 400; color: var(--sub); margin-left: 8px; }
.sec-gap { margin-top: 22px; }

/* —— 列表空态：居中、留白，别再挤在卡片角落 —— */
.list .empty { padding: 30px 16px; text-align: center; color: var(--sub); font-size: 13px; }
/* 有的 subnav 用 <a>（如对客单页），跟 <button> 同款胶囊，避免裸文本 */
.subnav a { flex: none; border: 1px solid var(--line); background: #fff; color: var(--sub);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; text-decoration: none; cursor: pointer; transition: all .15s; white-space: nowrap; }
.subnav a:hover { border-color: var(--pri); color: var(--pri); }
.subnav a.on { background: var(--grad-pri); color: #fff; border-color: transparent; box-shadow: 0 4px 10px rgba(37,99,235,.22); }

/* —— 员工聊天记录（老板专属，我的页入口）—— */
.page-chats .head-row { justify-content: flex-start; gap: 10px; }
.page-chats .back { color: var(--pri); font-weight: 600; cursor: pointer; font-size: 14px;
  text-decoration: none; white-space: nowrap; }
.page-chats .back:hover { text-decoration: underline; }
.page-chats .head-row h3 { margin: 0; }
.page-chats .chat-log { gap: 10px; padding-bottom: 12px; }
.page-chats .chat-log .bubble .who { display: block; font-size: 11px; color: var(--sub);
  margin-bottom: 3px; font-weight: 600; }

/* ===== 拍整月账本 ===== */
.page-ledger .lvd-warn { background: #f0f5ff; color: #2563eb; padding: 10px 12px; border-radius: 8px;
  margin-bottom: 12px; font-size: 13px; line-height: 1.6; }
.page-ledger .ledger-month { margin: 10px 0 12px; }
.page-ledger .ledger-month label { font-size: 13px; color: #6b7280; margin-right: 8px; }
.page-ledger .ledger-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.page-ledger .ledger-top .ledger-month-in { border: 1px solid #d1d5db; border-radius: 6px; padding: 5px 8px; font-size: 13px; }
.page-ledger .ledger-meta { font-size: 13px; color: #6b7280; }
.page-ledger .lvd-bad { color: #dc2626; }
.page-ledger .lvd-low { color: #d97706; }
.page-ledger .ledger-review { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.ledger-photo { width: 176px; max-height: 460px; object-fit: contain; border: 1px solid #e5e7eb;
  border-radius: 8px; flex-shrink: 0; background: #fafafa; }
.ledger-scroll { overflow: auto; max-height: 70vh; flex: 1; }
.ledger-table { border-collapse: collapse; min-width: max-content; font-size: 13px; }
.ledger-table th, .ledger-table td { border: 1px solid #e5e7eb; padding: 2px 4px; white-space: nowrap; text-align: center; }
.ledger-table th { background: #f3f4f6; position: sticky; top: 0; z-index: 1; font-weight: 600; }
.ledger-table th.nb, .ledger-table td.nb { color: #9ca3af; background: #fafafa; }
.ledger-table tr.total td { background: #fff7ed; font-weight: 600; }
.ledger-table tr.nr td { color: #9ca3af; }
.cell-in { width: 74px; text-align: right; padding: 2px 5px; border: 1px solid #d1d5db;
  border-radius: 4px; font-size: 13px; box-sizing: border-box; }
.cell-in.cell-low { background: #fef3c7; border-color: #f59e0b; }
.cell-in.cell-bad { background: #fee2e2; border-color: #dc2626; }
.ledger-table tr.total .cell-in { background: #ffedd5; }
.cellflag { color: #dc2626; font-weight: 700; margin-left: 2px; }
.col-tag { font-size: 10px; color: #9ca3af; margin-left: 4px; }
.ledger-done { text-align: center; padding: 40px 20px; }
.ledger-done h4 { font-size: 18px; margin-bottom: 10px; color: #16a34a; }

/* =====================================================================
   连锁总览 / 门店 / AI 巡店（view-chain.js + view-patrol.js）
   ---------------------------------------------------------------------
   颜色沿用全局 token；严重度只做「状态色 + 文字」，不靠颜色单独表意。
   图表全部手写 SVG（不引图表库），网格/轴使用 non-scaling-stroke。
   ===================================================================== */
.page-chain, .page-stores, .page-patrol {
  --danger: #dc2626; --danger-bg: #fef2f2; --danger-line: #fecaca;
  --ok-bg: #ecfdf5; --ok-line: #a7f3d0;
  --sev-warn: #d97706;
}

/* —— 通用小件 —— */
.chip2 { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 2px 9px; font-size: 12px; line-height: 18px; white-space: nowrap;
  background: #f1f5f9; color: var(--sub); border: 1px solid transparent; }
.chip2.ok { background: var(--ok-bg); color: #047857; border-color: var(--ok-line); }
.chip2.warn { background: #fff7ed; color: #b45309; border-color: #fed7aa; }
.chip2.danger, .chip2.critical { background: var(--danger-bg); color: #b91c1c; border-color: var(--danger-line); }
.chip2.info { background: var(--pri-l); color: var(--pri-d); border-color: #dbe4ff; }
.chip2.off { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.chip2.open { background: #fff7ed; color: #b45309; }
.chip2.processing, .chip2.in_progress { background: var(--pri-l); color: var(--pri-d); }
.chip2.submitted { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.chip2.closed, .chip2.resolved, .chip2.done, .chip2.confirmed { background: var(--ok-bg); color: #047857; }
.chip2.pending { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.chip2.rejected, .chip2.false_positive { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }

.up { color: #047857; } .down, .danger { color: var(--danger); }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.fchip { flex: none; border: 1px solid var(--line); background: #fff; color: var(--sub);
  border-radius: 999px; padding: 6px 13px; font-size: 13px; cursor: pointer; font-family: inherit; }
.fchip.on { background: var(--grad-pri); color: #fff; border-color: transparent; }
.fchip em { font-style: normal; font-size: 11px; opacity: .8; margin-left: 3px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 14px; }
.filter-row select, .filter-row input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 13px; font-family: inherit; min-width: 0; }
.filter-row select:focus, .filter-row input:focus { outline: none; border-color: var(--pri); }
.filter-row input { flex: 1 1 160px; }

/* 骨架屏：只在真的没有旧数据时出现，避免刷一下闪一片 */
.sk { height: 92px; border-radius: var(--r); background: linear-gradient(90deg,#eef1f6 25%,#f7f9fc 37%,#eef1f6 63%);
  background-size: 400% 100%; animation: skwave 1.3s ease infinite; }
.sk-list { display: grid; gap: 10px; }
@keyframes skwave { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.sheet-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.form .ck, .ck-line { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); margin-top: 12px; }
.form .ck input, .ck-line input { width: auto; }
.evt-mini { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line);
  font-size: 13px; cursor: pointer; }
.evt-mini:last-child { border-bottom: 0; }
.evt-mini em { margin-left: auto; font-style: normal; font-size: 12px; }

/* —— 连锁总览 —— */
.chain-hero { position: relative; overflow: hidden; border-radius: 18px; padding: 20px;
  background: linear-gradient(135deg, #101b3a 0%, #17346b 55%, #1d4ed8 100%);
  color: #fff; display: flex; justify-content: space-between; align-items: flex-end; gap: 14px;
  box-shadow: 0 12px 30px rgba(23,52,107,.25); margin-bottom: 14px; }
.chain-hero::after { content: ""; position: absolute; right: -60px; top: -90px; width: 260px; height: 260px;
  border-radius: 50%; background: radial-gradient(circle, rgba(125,211,252,.35), transparent 65%); }
.ch-kicker { font-size: 12px; letter-spacing: .14em; color: #9cc3ff; margin-bottom: 6px; }
.ch-title { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.ch-title::before { display: none; }
.ch-sub { font-size: 12.5px; color: #c7d7f7; }
.ch-hero-side { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.ch-hero-side > div { text-align: right; }
.ch-hero-side b { display: block; font-size: 24px; line-height: 1.1; }
.ch-hero-side b.warn { color: #fcd34d; }
.ch-hero-side span { font-size: 11px; color: #b8c9ea; }
.chain-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chain-toolbar .subnav { margin-bottom: 10px; }
.chain-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.ck { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px;
  box-shadow: var(--shadow); border-top: 3px solid var(--pri); }
.ck.warn { border-top-color: #f59e0b; }
.ck.danger { border-top-color: var(--danger); }
.ck span { display: block; font-size: 12px; color: var(--sub); }
.ck b { display: block; font-size: 24px; line-height: 1.25; margin: 4px 0 2px; letter-spacing: -.02em; }
.ck small { font-size: 11.5px; color: var(--sub); }
.ck small a { color: var(--pri); text-decoration: none; }
.chain-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 14px; }
.cc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.cc-head h4 { font-size: 14.5px; margin: 0; }
.cc-head .muted { font-size: 12px; }
.chain-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chain-svg .grid { stroke: var(--line); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.chain-svg .axis { font-size: 9px; fill: var(--sub); }
.chain-svg .xlab { font-size: 9px; fill: var(--sub); text-anchor: middle; }
.chain-svg .area { fill: rgba(37,99,235,.10); }
.chain-svg .line { fill: none; stroke: var(--pri); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chain-svg .prev { fill: none; stroke: #b6c0d4; stroke-width: 1.6; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }
.chain-svg .dot { fill: #fff; stroke: var(--pri); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chain-svg .hit { fill: transparent; cursor: pointer; }
.trend-pick { font-size: 12.5px; color: var(--text); margin-top: 4px; min-height: 18px; }
.tblwrap { margin-top: 12px; }
.chain-2col { display: grid; gap: 14px; }
.rank-list { display: grid; gap: 11px; }
.rank-row { display: flex; align-items: center; gap: 10px; }
.rk { flex: none; width: 22px; height: 22px; border-radius: 7px; background: #f1f5f9; color: var(--sub);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.rk.top { background: var(--grad-pri); color: #fff; }
.rk-main { flex: 1; min-width: 0; }
.rk-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.rk-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-bar { height: 6px; border-radius: 4px; background: #eef2f8; overflow: hidden; }
.rk-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg,#60a5fa,#2563eb); }
.rk-score { flex: none; font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; }
.mix-list { display: grid; gap: 9px; }
.mix-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; font-size: 13px; }
.mix-row b { font-variant-numeric: tabular-nums; }
.mix-row i { grid-column: 1 / -1; display: block; height: 5px; border-radius: 4px;
  background: linear-gradient(90deg,#93c5fd,#3b82f6); opacity: .7; }
.funnel { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.funnel-pill { font-size: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.store-grid { display: grid; gap: 10px; }
.store-card { border: 1px solid var(--line); border-radius: var(--r); padding: 13px; background: #fff;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.store-card:hover { border-color: #bfd4fb; box-shadow: var(--shadow); transform: translateY(-1px); }
.sc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sc-top b { font-size: 14px; }
.store-card > .muted { font-size: 12px; margin-top: 3px; }
.sc-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 11px 0 9px; }
.sc-kpis div { background: #f8fafc; border-radius: 8px; padding: 6px 7px; }
.sc-kpis span { display: block; font-size: 10.5px; color: var(--sub); }
.sc-kpis b { font-size: 14px; font-variant-numeric: tabular-nums; }
.sc-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.sc-foot .go { margin-left: auto; color: var(--pri); }
.chain-foot { text-align: center; }

/* —— 门店档案 —— */
.store-filters { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px;
  box-shadow: var(--shadow); margin-bottom: 12px; }
.store-table td { vertical-align: top; }
/* 桌面用表格、手机用卡片：两者都在 DOM 里，只靠这里切换可见性 */
.store-cards { display: none; gap: 10px; }
.store-sheet { max-height: 88vh; overflow-y: auto; }
.ss-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-right: 26px; }
.ss-head h3 { margin-bottom: 4px; }
.ss-head .muted { font-size: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin: 12px 0; }
.kpi-grid div { background: #f8fafc; border-radius: 9px; padding: 9px 10px; }
.kpi-grid span { display: block; font-size: 11px; color: var(--sub); }
.kpi-grid b { font-size: 17px; }
.ss-trend .chain-svg { max-height: 170px; }
.ss-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.ss-cols h4, .store-sheet h4 { font-size: 13px; margin: 10px 0 6px; }
.cam-mini, .emp-mini { display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  padding: 5px 0; border-bottom: 1px dashed var(--line); }
.cam-mini em, .emp-mini em { margin-left: auto; font-style: normal; font-size: 11px; }
.emp-mini b { font-size: 12px; color: var(--pri-d); }
.dot-on { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex: none; }
.dot-on.off { background: #cbd5e1; }
.store-form { box-shadow: none; padding: 0; border: 0; margin: 0; }
.store-form .frow { margin-top: 4px; }
.store-save { width: 100%; margin-top: 16px; }

/* —— AI 巡店：外框 —— */
.patrol-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.patrol-head h3 { margin-bottom: 4px; }
.patrol-head .muted { font-size: 12px; line-height: 1.55; max-width: 560px; }
.live-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  color: #b91c1c; background: var(--danger-bg); border: 1px solid var(--danger-line);
  border-radius: 999px; padding: 1px 8px; letter-spacing: .06em; vertical-align: 2px; }
.live-tag i { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; animation: livepulse 1.4s infinite; }
@keyframes livepulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.patrol-sync { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 11.5px; color: var(--sub); white-space: nowrap; }
.patrol-tabs { display: flex; gap: 6px; overflow-x: auto; background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; box-shadow: var(--shadow); margin-bottom: 12px; }
.ptab { flex: 1 0 auto; border: 0; background: none; color: var(--sub); font-size: 13px; font-family: inherit;
  padding: 8px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; justify-content: center; }
.ptab em { font-style: normal; font-size: 10.5px; background: #f59e0b; color: #fff; border-radius: 999px; padding: 0 6px; line-height: 16px; }
.ptab em.danger { background: var(--danger); }
.ptab.on { background: var(--grad-pri); color: #fff; box-shadow: 0 3px 10px rgba(37,99,235,.25); }
.ptab.on em { background: #fff; color: var(--pri-d); }
.patrol-err { background: var(--danger-bg); color: #b91c1c; border: 1px solid var(--danger-line);
  border-radius: 8px; padding: 8px 11px; font-size: 13px; margin-bottom: 10px; }
.patrol-kpis { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-bottom: 12px; }
.pk { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--pri);
  border-radius: 10px; padding: 9px 12px; box-shadow: var(--shadow); }
.pk.warn { border-left-color: #f59e0b; } .pk.danger { border-left-color: var(--danger); }
.pk span { display: block; font-size: 11px; color: var(--sub); }
.pk b { font-size: 21px; line-height: 1.25; }
.pk small { font-size: 11px; font-weight: 400; color: var(--danger); margin-left: 4px; }
.patrol-pane { min-height: 120px; }
.patrol-foot { text-align: center; font-size: 11.5px; color: var(--sub); margin-top: 20px;
  padding-top: 10px; border-top: 1px dashed var(--line); }

/* —— 实时告警 —— */
.evt-toolbar { background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 12px 3px; box-shadow: var(--shadow); }
.evt-list { display: grid; gap: 10px; }
.evt-card { display: flex; gap: 0; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); border-left: 4px solid var(--sub);
  animation: evtin .35s ease both; }
@keyframes evtin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.evt-card.sev-critical { border-left-color: #dc2626; }
.evt-card.sev-warn { border-left-color: #f59e0b; }
.evt-card.sev-info { border-left-color: #3b82f6; }
.evt-thumb { position: relative; flex: none; width: 118px; background: #0f172a; cursor: pointer; }
.evt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 96px; }
.evt-sev { position: absolute; left: 5px; top: 5px; font-size: 10px; color: #fff;
  background: rgba(15,23,42,.72); border-radius: 4px; padding: 1px 5px; }
.evt-conf { position: absolute; right: 5px; bottom: 5px; font-size: 10px; color: #d1fae5;
  background: rgba(15,23,42,.72); border-radius: 4px; padding: 1px 5px; font-variant-numeric: tabular-nums; }
.evt-body { flex: 1; min-width: 0; padding: 9px 11px; display: flex; flex-direction: column; gap: 3px; }
.evt-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.evt-title b { font-size: 13.5px; }
.evt-status { flex: none; font-size: 10.5px; border-radius: 999px; padding: 1px 7px; background: #f1f5f9; color: var(--sub); }
.evt-status.pending { background: #fffbeb; color: #b45309; }
.evt-status.confirmed { background: var(--pri-l); color: var(--pri-d); }
.evt-status.resolved { background: var(--ok-bg); color: #047857; }
.evt-status.false_positive { background: #f8fafc; color: #64748b; }
.evt-status.done { background: var(--ok-bg); color: #047857; }
.evt-status.in_progress { background: var(--pri-l); color: var(--pri-d); }
.evt-meta { font-size: 11.5px; color: var(--sub); }
.evt-sum { font-size: 12px; color: #4b5563; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.evt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: auto; padding-top: 5px; }
.evt-actions .muted { font-size: 11px; }
.evt-empty { text-align: center; padding: 34px 16px; background: #fff; border: 1px dashed var(--line); border-radius: var(--r); color: var(--sub); }
.analyze-card { margin-top: 16px; background: #fff; border: 1px dashed #bfd4fb; border-radius: var(--r); padding: 13px 14px; }
.analyze-card h4 { font-size: 13.5px; margin-bottom: 4px; }
.analyze-card .hint { margin-top: 2px; }
.file-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; font-size: 13px;
  background: #fff; color: var(--pri); cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.analyze-result { margin-top: 10px; font-size: 12.5px; line-height: 1.6; background: #f8fafc; border-radius: 8px; padding: 9px 11px; }

/* —— 监控墙 —— */
.cam-wall { display: grid; grid-template-columns: repeat(2,1fr); gap: 9px; }
.cam-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .15s; }
.cam-card:hover { border-color: #bfd4fb; transform: translateY(-1px); }
.cam-card.offline { opacity: .72; filter: grayscale(.7); }
.cam-frame { position: relative; aspect-ratio: 16 / 9; background: #0b1220; overflow: hidden; }
.cam-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-nofeed { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #475569; font-size: 12px; }
.cam-live { position: absolute; left: 6px; top: 6px; display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .05em; color: #fff; background: rgba(220,38,38,.85);
  border-radius: 4px; padding: 1px 5px; }
.cam-live i { width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.cam-live.off { background: rgba(71,85,105,.85); }
.cam-evt { position: absolute; right: 6px; bottom: 6px; font-size: 9.5px; color: #fef3c7;
  background: rgba(15,23,42,.72); border-radius: 4px; padding: 1px 5px; }
.cam-info { padding: 8px 9px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cam-info b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-info .muted, .cam-last { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-last { color: #b45309; }
.cam-sheet { max-height: 90vh; overflow-y: auto; }

/* —— 整改闭环 —— */
.rect-board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; align-items: flex-start; }
.rect-col { flex: 0 0 244px; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; }
.rect-col-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; padding: 2px 4px 8px; }
.rect-col-head span { background: #e2e8f0; color: #475569; border-radius: 999px; padding: 0 7px; font-size: 11px; }
.rect-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px;
  margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.rect-card:hover { border-color: #bfd4fb; }
.rect-card.overdue { border-color: var(--danger-line); background: #fffafa; }
.rect-top { display: flex; align-items: flex-start; gap: 6px; }
.rect-top b { font-size: 12.5px; line-height: 1.4; }
.rect-card p { font-size: 11px; line-height: 1.5; margin-top: 3px; }
.rect-due .danger { margin-left: 5px; font-weight: 600; }
.rect-empty { text-align: center; font-size: 11.5px; color: var(--sub); padding: 12px 0; }
.sev-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; background: #3b82f6; }
.sev-dot.critical { background: #dc2626; } .sev-dot.warn { background: #f59e0b; } .sev-dot.info { background: #3b82f6; }
.rect-sheet { max-height: 90vh; overflow-y: auto; }
.rect-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.rect-photos img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); display: block; }
.rp-label { font-size: 11.5px; color: var(--sub); display: block; margin-bottom: 4px; }
.rp-empty { aspect-ratio: 16/9; border: 1px dashed var(--line); border-radius: 9px; display: flex;
  align-items: center; justify-content: center; color: var(--sub); font-size: 12px; background: #f8fafc; }
.rect-review-note { background: #f8fafc; border-left: 3px solid var(--pri); padding: 7px 10px;
  border-radius: 6px; font-size: 12.5px; margin: 8px 0; }

/* —— 巡检任务 —— */
.insp-layout { display: grid; gap: 14px; }
.insp-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  flex-wrap: wrap; margin: 10px 0; padding: 9px 11px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-sm); }
.insp-toolbar .muted { font-size: 11.5px; }
.insp-list { display: grid; gap: 9px; align-content: start; }
.insp-card { display: flex; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 12px; box-shadow: var(--shadow); cursor: pointer; }
.insp-card.overdue { border-left: 3px solid var(--danger); }
.insp-main { flex: 1; min-width: 0; }
.insp-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.insp-title b { font-size: 13.5px; }
.insp-main .muted { font-size: 11.5px; margin-top: 3px; }
.insp-main .hint { font-size: 11.5px; margin-top: 4px; }
.insp-side { flex: none; text-align: right; display: flex; flex-direction: column; gap: 2px; min-width: 60px; }
.insp-side b { font-size: 20px; color: var(--pri-d); }
.insp-side span { font-size: 10.5px; color: var(--sub); }
.tpl-list h4 { font-size: 14px; margin-bottom: 8px; }
.tpl-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px;
  margin-bottom: 9px; box-shadow: var(--shadow); }
.tpl-head { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; }
.tpl-head b { font-size: 13px; }
.tpl-head .muted { font-size: 11px; margin-top: 2px; }
.tpl-card .hint { font-size: 11.5px; margin-top: 6px; }
.tpl-card .btn { margin-top: 9px; }
.tpl-items { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }
.tpl-item { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; padding: 3px 0; }
.tpl-item em { font-style: normal; color: var(--sub); flex: none; }
.tpl-item .redline { color: #b91c1c; background: var(--danger-bg); border-radius: 4px;
  padding: 0 4px; margin-left: 5px; font-size: 10px; }
.tpl-list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 8px; }
.tpl-list-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-list-actions .btn, .tpl-card-actions .btn { margin-top: 0; }
.tpl-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tpl-card-actions .btn { flex: 1 1 120px; }
.tpl-sheet { max-height: 90vh; overflow-y: auto; }
.tpl-edit-head { display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-top: 16px; }
.tpl-edit-head label { margin: 0; }
.tpl-edit-head .btn { margin-top: 0; }
.tpl-edit-item { border: 1px solid var(--line); border-radius: 10px; padding: 0 11px 11px;
  margin-top: 10px; background: #f8fafc; }
.tpl-edit-item-head { display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0 2px; font-size: 12px; }
.tpl-del { border: 0; background: none; color: var(--danger); font-size: 12px;
  cursor: pointer; padding: 4px; }
.form-err { color: var(--danger); font-size: 12.5px; margin-top: 10px; }
.insp-sheet { max-height: 90vh; overflow-y: auto; }
.insp-run { display: grid; gap: 8px; margin: 10px 0; }
.insp-run-item { border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: #fff; }
.iri-main b { font-size: 13px; }
.iri-main .muted { font-size: 11.5px; line-height: 1.5; margin-top: 2px; }
.red-line { display: inline-block; font-size: 10px; color: #b91c1c; background: var(--danger-bg);
  border: 1px solid var(--danger-line); border-radius: 4px; padding: 0 4px; margin-left: 5px; vertical-align: 1px; }
.iri-score { font-size: 11px; color: var(--sub); margin-top: 3px; }
.iri-btns { display: flex; gap: 6px; margin-top: 7px; }
.iri-btns button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 6px 4px; font-size: 12px; color: var(--sub); font-family: inherit; cursor: pointer; }
.iri-btns button.on { border-color: transparent; color: #fff; background: var(--grad-pri); }
.iri-btns button:nth-child(2).on { background: linear-gradient(135deg,#f87171,#dc2626); }
.iri-btns button:nth-child(3).on { background: #64748b; }
.iri-note { width: 100%; margin-top: 6px; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 12.5px; font-family: inherit; }
.insp-sheet > label { display: block; font-size: 12.5px; color: var(--sub); margin: 10px 0 4px; }
.insp-sheet > input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; font-family: inherit; }

/* —— 执行榜 —— */
.exec-podium { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 14px; }
.exec-pod { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 8px;
  text-align: center; box-shadow: var(--shadow); min-width: 0; }
.exec-pod.p1 { border-color: #fcd34d; background: linear-gradient(180deg,#fffbeb,#fff); }
.exec-pod.p2 { border-color: #cbd5e1; } .exec-pod.p3 { border-color: #fdba74; }
.pod-medal { font-size: 22px; display: block; }
.exec-pod b { display: block; font-size: 13px; margin-top: 2px; }
.exec-pod .muted { display: block; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-pod strong { display: block; font-size: 19px; color: var(--pri-d); margin-top: 3px; }
.exec-list { display: grid; gap: 7px; }
.exec-row { display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.exec-rank { flex: none; width: 22px; height: 22px; border-radius: 7px; background: #f1f5f9; color: var(--sub);
  font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.exec-rank.top { background: var(--grad-pri); color: #fff; }
.exec-main { flex: 1; min-width: 0; }
.exec-name { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.exec-name b { font-size: 13px; }
.exec-name .muted { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-bar { height: 5px; border-radius: 4px; background: #eef2f8; overflow: hidden; margin: 5px 0; }
.exec-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg,#60a5fa,#2563eb); }
.exec-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 10.5px; color: var(--sub); }
.exec-spark { flex: none; width: 76px; height: 24px; }
.exec-spark path { fill: none; stroke: #7c3aed; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.exec-score { flex: none; font-size: 16px; color: var(--pri-d); min-width: 38px; text-align: right; }
.exec-formula { font-size: 11.5px; color: var(--sub); background: #f8fafc; border-radius: 8px; padding: 8px 10px; margin-top: 12px; }

/* —— 事件详情 —— */
.evt-sheet, .cam-sheet, .rect-sheet, .insp-sheet, .store-sheet { max-width: 760px; }
.evt-sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-right: 26px; }
.evt-sheet-head h3 { margin-bottom: 3px; }
.evt-sheet-head .muted { font-size: 11.5px; }
.evt-photo { position: relative; margin: 11px 0; border-radius: 10px; overflow: hidden; background: #0b1220; }
.evt-photo img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
.bbox { position: absolute; border: 2px solid #22d3ee; border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.2); }
.bbox em { position: absolute; left: -2px; top: -20px; font-style: normal; font-size: 10px; color: #082f49;
  background: #22d3ee; border-radius: 3px 3px 0 0; padding: 1px 5px; white-space: nowrap; }
.photo-note { position: absolute; right: 7px; bottom: 6px; font-size: 10px; color: #e2e8f0;
  background: rgba(15,23,42,.68); border-radius: 4px; padding: 1px 6px; }
.evt-ai { font-size: 12.5px; line-height: 1.6; background: #f0f7ff; border-left: 3px solid var(--pri);
  border-radius: 0 7px 7px 0; padding: 8px 11px; margin: 8px 0; }
.evt-facts { display: flex; flex-wrap: wrap; gap: 5px 14px; font-size: 12px; color: var(--sub); margin: 8px 0; }
.evt-facts b { color: var(--text); font-weight: 600; }
.evt-hint { font-size: 12.5px; line-height: 1.6; color: #4b5563; }
.evt-timeline { margin: 12px 0; border-left: 2px solid #e2e8f0; padding-left: 13px; display: grid; gap: 9px; }
.tl-row { position: relative; font-size: 12px; line-height: 1.5; display: flex; flex-wrap: wrap; gap: 0 8px; }
.tl-dot { position: absolute; left: -18px; top: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--pri); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--pri); }
.tl-row b { font-size: 12.5px; }
.tl-row em { flex-basis: 100%; font-style: normal; color: #4b5563; }
.rect-brief { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: #f8fafc;
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 12.5px; margin: 10px 0; }
.rect-brief .btn { margin-left: auto; }
.evt-form-title { font-size: 14px; margin-top: 14px; }
.cam-preview img { aspect-ratio: 16/9; }
.cam-dots { display: flex; gap: 6px; margin: -4px 0 8px; }
.cam-dots button { border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 4px 10px; font-size: 11.5px; color: var(--sub); cursor: pointer; font-family: inherit; }
.cam-dots button.on { background: var(--pri-l); border-color: #bfd4fb; color: var(--pri-d); }

/* —— 手机/窄屏 —— */
@media (max-width: 800px) {
  .store-table { display: none; }
  .store-cards { display: grid; }
  /* 5 个 tab 在 390px 下横排会截掉最后两个；换行比横向滑动更容易发现 */
  .patrol-tabs { flex-wrap: wrap; overflow: visible; border-radius: 16px; }
  .ptab { flex: 1 1 calc(33.333% - 6px); }
  .chips-row { flex-wrap: wrap; overflow: visible; }
}

/* —— 桌面端 —— */
@media (min-width: 801px) {
  .chain-kpis { grid-template-columns: repeat(4, 1fr); }
  .chain-2col { grid-template-columns: 1.15fr .85fr; }
  .store-grid { grid-template-columns: repeat(2, 1fr); }
  .store-cards { grid-template-columns: repeat(2, 1fr); }
  .patrol-kpis { grid-template-columns: repeat(4, 1fr); }
  .cam-wall { grid-template-columns: repeat(3, 1fr); }
  .rect-board { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); overflow: visible; }
  .rect-col { min-width: 0; }
  .insp-layout { grid-template-columns: 1.25fr .75fr; align-items: start; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .evt-thumb { width: 168px; }
  .sheet.wide, .evt-sheet, .cam-sheet, .rect-sheet, .insp-sheet, .store-sheet { max-width: 760px; }
}
@media (max-width: 420px) {
  .chain-hero { flex-direction: column; align-items: flex-start; }
  .ch-hero-side { width: 100%; justify-content: space-between; }
  .chain-hero::after { opacity: .5; }
  .evt-thumb { width: 96px; }
  .evt-sum { -webkit-line-clamp: 2; }
  .exec-spark { display: none; }
  .ss-cols { grid-template-columns: 1fr; }
  .patrol-head { flex-direction: column; }
  .patrol-sync { flex-direction: row; align-items: center; }
}
