:root {
  /* ---- 与「云南分公司经营分析看板」统一品牌配色 ---- */
  --bg: #fffdf5;
  --panel: #ffffff;
  --panel-2: #fffdf8;
  --border: #e8e3d0;
  --border-strong: #d8d1b8;
  --text: #1e293b;
  --text-2: #475569;
  --text-3: #7c8696;
  --brand: #1b6fb0;
  --brand-dark: #0e4c7c;
  --brand-light: #4a9ff0;
  --brand-soft: #e9f2fa;
  --yellow: #fde000;
  --yellow-soft: #fff7cc;
  --green: #16a34a;
  --green-soft: #e8f7ee;
  --amber: #f59e0b;
  --amber-soft: #fef4e6;
  --red: #dc2626;
  --red-soft: #fdecec;
  --purple: #7c3aed;
  --pink: #db2777;
  --teal: #0d9488;
  --slate: #94a3b8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 8px 24px -12px rgba(20, 30, 50, .14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image: radial-gradient(circle at 100% 0%, rgba(253,224,0,.10) 0%, rgba(253,224,0,0) 40%),
                    radial-gradient(circle at 0% 100%, rgba(27,111,176,.06) 0%, rgba(27,111,176,0) 40%);
  background-attachment: fixed;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

/* ---------- 布局 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,253,245,.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1360px; margin: 0 auto; padding: 0 24px;
  height: 62px; display: flex; align-items: center; gap: 24px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: .2px; white-space: nowrap; color: var(--brand-dark); }
.logo-img {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: #fff; object-fit: cover; display: block;
  box-shadow: 0 0 0 2px rgba(253,224,0,.55), 0 2px 8px -2px rgba(20,30,50,.18);
}
.logo small { display: block; font-weight: 600; font-size: 11px; color: var(--text-3); letter-spacing: 0; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 9px;
  cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13.5px;
  display: flex; align-items: center; gap: 7px; transition: .15s;
}
.nav button:hover { background: #f2f0e6; color: var(--text); }
.nav button.active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px -6px rgba(27,111,176,.8); }
.nav .badge {
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center; line-height: 1;
}
.nav button.active .badge { background: rgba(255,255,255,.28); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.asof { font-size: 12px; color: var(--text-3); white-space: nowrap; }

main { max-width: 1360px; margin: 0 auto; padding: 24px 24px 80px; }
.page { display: none; }
.page.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-body { padding: 18px; }

.btn {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  padding: 7px 14px; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0e4c7c; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: #f2f0e6; color: var(--text); }
.btn.danger { border-color: #f3c6c6; color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #f2f0e6; color: var(--text-2); white-space: nowrap;
}
.chip.green { background: var(--green-soft); color: #15803d; }
.chip.amber { background: var(--amber-soft); color: #b45309; }
.chip.red { background: var(--red-soft); color: #b91c1c; }
.chip.blue { background: var(--brand-soft); color: #0e4c7c; }
.chip.gray { background: #f1efe6; color: #64748b; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.kpi.g::after { background: var(--green); } .kpi.a::after { background: var(--amber); }
.kpi.r::after { background: var(--red); } .kpi.p::after { background: var(--purple); }
.kpi .k-label { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.kpi .k-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; line-height: 1.15; }
.kpi .k-value small { font-size: 14px; font-weight: 700; color: var(--text-3); margin-left: 2px; }
.kpi .k-foot { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ---------- 进度条 ---------- */
.bar { height: 8px; border-radius: 999px; background: #ece7d6; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .5s cubic-bezier(.4,0,.2,1); }
.bar.thin { height: 6px; }

.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), #ece7d6 0); }
.ring > div { width: 66px; height: 66px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; }

/* ---------- 门店卡片 ---------- */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.store-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; cursor: pointer; transition: .18s; position: relative; }
.store-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -14px rgba(16,32,55,.28); border-color: var(--border-strong); }
.store-card .s-top { display: flex; align-items: flex-start; gap: 12px; }
.store-card h4 { margin: 0; font-size: 15.5px; font-weight: 700; }
.store-card .s-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.7; }
.store-card .s-metrics { display: flex; gap: 16px; margin: 13px 0 11px; }
.store-card .m { font-size: 12px; color: var(--text-3); }
.store-card .m b { display: block; font-size: 17px; font-weight: 800; color: var(--text); line-height: 1.3; }
.store-card .s-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.store-card .del { position: absolute; top: 10px; right: 10px; opacity: 0; transition: .15s; }
.store-card:hover .del { opacity: 1; }

