* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --blue: #1677ff; --blue-dark: #0e5fd8; --bg: #f2f4f7; --card: #fff;
  --text: #1a1a1a; --sub: #8a94a6; --line: #eef1f5;
  --green: #00b578; --orange: #ff8f1f; --red: #f5222d; --purple: #7c5cff;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  max-width: 560px; margin: 0 auto; position: relative; min-height: 100%;
  box-shadow: 0 0 40px rgba(0,0,0,.06);
}
.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
  color: #fff; padding: 14px 16px 18px; position: sticky; top: 0; z-index: 20;
}
.topbar .row { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand small { font-weight: 400; opacity: .8; font-size: 12px; margin-left: 6px; }
.role-chip {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer;
}
.subline { margin-top: 6px; font-size: 12px; opacity: .85; display: flex; gap: 12px; }

/* 页面容器 */
.page { padding: 12px 12px 78px; }
.card {
  background: var(--card); border-radius: 14px; padding: 14px;
  margin-bottom: 12px; box-shadow: 0 1px 3px rgba(16,24,40,.04);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.card-title .more { font-size: 12px; color: var(--sub); font-weight: 400; cursor: pointer; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px rgba(16,24,40,.04); }
.kpi .label { font-size: 12px; color: var(--sub); }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .unit { font-size: 12px; font-weight: 400; color: var(--sub); margin-left: 2px; }
.kpi .delta { font-size: 12px; margin-top: 2px; }
.up { color: var(--green); } .down { color: var(--red); }

/* 进度条 */
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg,#1677ff,#69b1ff); }

/* 列表行 */
.row-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: none; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .meta { font-size: 12px; color: var(--sub); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .right { text-align: right; flex-shrink: 0; }
.row-item .right .big { font-weight: 700; font-variant-numeric: tabular-nums; }

/* 徽标 */
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 6px; font-weight: 500; }
.tag.blue { background: #e8f2ff; color: #1677ff; }
.tag.green { background: #e6f9f1; color: #00a06c; }
.tag.orange { background: #fff4e6; color: #d46b08; }
.tag.red { background: #ffecec; color: #d4380d; }
.tag.gray { background: #f2f4f7; color: #7a8699; }

/* 底部 Tab */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 560px; margin: 0 auto;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: flex; padding: 6px 0 8px; z-index: 30;
}
.tab { flex: 1; text-align: center; font-size: 11px; color: var(--sub); cursor: pointer; padding: 2px 0; }
.tab .ico { font-size: 19px; display: block; line-height: 1.2; }
.tab.active { color: var(--blue); font-weight: 600; }

/* 筛选 */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-size: 13px; color: var(--sub); cursor: pointer;
}
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }

/* 输入 */
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line); background: #fafbfc; border-radius: 10px;
  padding: 11px 12px; font-size: 14px; outline: none; font-family: inherit;
}
.input:focus { border-color: var(--blue); background: #fff; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.btn {
  display: block; width: 100%; border: none; border-radius: 12px; padding: 13px;
  font-size: 15px; font-weight: 600; color: #fff; background: var(--blue); cursor: pointer;
}
.btn:active { opacity: .85; }
.btn.ghost { background: #f2f4f7; color: var(--text); }
.btn.sm { padding: 8px 14px; width: auto; display: inline-block; font-size: 13px; border-radius: 9px; }
.btn-row { display: flex; gap: 8px; margin-top: 8px; }

/* 图表 */
.chart-wrap { width: 100%; overflow: hidden; }
svg.chart { width: 100%; height: auto; display: block; }

/* 详情 */
.hero {
  background: linear-gradient(135deg,#1677ff,#4096ff); color: #fff; border-radius: 14px;
  padding: 16px; margin-bottom: 12px;
}
.hero h2 { font-size: 17px; margin-bottom: 4px; }
.hero .m { font-size: 12px; opacity: .9; }

/* 空态 */
.empty { text-align: center; color: var(--sub); padding: 36px 0; font-size: 13px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; z-index: 99; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 80%;
  text-align: center;
}
#toast.show { opacity: 1; }

/* 弹层 */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0;
  padding: 18px 16px 24px; max-height: 86vh; overflow-y: auto;
}
.sheet h3 { font-size: 16px; margin-bottom: 14px; text-align: center; }

.hero-mini { display: flex; gap: 16px; }
.hero-mini div { flex: 1; }
.hero-mini .v { font-size: 19px; font-weight: 700; }
.hero-mini .l { font-size: 11px; opacity: .85; }

.alert-item { border-left: 3px solid var(--red); padding-left: 10px; }

/* ---- 表单页 / 6 个 tab 适配：避免横向溢出把右侧裁掉 ---- */
body { overflow-x: hidden; }
.tabbar { overflow-x: auto; }
.tab { flex: 1 0 auto; min-width: 0; }
.card-title .more { max-width: 58%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .right .btn-row { display: flex; justify-content: flex-end; }
/* 窄屏兜底：文件选择框/长串不撑破卡片 */
.card { overflow: hidden; }
input[type=file] { max-width: 100%; }
.topbar .row { min-width: 0; }
.brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip { flex-shrink: 0; }