.risk-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.risk-high { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.risk-medium { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.risk-low { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
table.tbl th {
  position: sticky; top: 0; z-index: 2; background: #fbf5e2; text-align: left;
  font-size: 12px; font-weight: 700; color: var(--text-2); padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid #efe9d9; vertical-align: top; font-size: 13px; }
table.tbl tbody tr:hover { background: #fdfbf2; }
table.tbl tbody tr.lvl-danger { background: #fff8f8; }
table.tbl tbody tr.lvl-danger:hover { background: #fff2f2; }
table.tbl tbody tr.lvl-warn { background: #fffdf6; }

.sec-row { scroll-margin-top: 74px; }
.sec-row td {
  background: #f2f6fd !important; font-weight: 700; color: var(--text);
  font-size: 13px; padding: 9px 12px; border-bottom: 1px solid var(--border);
}
.sec-row .sec-name { display: flex; align-items: center; gap: 9px; }
.sec-row .sec-name .bar { width: 120px; display: inline-block; vertical-align: middle; }

.item-title { font-weight: 700; }
/* 清单表格内的异常标签做紧凑处理，避免在窄列里一个标签占一行 */
.tbl .chip { font-size: 11px; padding: 1px 7px; border-radius: 6px; }
.tbl .anom-chips { gap: 4px !important; }
.item-std { color: var(--text-2); font-size: 12.5px; white-space: pre-line; margin-top: 4px; line-height: 1.65; }
.item-std.clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.status-cell { min-width: 128px; }
.status-cell select {
  width: 100%; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: #fff; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.status-cell select[data-s="done"] { color: #15803d; border-color: #b7e4c7; background: var(--green-soft); }
.status-cell select[data-s="doing"] { color: #b45309; border-color: #f5d9a8; background: var(--amber-soft); }
.status-cell select[data-s="na"] { color: #64748b; background: #f1efe6; }
.date-input { border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 7px; font-size: 12.5px; width: 100%; background: #fff; }
.note-input { border: 1px solid transparent; border-radius: 8px; padding: 4px 7px; font-size: 12.5px; width: 100%; background: transparent; color: var(--text-2); }
.note-input:hover { background: #f4f7fc; }
.note-input:focus { background: #fff; border-color: var(--brand); outline: none; }

.plan-tag { font-size: 11.5px; color: var(--text-3); }
.plan-tag b { color: var(--text-2); }

/* ---------- 异常 ---------- */
.anom-list { display: flex; flex-direction: column; gap: 10px; }
.anom {
  display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; align-items: flex-start;
}
.anom.danger { border-left: 3px solid var(--red); background: #fffafa; }
.anom.warn { border-left: 3px solid var(--amber); background: #fffdf7; }
.anom.info { border-left: 3px solid var(--slate); background: #fffdf8; }
.anom .a-body { flex: 1; min-width: 0; }
.anom .a-title { font-weight: 700; font-size: 13.5px; }
.anom .a-title .lv { font-size: 11px; padding: 1px 7px; border-radius: 999px; margin-right: 7px; vertical-align: 1px; }
.anom.danger .lv { background: var(--red-soft); color: #b91c1c; }
.anom.warn .lv { background: var(--amber-soft); color: #b45309; }
.anom.info .lv { background: #f2f0e6; color: #64748b; }
.anom .a-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: #fff; font-size: 13.5px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(27,111,176,.12); }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.field textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: #fff; font-size: 13.5px; resize: vertical; line-height: 1.6;
}
.field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(27,111,176,.12); }
.field label .req { color: #dc2626; font-style: normal; margin-left: 3px; }

/* ---------- 门店信息交接表 ---------- */
.hd-gate {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  padding: 9px 13px; border-radius: 10px; margin-bottom: 12px;
  background: var(--red-soft, #fef2f2); border: 1px solid #fecaca;
  font-size: 12.5px; color: #b91c1c;
}
.hd-gate b { font-size: 13px; }
.hd-gate span { color: #991b1b; }
.hd-gate .miss { flex-basis: 100%; font-size: 11.5px; color: #b45309; }
.hd-gate.ok { background: var(--green-soft, #ecfdf5); border-color: #b7e4c7; color: #15803d; }
.hd-gate.ok span { color: #15803d; }
.hd-rule {
  font-size: 11.5px; color: var(--text-3); background: #f8fafc;
  border: 1px dashed var(--border-strong); border-radius: 9px;
  padding: 7px 12px; margin-bottom: 14px;
}
.hd-group { margin-bottom: 16px; }
.hd-group-t {
  font-size: 12px; font-weight: 800; color: var(--text-3);
  margin-bottom: 8px; padding-left: 9px; border-left: 3px solid var(--yellow);
}
.opt-row { display: flex; gap: 8px; align-items: flex-start; }
.opt-row.wrap { flex-wrap: wrap; }
/* 注意：选择器需比 .field label / .field input 更具体，否则会被 display:block、width:100% 撑变形 */
.field label.opt,
.opt {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: #fff; font-size: 13px; font-weight: 500; line-height: 1.3;
  color: var(--text-2); user-select: none; flex: 0 0 auto;
  white-space: nowrap; margin-bottom: 0;
}
.opt span { white-space: nowrap; }
.field .opt input,
.field label.opt input,
.opt input {
  width: auto; height: auto; padding: 0; margin: 0;
  border: 0; border-radius: 0; background: transparent;
  flex: 0 0 auto; cursor: pointer; accent-color: var(--brand);
}
.field label.opt:hover,
.opt:hover { border-color: var(--brand); }
.field label.opt.on,
.opt.on { border-color: var(--brand); background: var(--brand-soft, #eff6ff); color: #0e4c7c; font-weight: 700; }
.field label.opt.on span,
.opt.on span { color: #0e4c7c; }

@media (max-width: 640px) {
  .opt-row { flex-wrap: wrap; }
  .opt { padding: 6px 10px; font-size: 12.5px; }
}

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,25,40,.45); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 620px;
  max-height: 88vh; overflow: auto; box-shadow: 0 30px 70px -20px rgba(10,20,40,.5);
}
.modal-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); }

/* ---------- 空态 ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .icon { font-size: 40px; margin-bottom: 10px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }

/* ---------- 详情页头部 ---------- */
.detail-head { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head .dh-main { flex: 1; min-width: 260px; }
.detail-head h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.3px; }
.detail-head .dh-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.detail-head .dh-meta b { color: var(--text); }
.detail-head .dh-meta span { display: flex; align-items: center; gap: 5px; }
.detail-head > .hint { flex-basis: 100%; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.search {
  padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 9px;
  min-width: 200px; background: #fff; font-size: 13.5px;
}
.search:focus { outline: none; border-color: var(--brand); }

.tabs-inline { display: flex; gap: 4px; background: #f2f0e6; padding: 3px; border-radius: 10px; }
.tabs-inline button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2);
}
.tabs-inline button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(16,32,55,.14); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
/* 单列时也必须用 minmax(0,1fr)：纯 1fr 的最小值是 min-content，
   会被内部「阶段跳转条 / 卡片头」的固有宽度撑破，导致整页横向溢出 */
@media (max-width: 1080px) { .split { grid-template-columns: minmax(0, 1fr); } }
.split > * { min-width: 0; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; opacity: 0; transition: .25s; z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table td { padding: 7px 4px; border-bottom: 1px solid #efe9d9; }
.mini-table td:last-child { text-align: right; font-weight: 700; }

.scroll-y { max-height: 460px; overflow-y: auto; }

/* ---------- 仅移动端显示 / 阶段快捷跳转 ---------- */
.mobile-only { display: none !important; }
.jump-bar { display: none; }
.item-std.expanded { display: block !important; -webkit-line-clamp: unset !important; }

.seq-badge {
  display: inline-block; min-width: 20px; height: 20px; line-height: 20px;
  text-align: center; padding: 0 6px; margin-right: 6px; border-radius: 6px;
  background: #f2f0e6; color: var(--text-2); font-size: 11.5px; font-weight: 700;
  vertical-align: 1px;
}
.std-toggle {
  display: inline-block; margin-top: 4px; font-size: 12px; color: var(--brand);
  font-weight: 600; cursor: pointer; user-select: none;
}
.std-toggle:hover { text-decoration: underline; }
/* 宽屏下清单已有独立的「序号」列，卡片内的序号徽章不再重复 */
@media (min-width: 821px) {
  table.tbl.stack tbody tr[data-item] > td.cell-main .seq-badge { display: none; }
}

/* =========================================================================
 *  移动端适配：宽表格 → 卡片
 * ========================================================================= */
@media (max-width: 820px) {
  html { -webkit-text-size-adjust: 100%; }

  /* --- 顶栏：单行 = 标识 + 可横滑导航（用 grid 保证一定不换行、不溢出） --- */
  .topbar-inner {
    display: grid; grid-template-columns: auto minmax(0, 1fr);
    align-items: center; gap: 8px;
    height: auto; min-height: 50px; padding: 6px 12px;
  }
  .logo { grid-column: 1; font-size: 14px; gap: 7px; }
  .logo > span { display: none; }
  .logo-img { width: 30px; height: 30px; }
  .nav {
    grid-column: 2; margin: 0; min-width: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { padding: 7px 10px; font-size: 12.5px; flex: none; gap: 5px; }
  .nav .badge { min-width: 16px; height: 16px; font-size: 10px; }
  .topbar-right { display: none; }

  main { padding: 14px 12px 70px; }

  /* 移动端不再用内层滚动容器：让整页自然滚动，避免「双滚动条」 */
  .table-wrap { max-height: none !important; overflow: visible !important; }

  /* --- KPI 两列 --- */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 12px 12px 14px; }
  .kpi .k-value { font-size: 21px; }
  .kpi .k-label { font-size: 11.5px; }
  .kpi .k-foot { font-size: 11px; }

  /* --- 门店卡片单列 --- */
  .store-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .store-card { padding: 14px; }
  .store-card .del { opacity: 1; }

  /* --- 卡片头 --- */
  .card-head { padding: 13px 14px; }
  .card-body { padding: 14px; }
  .split { gap: 14px; }

  /* 允许收缩，避免长文案 / 横滑条把卡片撑破 */
  .card, .kpi, .store-card { min-width: 0; }
  .card-head > *, .card-body > * { min-width: 0; }
  .card-head { flex-wrap: wrap; }
  .jump-bar { min-width: 0; }

  /* --- 详情页头部纵向堆叠 --- */
  .detail-head {
    display: grid !important; grid-template-columns: auto minmax(0, 1fr);
    gap: 12px 14px; padding: 15px !important; align-items: start;
  }
  .detail-head .ring { grid-column: 1; grid-row: 1; width: 64px; height: 64px; }
  .detail-head .ring > div { width: 50px; height: 50px; font-size: 13.5px; }
  .detail-head h2 { font-size: 17px; margin-bottom: 4px; }
  .detail-head .dh-main { grid-column: 2; grid-row: 1; min-width: 0; }
  .detail-head > .dh-metrics {
    grid-column: 1 / -1; display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px !important;
  }
  .detail-head > .hint { grid-column: 1 / -1; }
  .detail-head .dh-meta { gap: 4px 14px; font-size: 12px; flex-direction: column; align-items: flex-start; }
  .store-card .s-metrics { gap: 10px; }

  /* --- 工具栏：返回键独占一行，操作按钮等分 --- */
  .toolbar { gap: 7px; }
  .toolbar .grow { flex: 1 1 100%; height: 0; }
  .toolbar .btn { padding: 9px 11px; font-size: 12.5px; flex: 1 1 0; justify-content: center; }
  .toolbar .btn.ghost { flex: 1 1 100%; justify-content: flex-start; }

  /* --- 筛选区：移动端改成两列网格，避免宽度忽长忽短 --- */
  .filters {
    display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px !important;
  }
  .filters > :first-child { grid-column: 1 / -1; }
  .filters .search { width: 100% !important; min-width: 0 !important; }
  .filters > label.chip { justify-content: center; }

  /* ================= 宽表格 → 卡片 ================= */
  table.tbl.stack { display: block; }
  table.tbl.stack thead { display: none; }
  table.tbl.stack tbody { display: block; }
  table.tbl.stack tbody tr {
    display: block; width: 100%;
    border: 1px solid var(--border); border-radius: 12px;
    background: #fff; padding: 12px 13px; margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(16, 32, 55, .05);
  }
  table.tbl.stack tbody tr:hover { background: #fff; }
  table.tbl.stack tbody tr.lvl-danger { border-color: #f3c9c9; background: #fffafa; }
  table.tbl.stack tbody tr.lvl-warn { border-color: #f5dfb4; background: #fffdf7; }
  table.tbl.stack tbody tr[data-open] { cursor: pointer; }
  table.tbl.stack tbody tr[data-open]:active { transform: scale(.985); }

  /* 阶段分隔行 */
  table.tbl.stack tbody tr.sec-row {
    border: 0; background: transparent !important; box-shadow: none;
    padding: 14px 2px 8px; margin: 0;
  }
  table.tbl.stack tbody tr.sec-row td {
    display: block !important; width: 100% !important; padding: 0 !important;
    background: transparent !important; border: 0 !important;
  }
  .sec-row .sec-name { flex-wrap: wrap; gap: 8px; font-size: 13.5px; }
  .sec-row .sec-name .bar { max-width: none; flex: 1 1 100%; }

  /* 每个单元格 → 一行「标签 : 值」，或整块内容 */
  table.tbl.stack tbody tr > td {
    display: flex; align-items: flex-start; gap: 10px;
    width: 100% !important; padding: 7px 0 !important;
    border-bottom: 1px dashed #eef1f7; font-size: 13px;
  }
  table.tbl.stack tbody tr > td:last-child { border-bottom: 0; padding-bottom: 0 !important; }
  table.tbl.stack tbody tr > td[data-label]::before {
    content: attr(data-label);
    flex: none; width: 62px; padding-top: 1px;
    font-size: 12px; font-weight: 700; color: var(--text-3);
  }
  table.tbl.stack tbody tr > td[data-label] > * { min-width: 0; }

  table.tbl.stack tbody tr > td.cell-seq,
  table.tbl.stack tbody tr > td.cell-cat,
  table.tbl.stack tbody tr > td.cell-dot { display: none !important; }

  table.tbl.stack tbody tr > td.cell-main {
    display: block; padding: 0 0 9px !important;
    border-bottom: 1px solid #eef1f7; margin-bottom: 3px;
  }
  .mobile-only { display: inline-flex !important; }
  .tbl .chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; }
  .tbl .anom-chips { gap: 5px !important; }
  table.tbl.stack tbody tr > td.cell-main .item-title { display: inline; font-size: 14.5px; }
  .item-std { margin-top: 6px; font-size: 12.5px; }
  .item-std.clamped { -webkit-line-clamp: 3; }
  .std-toggle { font-size: 12.5px; padding: 3px 0; }

  /* 表单控件：加大点击区，避免 iOS 缩放 */
  table.tbl.stack .status-cell { min-width: 0; }
  table.tbl.stack .status-cell select { font-size: 14px; padding: 8px 10px; min-height: 38px; }
  table.tbl.stack .date-input { font-size: 14px; padding: 7px 9px; min-height: 38px; }
  table.tbl.stack .note-input {
    font-size: 14px; padding: 7px 9px; min-height: 38px;
    background: #fbf5e2; border: 1px solid var(--border); width: 100%;
  }
  table.tbl.stack .note-input:focus { background: #fff; }
  .status-cell { min-width: 0; }
  .search { min-width: 0; flex: 1 1 calc(50% - 5px); font-size: 14px; padding: 9px 11px; }
  .tabs-inline { width: 100%; }
  .tabs-inline button { flex: 1; text-align: center; }
  #fAnom.chip, label.chip { padding: 8px 12px; font-size: 13px; }

  /* 字典表（mini-table）也在窄屏改卡片 */
  .mini-table thead { display: none; }
  .mini-table, .mini-table tbody, .mini-table tr, .mini-table td { display: block; width: 100%; }
  .mini-table tr { border-bottom: 1px solid #eef1f7; padding: 9px 0; }
  .mini-table td { border: 0; padding: 2px 0 !important; text-align: left !important; }
  .mini-table td[data-label]::before {
    content: attr(data-label) '：'; color: var(--text-3); font-weight: 700;
  }

  /* --- 阶段快捷跳转条 --- */
  .jump-bar {
    display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding: 2px 0 10px;
  }
  .jump-bar::-webkit-scrollbar { display: none; }
  .jump-bar a {
    flex: none; text-decoration: none; font-size: 12.5px; font-weight: 700;
    padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
    background: #fff; color: var(--text-2); white-space: nowrap;
  }
  .jump-bar a .n { color: var(--text-3); font-weight: 600; margin-left: 4px; }
  .jump-bar a:active { background: var(--brand-soft); border-color: var(--brand); }

  /* --- 弹层：底部抽屉式 --- */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px 20px; position: sticky; bottom: 0; background: #fff; }
  .modal-foot .btn { flex: 1; justify-content: center; padding: 11px; }
  .form-grid { grid-template-columns: 1fr; }
  .field input, .field select { font-size: 16px; padding: 10px 12px; }

  /* --- 异常卡片 --- */
  .anom { padding: 11px 12px; gap: 9px; }
  .anom .a-title { font-size: 13px; }
  .anom .a-title .lv { display: inline-block; margin-bottom: 3px; }
  .anom .a-meta { font-size: 11.5px; }
  .scroll-y { max-height: none; }
  .toast { bottom: 16px; width: max-content; max-width: 90vw; }
}

@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
  table.tbl.stack tbody tr > td[data-label]::before { width: 54px; }
}

@media print {
  .topbar, .toolbar, .btn, .del, .jump-bar { display: none !important; }
  .page { display: block !important; }
  body { background: #fff; }
}

/* =========================================================================
 *  身份 / 权限 / 登录
 * ========================================================================= */
.user-chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 4px 6px 4px 5px; cursor: pointer; font-weight: 700; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 7px; max-width: 150px;
}
.user-chip:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.user-chip .av {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
}
.user-chip .av.admin { background: #b45309; }
.user-chip .un { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mode-chip { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #f2f0e6; color: var(--text-2); white-space: nowrap; }
.mode-chip.online { background: var(--green-soft); color: #15803d; }
.mode-chip.local { background: #fef4e6; color: #b45309; }

/* 登录遮罩 */
.gate { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #14538a, #0a3a63); }
.gate.show { display: flex; }
.gate-box { background: #fff; border-radius: 18px; width: 100%; max-width: 480px; padding: 26px 26px 22px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.5); max-height: 92vh; overflow: auto;
  position: relative; border-top: 4px solid var(--yellow); }
.gate-box::before {
  content: ''; display: block; width: 62px; height: 62px; margin: 2px auto 14px;
  border-radius: 50%; background: #fff url('../img/logo.png') center/cover no-repeat;
  box-shadow: 0 0 0 3px rgba(253,224,0,.5), 0 8px 20px -8px rgba(20,30,50,.4);
}
.gate-box h2 { margin: 0 0 4px; font-size: 19px; }
.gate-box .g-sub { color: var(--text-3); font-size: 13px; margin-bottom: 18px; line-height: 1.6; }
.identity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.identity-grid button {
  border: 1px solid var(--border-strong); background: #fff; border-radius: 12px; padding: 14px 8px;
  cursor: pointer; font-weight: 700; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: .15s;
}
.identity-grid button:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); transform: translateY(-2px); }
.identity-grid .av { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 16px; }
.identity-grid .av.admin { background: #fff4e6; color: #b45309; }
.identity-grid .tag { font-size: 10.5px; font-weight: 700; color: var(--text-3); }
.identity-grid .tag.admin { color: #b45309; }

/* =========================================================================
 *  全局门店筛选栏
 * ========================================================================= */
.gf-bar {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.gf-bar .gf { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gf-bar .gf label { font-size: 11.5px; font-weight: 700; color: var(--text-3); white-space: nowrap; }
.gf-bar select, .gf-bar input {
  padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff; font-size: 13px; min-width: 142px;
}
.gf-bar select:focus, .gf-bar input:focus { outline: none; border-color: var(--brand); }
.gf-bar .gf-clear { margin-left: auto; align-self: center; }
.gf-bar .gf-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; padding-bottom: 7px; }
.gf-summary { font-size: 12.5px; color: var(--text-3); margin: -8px 0 14px; }
.gf-summary b { color: var(--text); }

/* 手机端筛选栏折叠：桌面端不显示折叠条、筛选栏始终展开；
   手机端显示「筛选条件」折叠条，默认收起，点开才展开（见 app.js gfExpanded） */
.gf-fold {
  display: none;                 /* 桌面端隐藏，筛选栏直接展示 */
  width: 100%; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; margin-bottom: 14px; cursor: pointer;
  box-shadow: var(--shadow); font: inherit; text-align: left; color: var(--text);
}
.gf-fold .gf-ftitle { font-size: 14px; font-weight: 800; }
.gf-fold .gf-fbrief { flex: 1; min-width: 0; margin-left: 10px; font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-fold .gf-farrow { color: var(--text-2); font-size: 12px; transition: transform .18s ease; }
.gf-wrap.open .gf-farrow { transform: rotate(180deg); }

/* =========================================================================
 *  日志 / 管理后台表格
 * ========================================================================= */
.log-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.log-table th, .log-table td { padding: 8px 10px; border-bottom: 1px solid #efe9d9; text-align: left; vertical-align: top; }
.log-table th { font-size: 12px; color: var(--text-2); background: #fbf5e2; position: sticky; top: 0; }
.log-table tr:hover td { background: #fdfbf2; }
.log-table .lt { color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-table .act { font-weight: 700; white-space: nowrap; }
.log-table .from-to { color: var(--text-3); }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 11px 10px; border-bottom: 1px solid #efe9d9; text-align: left; vertical-align: middle; }
.admin-table th { font-size: 12px; color: var(--text-2); background: #fbf5e2; }
.admin-table tr:hover td { background: #fdfbf2; }
.role-tag { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #f2f0e6; color: var(--text-2); }
.role-tag.admin { background: #fff4e6; color: #b45309; }
.role-tag.member { background: #f2f0e6; color: #475569; }
.del-scope { font-size: 12px; color: var(--text-2); }
.del-scope.none { color: var(--text-3); }

/* 已归档门店视觉弱化 */
.store-card.archived { opacity: .72; border-style: dashed; }
.store-card .archived-tag { position: absolute; top: 10px; right: 10px; }

.section-note { font-size: 12.5px; color: var(--text-3); margin: 0 0 12px; line-height: 1.6; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { min-width: 160px; }
.role-pick { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.role-pick label { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

@media (max-width: 820px) {
  .user-chip { max-width: 116px; padding: 3px 4px 3px 4px; }
  .user-chip .un { max-width: 64px; }
  .mode-chip { display: none; }
  .gate-box { padding: 20px 18px 16px; }
  .gf-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .gf-bar .gf { width: 100%; }
  .gf-bar select, .gf-bar input { width: 100%; min-width: 0; font-size: 15px; padding: 10px 11px; }
  .gf-bar .gf-clear { margin-left: 0; }
  /* 手机端：显示折叠条，筛选栏默认收起，展开态才显示 */
  .gf-fold { display: flex; }
  .gf-wrap .gf-body { display: none; }
  .gf-wrap.open .gf-body { display: flex; }
  .log-table .lt { font-size: 11.5px; }
  .admin-table td .btn { padding: 6px 9px; font-size: 12px; }
}

/* ===== 省份维度 ===== */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.prov-card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-radius: 12px; padding: 15px 16px; background: #fff;
  transition: all .18s ease;
}
.prov-card:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(27,111,176,.10); transform: translateY(-2px); }
.prov-card.on { border-color: var(--brand); background: var(--brand-soft, #eff6ff); }
.prov-card .pv-name { font-size: 14px; font-weight: 800; color: var(--text-1); }
.prov-card .pv-rate { font-size: 26px; font-weight: 900; line-height: 1.25; color: var(--brand); margin: 2px 0 6px; }
.prov-card .pv-meta { font-size: 12px; color: var(--text-3); margin-top: 7px; }

/* ===== 省管理 · 建店前清单编辑 ===== */
.tpl-list { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.tpl-item { border: 1px solid var(--border); border-radius: 11px; padding: 13px 14px; background: #fff; }
.tpl-item.changed { border-color: var(--amber, #f59e0b); background: #fffbeb; }
.tpl-item .ti-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.tpl-item .field { margin-bottom: 8px; }
.tpl-item textarea { resize: vertical; }

/* ===== 角色标签 ===== */
.role-tag.prov { background: var(--yellow-soft); color: #8a6d00; }

/* ===== 登录 ===== */
.login-err {
  margin-top: 12px; padding: 9px 12px; border-radius: 9px;
  background: #fef2f2; color: #b91c1c; font-size: 13px; border: 1px solid #fecaca;
}
.g-steps { margin: 10px 0 6px; padding-left: 20px; line-height: 1.95; font-size: 13px; color: var(--text-2); }
.g-steps li { margin: 3px 0; }
.gate-box code { background: #f2f0e6; color: #1e3a5f; padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.g-warn { margin-top: 12px; background: var(--amber-soft); border: 1px solid #ffb74d; color: #8a4b00; padding: 9px 11px; border-radius: 8px; font-size: 12px; word-break: break-all; }
.g-foot { margin: 14px 0 0; font-size: 12px; color: var(--text-3); text-align: center; }

/* ===== 我的账号 ===== */
.me-box { display: grid; gap: 10px; }
.me-box > div { display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border-radius: 9px; background: #f8fafc; font-size: 13.5px; }
.me-box span { color: var(--text-3); }
.me-box b { color: var(--text-1); }

@media (max-width: 640px) {
  .prov-grid { grid-template-columns: 1fr 1fr; }
  .prov-card .pv-rate { font-size: 21px; }
}

/* ===== 责任人列：多人共担时按「/」整体换行，避免 CJK 逐字断行 =====
   （配合部门一行仍允许自由换行，故只作用于责任人主文本） */
table.tbl .owner-name { word-break: keep-all; }

/* ===== 责任人列：人名 + 所属部门（配合部门更淡，作参考信息） ===== */
table.tbl .owner-dept { margin-top: 2px; font-size: 12px; color: var(--text-2); word-break: keep-all; }
table.tbl .sup-mute { margin-top: 2px; color: #a8b6c8; font-size: 11px; line-height: 1.45; }
/* 云端模式标记（数据存云端，电脑关机也能用） */
.mode-chip.cloud { background: var(--brand-soft); color: var(--brand-dark); border-color: #bcd6ea; }
