:root {
  --bg: #f4f5fa;
  --card: #ffffff;
  --ink: #171a2b;
  --ink-2: #4b5168;
  --ink-3: #8a90a6;
  --line: #e8eaf2;
  --line-2: #f1f2f8;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef0ff;
  --green: #0f9f6e;
  --green-soft: #e7f8f1;
  --orange: #e8830c;
  --orange-soft: #fff3e2;
  --red: #e04545;
  --red-soft: #fdecec;
  --blue: #2f7ee5;
  --blue-soft: #e9f2fe;
  --violet: #8b5cf6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 22, 46, .04), 0 8px 24px rgba(20, 22, 46, .06);
  --shadow-lg: 0 24px 60px rgba(20, 22, 46, .18);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
h1, h2, h3, h4 { margin: 0; }
p { margin: 0; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 10% -10%, #e5e7ff 0%, transparent 60%),
    radial-gradient(700px 400px at 100% 100%, #dcf5ec 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 20px;
  padding: 34px 32px 26px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.8);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 20px; letter-spacing: -.3px; }
.login-brand p { color: var(--ink-3); font-size: 12.5px; margin-top: 5px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  background: linear-gradient(135deg, #5b52ea, #7c6cf5);
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px;
  display: grid; place-items: center;
  box-shadow: 0 8px 18px rgba(79, 70, 229, .3);
}
.brand-mark.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 11px; }
.login-form { display: grid; gap: 16px; }
.field { display: grid; gap: 12px; }
.field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 600; line-height: 1.4; }
.field > span .req { color: var(--red); margin-left: 2px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfbfe;
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.65; }
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a90a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 34px;
  cursor: pointer;
}
.field select:focus {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%234f46e5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.field input[type="date"] { cursor: pointer; }
.form-error {
  color: var(--red); background: var(--red-soft); border-radius: 8px;
  padding: 9px 12px; font-size: 13px;
}
.btn-block { width: 100%; justify-content: center; }
.login-tip { margin-top: 20px; font-size: 12px; color: var(--ink-3); line-height: 1.6; text-align: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all .15s ease; white-space: nowrap;
}
.btn:hover { border-color: #d8dbe8; background: #fafbff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 6px 14px rgba(79, 70, 229, .22);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #0c8b5f; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-danger-ghost { color: var(--red); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn-mini {
  padding: 4px 12px; font-size: 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  cursor: pointer; font-weight: 500; transition: all .12s; white-space: nowrap;
}
.btn-mini:hover { border-color: var(--primary); color: var(--primary); }
.btn-mini.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-mini.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-mini.danger { color: var(--red); border-color: transparent; background: var(--red-soft); }
.btn-mini.danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-lg { padding: 11px 20px; font-size: 14.5px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--line-2); }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; z-index: 40; overflow: hidden;
}
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 2px 6px 18px; }
.brand-text { display: grid; gap: 2px; min-width: 0; }
.brand-text strong { font-size: 14px; letter-spacing: -.2px; }
.brand-text span { font-size: 10.5px; color: var(--ink-3); letter-spacing: .6px; text-transform: uppercase; }
.nav { display: grid; gap: 3px; flex: 1; overflow-y: auto; overflow-x: hidden; align-content: start; padding-right: 4px; margin-right: -4px; }
/* 菜单二级分组（可折叠） */
.nav-group { margin-bottom: 4px; }
.nav-group-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--ink-3); padding: 12px 12px 6px; text-transform: uppercase;
  cursor: pointer; user-select: none;
}
.nav-group-label:hover { color: var(--ink-1); }
.nav-caret { transition: transform 0.2s; opacity: 0.6; }
.nav-group.collapsed .nav-caret { transform: rotate(-90deg); }
.nav-group-items { overflow: hidden; transition: max-height 0.25s ease; }
.nav-group.collapsed .nav-group-items { max-height: 0 !important; }
/* 默认给 nav-group-items 设一个足够大的 max-height */
.nav-group-items { max-height: 500px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: var(--line-2); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item.active svg { color: var(--primary); }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px;
  border-radius: 20px; padding: 1px 6px; font-weight: 700;
}
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 6px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #eef0ff, #dbe4ff); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-chip .u-name { font-size: 13px; font-weight: 700; }
.user-chip .u-role { font-size: 11px; color: var(--ink-3); }
.sidebar-mask { position: fixed; inset: 0; background: rgba(15, 18, 40, .4); z-index: 35; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 26px; background: rgba(244, 245, 250, .86);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.page-title h2 { font-size: 19px; letter-spacing: -.4px; }
.page-title p { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.project-switch { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.project-switch select, #project-select {
  height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-1); padding: 0 30px 0 12px; font-size: 13px; outline: none;
  cursor: pointer;
  /* 自定义下拉箭头 */
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.project-switch select:hover, #project-select:hover { border-color: var(--primary); }
.project-switch select:focus, #project-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34,139,230,0.12); }
.project-switch .project-badge {
  font-size: 12.5px; color: var(--ink-2); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
}
.project-switch + .topbar-right { margin-left: 12px; }
.view { padding: 8px 26px 40px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ---------- cards / layout ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2); gap: 12px;
}
.card-head h3 { font-size: 14.5px; letter-spacing: -.2px; }
.card-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  display: grid; gap: 8px; position: relative; overflow: hidden;
}
.kpi .k-label { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 25px; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.kpi .k-value.sm { font-size: 20px; }
.kpi .k-foot { font-size: 11.5px; color: var(--ink-3); }
.kpi .k-icon {
  position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
}
.kpi.green .k-icon { background: var(--green-soft); color: var(--green); }
.kpi.orange .k-icon { background: var(--orange-soft); color: var(--orange); }
.kpi.red .k-icon { background: var(--red-soft); color: var(--red); }
.kpi.blue .k-icon { background: var(--blue-soft); color: var(--blue); }
.kpi.violet .k-icon { background: #f0ebff; color: #7c3aed; }
.kpi .k-icon svg { width: 17px; height: 17px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-title h3 { font-size: 15px; }
.section-title p { font-size: 12px; color: var(--ink-3); }
.two-col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 11.5px;
  letter-spacing: .3px; padding: 12px 16px; background: #fbfbfd;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td {
  padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; line-height: 1.5;
}
table.data tbody tr:hover { background: #fafbff; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data th.th-sort { cursor: pointer; user-select: none; transition: color .15s, background .15s; }
table.data th.th-sort:hover { color: var(--brand); background: #f6f7ff; }
table.data th.th-sort .sort-ico { margin-left: 5px; font-size: 10px; color: var(--ink-3); opacity: .65; }
table.data th.th-sort.active { color: var(--brand); }
table.data th.th-sort.active .sort-ico { color: var(--brand); opacity: 1; }
table.data th.th-sort.active { background: #f6f7ff; }

table.data .num { font-variant-numeric: tabular-nums; }
.cell-main { display: grid; gap: 4px; }
.cell-main strong { font-size: 13.5px; font-weight: 700; }
.cell-main span { font-size: 11.5px; color: var(--ink-3); }
.cell-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.link-btn {
  border: none; background: transparent; color: var(--primary);
  font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.link-btn:hover { background: var(--primary-soft); }
.link-btn.danger { color: var(--red); }
.link-btn.danger:hover { background: var(--red-soft); }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.money.pos { color: var(--green); }
.money.neg { color: var(--red); }
.muted { color: var(--ink-3); }
.tiny { font-size: 11.5px; }
code.invite-code {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12.5px;
  letter-spacing: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 6px;
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.new { background: var(--blue-soft); color: var(--blue); }
.badge.following { background: var(--orange-soft); color: var(--orange); }
.badge.converted { background: var(--green-soft); color: var(--green); }
.badge.lost { background: #f1f2f6; color: #8a90a6; }
.badge.online { background: var(--violet); color: #fff; background: #f0ebff; color: #7c3aed; }
.badge.offline { background: #e6f4ff; color: #1877c9; }
.badge.village_new { background: #e8f7e8; color: #2e8b2e; }
.badge.village_opt { background: #e0f5f0; color: #1a8a6a; }
.badge.city { background: #e6f4ff; color: #1877c9; }
.badge.villa { background: #fff3e0; color: #c47a00; }
.badge.factory { background: #eceff4; color: #5a6573; }
.badge.company { background: #eee8ff; color: #6d4bd1; }
.badge.layout { background: #fde8f0; color: #c23a7a; }
.badge.key { background: #fff1d6; color: #b26a00; }
.badge.normal { background: var(--line-2); color: var(--ink-2); }
.badge.potential { background: var(--blue-soft); color: var(--blue); }
.badge.high { background: var(--red-soft); color: var(--red); }
.badge.medium { background: var(--orange-soft); color: var(--orange); }
.badge.low { background: #f1f2f6; color: var(--ink-3); }
.badge.active { background: var(--green-soft); color: var(--green); }
.badge.inactive { background: #f1f2f6; color: var(--ink-3); }
.badge.churned { background: var(--red-soft); color: var(--red); }
.badge.overdue { background: var(--red-soft); color: var(--red); }

/* ---------- filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .search {
  display: flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 11px; min-width: 230px;
}
.filters .search input { border: none; outline: none; background: transparent; width: 100%; }
.filters .search svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.select-wrap { position: relative; }
/* 下拉选择：统一高度、圆角与自绘箭头 */
.select-wrap select,
.filters select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background-color: #fff;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a90a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  border-radius: 10px;
  padding: 7px 30px 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  min-width: 116px;
  height: 35px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.select-wrap select:hover,
.filters select:hover { border-color: #d8dbe8; }
.select-wrap select:focus,
.filters select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
  outline: none;
}
.select-wrap select:disabled,
.filters select:disabled { opacity: .55; cursor: not-allowed; }

select.ctl, input.ctl {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 8px 11px; outline: none; font-size: 13px; color: var(--ink);
}
select.ctl:focus, input.ctl:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }

/* 日期选择：与下拉等高、圆角一致 */
.filters input[type="date"],
input.ctl[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  height: 35px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.filters input[type="date"]:hover,
input.ctl[type="date"]:hover { border-color: #d8dbe8; }
.filters input[type="date"]:focus,
input.ctl[type="date"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
/* 日历图标：弱化默认灰块，悬停加深 */
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: .5;
  border-radius: 5px;
  padding: 2px;
  transition: opacity .15s, background .15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: .9;
  background: var(--primary-soft);
}
input[type="date"]::-webkit-datetime-edit { padding: 0; }
input[type="date"]:invalid::-webkit-datetime-edit { color: var(--ink-3); }
.filters .spacer { flex: 1; }
.tabs { display: inline-flex; background: #eef0f6; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tab {
  border: none; background: transparent; padding: 6px 13px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(20,22,46,.1); }
.tab .count { font-size: 11px; color: var(--ink-3); margin-left: 4px; }

/* ---------- empty / pagination ---------- */
.empty { padding: 46px 20px; text-align: center; color: var(--ink-3); }
.empty svg { width: 38px; height: 38px; opacity: .4; margin-bottom: 10px; }
.empty p { font-size: 13px; }
.empty .btn { margin-top: 14px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }
.pager .pager-btns { display: flex; gap: 6px; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17, 20, 40, .45);
  z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 20px 20px; overflow-y: auto; animation: fade .15s ease;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease; margin-bottom: 40px;
}
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 980px; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { font-size: 16px; letter-spacing: -.3px; }
.modal-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.modal-close {
  border: none; background: transparent; cursor: pointer; color: var(--ink-3);
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex: none;
}
.modal-close:hover { background: var(--line-2); color: var(--ink); }
.modal-body { padding: 20px 24px; max-height: 66vh; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px; border-top: 1px solid var(--line-2); background: #fcfcfe;
  border-radius: 0 0 16px 16px;
}
.modal-foot .left { margin-right: auto; }

/* modal 内嵌表单（topic/copy 等场景的 <form class="modal-form">） */
.modal-form { display: grid; gap: 16px; }
.modal-form label {
  display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.modal-form label .req { color: var(--red); margin-left: 2px; font-weight: 500; }
.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  border: 1px solid var(--line); background: #fbfbfe;
  border-radius: 10px; padding: 10px 14px; outline: none; font-weight: 400;
  color: var(--ink); font-size: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-sizing: border-box;
}
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.modal-form select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a90a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
  padding-right: 34px;
}
.modal-form textarea {
  resize: vertical; min-height: 100px; line-height: 1.65;
}
.modal-form .modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 12px; margin-top: 4px;
  border-top: 1px solid var(--line-2);
}

/* 员工身份 chip 多选 */
.position-chips {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--line); background: #fff;
  font-size: 13px; color: var(--ink-2); font-weight: 500;
  transition: all .12s; user-select: none;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985) } to { opacity: 1; transform: none } }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check-item {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--ink-2); background: #fff;
}
.check-item:hover { border-color: var(--primary); color: var(--ink); }
.check-item input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; padding: 4px 0 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 6px;
  background: var(--primary-soft); color: var(--primary); font-size: 12.5px;
}
.tag-x { cursor: pointer; font-weight: 700; color: var(--ink-3); }
.tag-x:hover { color: var(--red); }

.ms-control {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 42px; padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.ms-control .tag-list { flex: 1; min-height: 0; padding: 0; }
.ms-arrow { flex-shrink: 0; font-size: 12px; color: var(--ink-3); }
.ms-panel {
  margin-top: 6px; padding: 4px; max-height: 220px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.ms-search {
  width: 100%; box-sizing: border-box; margin: 4px 0 6px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; outline: none;
}
.ms-search:focus { border-color: var(--primary); }
.ms-empty { padding: 10px; text-align: center; }
.ms-item[hidden] { display: none; }
.ms-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.ms-item:hover { background: #f7f8fa; }
.ms-item input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.form-section { margin: 6px 0 18px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title {
  font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .6px;
  text-transform: uppercase; padding-bottom: 8px; margin-bottom: 12px;
  border-bottom: 1px dashed var(--line); display: flex; align-items: center; gap: 6px;
}
.form-hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }

/* ---------- voice ---------- */
.voice-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid #d9ddfb; background: #f5f6ff; color: var(--primary);
  border-radius: 8px; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.voice-btn:hover { background: var(--primary-soft); }
.voice-btn svg { width: 13px; height: 13px; }
.voice-btn.recording { background: var(--red); border-color: var(--red); color: #fff; animation: pulse 1.4s infinite; }
.voice-btn.recording svg { animation: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,69,69,.35) } 50% { box-shadow: 0 0 0 7px rgba(224,69,69,0) } }
.voice-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.voice-row label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.voice-interim { font-size: 11.5px; color: var(--primary); min-height: 15px; margin-top: 4px; }
.voice-tip { font-size: 11px; color: var(--ink-3); }

/* ---------- dashboard ---------- */
.hero {
  background: linear-gradient(120deg, #4f46e5 0%, #6d5cf0 55%, #8b7bf5 100%);
  border-radius: 18px; padding: 22px 24px; color: #fff; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  box-shadow: 0 14px 34px rgba(79, 70, 229, .22); position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px;
  border-radius: 50%; background: rgba(255,255,255,.1);
}
.hero h3 { font-size: 19px; letter-spacing: -.4px; margin-bottom: 6px; }
.hero p { font-size: 12.5px; opacity: .85; }
.hero-actions { display: flex; gap: 8px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; backdrop-filter: blur(6px); }
.hero .btn:hover { background: rgba(255,255,255,.26); }

.todo-list { display: grid; gap: 2px; }
.todo-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; cursor: pointer;
}
.todo-item:hover { background: var(--line-2); }
.todo-item .who { min-width: 0; flex: 1; }
.todo-item .who strong { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-item .who span { font-size: 11.5px; color: var(--ink-3); }
.todo-item .when { font-size: 11.5px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.todo-item .when.overdue { color: var(--red); font-weight: 700; }

.activity { display: grid; gap: 2px; }
.activity-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.activity-row:last-child { border-bottom: none; }
.activity-row .a-main { flex: 1; min-width: 0; }
.activity-row .a-main strong { font-size: 13px; }
.activity-row .a-main span { font-size: 11.5px; color: var(--ink-3); }

.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px; border-bottom: 1px dashed var(--line-2);
  text-decoration: none; color: inherit; border-radius: 8px;
}
.rank-row:hover { background: #fafbff; }
.rank-row:last-child { border-bottom: none; }
.rank-row .rank-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rank-row .rank-main strong { font-size: 13px; font-weight: 700; color: var(--ink); }
.rank-row .rank-main span { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-no {
  width: 22px; height: 22px; flex: none; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--line-2); color: var(--ink-3);
  font-size: 12px; font-weight: 700;
}
.rank-no.top1 { background: #fff1d6; color: #b26a00; }
.rank-no.top2 { background: #eef1f8; color: #5b6573; }
.rank-no.top3 { background: #fbe7d6; color: #b26a00; }

/* ---------- funnel ---------- */
.funnel { display: grid; gap: 9px; }
.funnel-step { display: grid; gap: 5px; }
.funnel-step .f-top { display: flex; align-items: baseline; justify-content: space-between; font-size: 12.5px; }
.funnel-step .f-top span { color: var(--ink-3); }
.funnel-step .f-top b { font-size: 14px; font-variant-numeric: tabular-nums; }
.funnel-bar { height: 9px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #6d5cf0, #a394ff); transition: width .5s ease; }
.funnel-step:nth-child(2) .funnel-bar i { background: linear-gradient(90deg, #6d5cf0, #9182ff); }
.funnel-step:nth-child(3) .funnel-bar i { background: linear-gradient(90deg, #0f9f6e, #4fd1a5); }
.funnel-step:nth-child(4) .funnel-bar i { background: linear-gradient(90deg, #0f9f6e, #34c08f); }
.funnel-step:nth-child(5) .funnel-bar i { background: linear-gradient(90deg, #e8830c, #ffb457); }

/* ---------- detail page ---------- */
.back-arrow {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; margin-right: 4px;
  border-radius: 8px; border: 1px solid var(--line);
  color: var(--ink-2); background: #fff;
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
}
.back-arrow:hover { background: var(--line-2); color: var(--primary); border-color: var(--primary); }

.detail-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  padding: 20px 22px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.detail-avatar {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  background: linear-gradient(135deg, #eef0ff, #dfe3ff); color: var(--primary);
  font-size: 18px; font-weight: 800; display: grid; place-items: center;
}
.detail-title { flex: 1; min-width: 200px; display: grid; gap: 6px; }
.detail-title h2 { font-size: 21px; letter-spacing: -.5px; }
.detail-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-tabs { margin: 18px 0 14px; display: flex; gap: 26px; border-bottom: 1px solid var(--line); }
.detail-tab {
  border: none; background: transparent; padding: 0 0 11px; font-size: 14px; font-weight: 600;
  color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.detail-tab.active { color: var(--primary); border-color: var(--primary); }
.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.info-item { display: grid; gap: 4px; }
.info-item span { font-size: 11.5px; color: var(--ink-3); }
.info-item strong { font-size: 13px; font-weight: 600; word-break: break-all; }
.info-item.full { grid-column: span 2; }
.info-item.full strong { font-weight: 500; line-height: 1.7; white-space: pre-wrap; }

.timeline { position: relative; padding-left: 22px; display: grid; gap: 16px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; }
.tl-item::before {
  content: ''; position: absolute; left: -21px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid var(--primary);
}
.tl-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.tl-head strong { font-size: 13px; }
.tl-head span { font-size: 11.5px; color: var(--ink-3); }
.tl-body { font-size: 13px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; }
.tl-next { margin-top: 5px; font-size: 11.5px; color: var(--orange); }

/* ---------- charts ---------- */
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.chart-legend .lg { display: flex; align-items: center; gap: 5px; }
.chart-legend .lg i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.bar-list { display: grid; gap: 13px; }
.bar-item { display: grid; gap: 5px; }
.bar-item .b-top { display: flex; justify-content: space-between; font-size: 12.5px; gap: 10px; }
.bar-item .b-top span { color: var(--ink-2); }
.bar-item .b-top b { font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; background: var(--line-2); border-radius: 5px; overflow: hidden; display: flex; }
.bar-track i { display: block; height: 100%; border-radius: 5px; }
.bar-item .b-sub { font-size: 11px; color: var(--ink-3); }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-center { font-size: 11px; fill: var(--ink-3); }
.rank-list { display: grid; gap: 2px; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.rank-row:last-child { border-bottom: none; }
.rank-no { width: 20px; height: 20px; border-radius: 6px; background: var(--line-2); color: var(--ink-3); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.rank-row:nth-child(1) .rank-no { background: #fff1d6; color: #b26a00; }
.rank-row:nth-child(2) .rank-no { background: #eef1f7; color: #5a6478; }
.rank-row:nth-child(3) .rank-no { background: #fdeee4; color: #b0602c; }
.rank-row .r-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .r-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; pointer-events: none; }
.toast {
  background: #22263d; color: #fff; padding: 9px 16px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow-lg); animation: slideDown .2s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.success { background: #0e7a57; }
.toast.error { background: #c03a3a; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* ---------- misc ---------- */
.stat-row { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-mini { display: grid; gap: 3px; }
.stat-mini span { font-size: 11.5px; color: var(--ink-3); }
.stat-mini b { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.ml-auto { margin-left: auto; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.w-full { width: 100%; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mobile-only { display: none; }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .three-col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg); height: 100%;
  }
  .sidebar.open { transform: none; }
  .mobile-only { display: grid; }
  .topbar { padding: 12px 16px; }
  .view { padding: 8px 16px 40px; }
  .hero { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .k-value { font-size: 20px; }
  .kpi .k-icon { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .detail-head { padding: 16px; }
  .info-list { grid-template-columns: 1fr; }
  .info-item.full { grid-column: span 1; }
  .modal-mask { padding: 3vh 10px 10px; }
  .modal-body { max-height: 72vh; padding: 16px; }
  .modal-head { padding: 16px; }
  .modal-foot { padding: 12px 16px; }
  .page-title h2 { font-size: 17px; }
  .detail-tabs { gap: 18px; overflow-x: auto; }
  .filters .search { min-width: 0; flex: 1; }
  table.data th, table.data td { padding: 10px; }
}

/* =================================================================
   移动端适配：底部 Tab 导航 + 表格卡片化 + 底部抽屉弹窗
   ================================================================= */
.tabbar { display: none; }
@keyframes sheetUp {
  from { opacity: .6; transform: translateY(100%); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 960px) {
  .sidebar, .sidebar-mask { display: none !important; }
  #menu-btn { display: none !important; }
  .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(20, 22, 46, .06);
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  }
  .tabbar-item {
    flex: 1 1 0; min-width: 0; position: relative;
    display: grid; justify-items: center; gap: 3px;
    padding: 5px 0 3px; border-radius: 10px;
    color: var(--ink-3); font-size: 10.5px; font-weight: 700;
    letter-spacing: .2px; -webkit-tap-highlight-color: transparent;
  }
  .tabbar-item svg { width: 21px; height: 21px; }
  .tabbar-item.active { color: var(--primary); background: var(--primary-soft); }
  .tabbar-badge {
    position: absolute; top: 1px; left: 50%; transform: translateX(13px);
    min-width: 14px; padding: 1px 4px; border-radius: 8px;
    background: var(--red); color: #fff; font-size: 9px; line-height: 1.4;
    font-weight: 700; text-align: center; font-style: normal;
  }
  .main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
}

/* 表格 → 卡片列表 */
@media (max-width: 960px) {
  .table-wrap { overflow: visible; }
  table.data { display: block; width: 100%; font-size: 13px; }
  table.data thead { display: none; }
  table.data tbody { display: block; }
  table.data tbody tr {
    display: block; margin: 0 12px 12px; padding: 14px 16px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 1px 2px rgba(20, 22, 46, .04);
  }
  table.data tbody tr:hover { background: #fff; }
  table.data tbody tr:last-child { margin-bottom: 12px; }
  table.data td {
    display: block; position: relative;
    padding: 6px 0 6px 80px; border-bottom: none;
    font-size: 12.5px; line-height: 1.7;
  }
  table.data td::before {
    content: attr(data-label);
    position: absolute; left: 0; top: 6px; width: 72px;
    color: var(--ink-3); font-size: 11.5px; font-weight: 600; line-height: 1.75;
  }
  table.data td.cell-head {
    padding: 0 0 9px; margin-bottom: 5px;
    border-bottom: 1px dashed var(--line-2);
  }
  table.data td.cell-head::before { display: none; }
  table.data td.cell-head .cell-main strong { font-size: 15.5px; }
  table.data td.cell-head .cell-main span,
  table.data td.cell-head .cell-sub { margin-top: 4px; }
  table.data td:last-child { padding-left: 0; padding-top: 8px; }
  table.data td:last-child::before { display: none; }
  table.data td:last-child .row-actions { justify-content: flex-start; gap: 8px; }
  table.data td:last-child .link-btn { padding: 5px 8px; background: var(--line-2); border-radius: 8px; }
  table.data td:last-child .link-btn.danger { background: var(--red-soft); }
  table.data td.num, table.data td.money { font-size: 13px; }
}

@media (max-width: 640px) {
  body { font-size: 13.5px; }
  .view { padding: 4px 12px 24px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .page-title h2 { font-size: 17px; }
  .page-title p { display: none; }
  .topbar-right .btn { padding: 6px 10px; font-size: 12.5px; border-radius: 9px; }
  .topbar-right .btn svg { width: 14px; height: 14px; }

  .filters { gap: 8px; }
  .filters .search { flex: 1 1 100%; min-width: 0; }
  .filters .select-wrap { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .filters .select-wrap select { width: 100%; min-width: 0; }
  .filters input[type="date"] { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .filters .spacer { display: none; }
  .tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }

  .card-head { flex-wrap: wrap; padding: 14px; }
  .card-body { padding: 14px; }
  .hero { padding: 18px; border-radius: 16px; }
  .hero h3 { font-size: 17px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .kpi-grid { gap: 10px; }
  .kpi { padding: 12px 13px; border-radius: 12px; }
  .kpi .k-label { font-size: 11.5px; }
  .kpi .k-value { font-size: 19px; letter-spacing: -.5px; }
  .section-title { margin: 18px 0 10px; }

  .detail-head { gap: 12px; padding: 16px; }
  .detail-title { min-width: 0; }
  .detail-title h2 { font-size: 18px; }
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1 1 auto; justify-content: center; }
  .detail-tabs { gap: 16px; overflow-x: auto; white-space: nowrap; }
  .info-list { gap: 12px 16px; }
  .pager { flex-wrap: wrap; gap: 8px; }

  .donut-wrap { gap: 12px; }
  .stat-row { gap: 16px; }
  .login-card { padding: 26px 20px 22px; border-radius: 16px; }
  .login-wrap { padding: 16px; }
}

/* =================================================================
   移动端触控优化：输入框16px防iOS放大 / 按钮最小44px / 控件加高
   ================================================================= */
@media (max-width: 960px) {
  /* 弹窗 → 底部抽屉 */
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal, .modal.lg, .modal.xl {
    display: flex; flex-direction: column;
    width: 100%; max-width: none; max-height: 92vh; margin: 0;
    border-radius: 18px 18px 0 0;
    animation: sheetUp .24s cubic-bezier(.2, .8, .2, 1);
  }
  .modal-head { flex: none; padding: 16px 16px 12px; }
  .modal-body {
    flex: 1; min-height: 0; max-height: none; overflow-y: auto;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .modal-foot {
    flex: none; flex-wrap: wrap; border-radius: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .modal-foot .btn { flex: 1 1 0; justify-content: center; }
  .modal-foot .btn.left { flex: none; }

  /* 输入框 16px 防止 iOS 聚焦时自动放大 */
  input, select, textarea { font-size: 16px !important; }

  /* 按钮最小触控高度 44px */
  .btn { min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: 12px; }
  .btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }

  /* 表单输入框加高加大内边距，方便触控 */
  .field input, .field select, .field textarea {
    padding: 13px 14px; border-radius: 12px;
  }
  .field select { padding-right: 40px; background-size: 14px; background-position: right 14px center; }
  .field label > span { font-size: 13px; margin-bottom: 6px; }

  /* 筛选区控件加高 */
  .filters input, .filters select { min-height: 42px; padding: 0 12px; border-radius: 10px; }
  .filters .btn { min-height: 42px; }

  /* 卡片列表行操作按钮加大、加背景，更易点击 */
  .row-actions .link-btn {
    min-height: 36px; padding: 8px 12px;
    background: var(--line-2); border-radius: 8px;
    font-size: 13px; font-weight: 600;
  }
  .row-actions .link-btn.danger { background: var(--red-soft); color: var(--red); }

  /* 弹窗底部按钮加大 */
  .modal-foot .btn { min-height: 48px; font-size: 15.5px; border-radius: 12px; }
  .modal-foot { gap: 10px; }

  /* 顶栏按钮高度 */
  .topbar-right .btn { min-height: 38px; padding: 0 14px; font-size: 13px; }

  /* 分页按钮加大 */
  .pager button, .pager span { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }

  /* 清除点击高亮闪烁，增加按下反馈 */
  * { -webkit-tap-highlight-color: transparent; }
  .btn:active { transform: scale(.97); }

  /* 空状态按钮 */
  .empty .btn { min-height: 44px; padding: 0 20px; }

  /* 统计页筛选标签 */
  .tabs .tab { padding: 10px 14px; font-size: 13px; }
}

/* 小屏手机（<380px）额外优化 */
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi .k-value { font-size: 18px; }
  .filters .select-wrap { flex: 1 1 100%; }
}

/* ---------- 分成结算 ---------- */
.settle-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px;
}
.settle-picker { display: flex; align-items: center; gap: 8px; }
.settle-picker > span { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.settle-picker select, .settle-picker input {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; outline: none; font-size: 13px;
}
.settle-picker select:focus, .settle-picker input:focus { border-color: var(--primary); }

.settle-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 24px 26px; margin-bottom: 16px; border-radius: var(--radius);
  background: linear-gradient(120deg, #4f46e5 0%, #6d5cf6 55%, #8b5cf6 100%);
  color: #fff; box-shadow: 0 12px 32px rgba(79, 70, 229, .26);
}
.settle-hero-label { font-size: 12.5px; opacity: .82; }
.settle-hero-value { font-size: 34px; font-weight: 700; letter-spacing: .5px; margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
.settle-hero-sub { font-size: 12px; opacity: .82; line-height: 1.6; }
.settle-split { display: flex; gap: 12px; }
.settle-split-item {
  min-width: 132px; padding: 14px 16px; border-radius: 12px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22);
}
.settle-split-item.partner { background: rgba(255, 255, 255, .08); }
.settle-split-item span { display: block; font-size: 12px; opacity: .85; }
.settle-split-item b { display: block; font-size: 19px; font-weight: 700; margin-top: 5px; font-variant-numeric: tabular-nums; }

.settle-hint { font-style: normal; font-size: 11px; color: var(--ink-3); margin-left: 6px; }
.settle-strong { font-size: 15px !important; font-weight: 700 !important; color: var(--primary); }
.settle-note {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.6;
  color: var(--orange); background: var(--orange-soft);
}
.settle-result { display: grid; gap: 12px; }
.settle-result-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 10px; background: var(--line-2); font-size: 13px;
}
.settle-result-row b { font-size: 17px; font-variant-numeric: tabular-nums; }
.settle-result-row b.mine { color: var(--primary); }
.settle-result-row.total { background: var(--primary-soft); font-weight: 600; }
.settle-result-row.total b { color: var(--primary); }
.settle-formula { margin-top: 16px; padding: 14px; border-radius: 10px; border: 1px dashed var(--line); background: #fbfbfd; }
.settle-formula-title { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.settle-formula p { margin: 0 0 5px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.settle-formula p:last-child { margin-bottom: 0; }
table.data tr.settle-current { background: var(--primary-soft); }
table.data tr.settle-current:hover { background: var(--primary-soft); }

.settle-status {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.settle-status.open { background: var(--green-soft); color: var(--green); }
.settle-status.closed { background: #f1f2f6; color: var(--ink-3); }
.settle-pool .card-body { padding: 18px 20px; }
.settle-pool-label { font-size: 12px; color: var(--ink-3); }
.settle-pool-value {
  font-size: 24px; font-weight: 700; color: var(--ink); margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
}
.settle-pool-foot { font-size: 11.5px; color: var(--ink-3); }

/* ---------- 操作日志 ---------- */
.nowrap { white-space: nowrap; }
.log-action {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: #eef0f5; color: var(--ink-2); white-space: nowrap;
}
.log-action.create, .log-action.convert, .log-action.bind { background: var(--green-soft); color: var(--green); }
.log-action.update, .log-action.settle, .log-action.unsettle, .log-action.password { background: var(--primary-soft); color: var(--primary); }
.log-action.delete, .log-action.unbind { background: var(--orange-soft); color: var(--orange); }
.log-detail { display: grid; gap: 8px; margin-bottom: 14px; }
.log-detail-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.log-detail-row span { color: var(--ink-3); }
.log-detail-title { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.log-json {
  margin: 0; padding: 12px; border-radius: 10px; background: #f7f8fa; border: 1px solid var(--line);
  font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; max-height: 45vh; overflow: auto;
}
.log-summary {
  display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle; font-size: 13px; color: var(--ink-2);
}
.log-summary + .link-btn { margin-left: 6px; }

/* ---------- 分页 ---------- */
.pager-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-num { min-width: 32px; padding: 0 8px; justify-content: center; }
.pager-num.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-dots { color: var(--ink-3); padding: 0 2px; }

@media (max-width: 960px) {
  .settle-hero-value { font-size: 26px; }
  .settle-split { width: 100%; }
  .settle-split-item { flex: 1; min-width: 0; }
  .settle-toolbar { padding: 10px 12px; gap: 8px; }
  .settle-picker { flex: 1 1 auto; }
  .settle-picker select, .settle-picker input { flex: 1; min-width: 0; }
}

/* ---------------- 客户地图 ---------------- */
.map-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.map-kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; }
.map-kpi span { color: var(--ink-3); font-size: 12px; }
.map-kpi b { font-size: 24px; line-height: 1.1; color: var(--ink); }
.map-kpi.warn b { color: var(--orange); }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.china-map { width: 100%; height: 580px; }
.map-card .card-head { align-items: flex-start; }
.map-fix { font-size: 12px; white-space: nowrap; padding-top: 4px; }
.map-rank { display: grid; gap: 14px; }
.map-rank-row { display: flex; gap: 10px; align-items: flex-start; }
.map-rank-no { width: 20px; flex: none; height: 20px; border-radius: 6px; background: var(--line-2); color: var(--ink-3); font-size: 12px; display: grid; place-items: center; }
.map-rank-row:nth-child(-n+3) .map-rank-no { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.map-rank-main { flex: 1; min-width: 0; display: grid; gap: 5px; }
.map-rank-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.map-rank-city { font-weight: 600; color: var(--ink); }
.map-rank-tip { margin-left: 6px; font-style: normal; font-size: 11px; color: var(--ink-3); background: var(--line-2); padding: 1px 5px; border-radius: 4px; }
.map-rank-top b { color: var(--primary); font-weight: 600; white-space: nowrap; }
.map-rank-bar { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.map-rank-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #8b85f4, var(--primary)); }
.map-rank-sub { font-size: 12px; }

@media (max-width: 980px) {
  .map-layout { grid-template-columns: minmax(0, 1fr); }
  .map-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .china-map { height: 420px; }
}

/* ==================== 角色权限管理页 ==================== */
.roles-layout {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 16px; min-height: calc(100vh - 120px);
}
.roles-sidebar {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.sidebar-head strong { font-size: 14px; font-weight: 600; }
.sidebar-head .btn-mini {
  height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500;
  border-radius: 8px; border: 1px solid var(--primary);
  background: var(--primary); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: all .15s;
}
.sidebar-head .btn-mini:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(34,139,230,.25); }
.sidebar-head .btn-mini:active { transform: translateY(0); }
.role-list { list-style: none; padding: 8px; margin: 0; overflow-y: auto; flex: 1; }
.role-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.role-item:hover { background: var(--surface-2); }
.role-item.active { background: var(--surface-2); border-color: var(--primary); }
.role-item-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.role-item-head svg { width: 16px; height: 16px; color: var(--ink-3); }
.role-item-foot {
  display: flex; justify-content: space-between; margin-top: 4px;
  font-size: 11px; color: var(--ink-3);
}
.role-item-foot code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 10.5px; }
.tag-system {
  background: var(--surface-2); color: var(--ink-2);
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; margin-left: auto;
}
.tag-custom {
  background: rgba(34,139,230,0.12); color: #228be6;
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; margin-left: auto;
}
.role-item .btn-mini { margin-top: 6px; font-size: 11px; }
.role-item .btn-mini.danger { color: #dc2626; }

.roles-main {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; overflow-y: auto;
}
.empty-hint { text-align: center; color: var(--ink-3); padding: 60px 0; }

.perms-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.perms-head strong { font-size: 16px; }
.perms-head .muted { margin-left: 10px; font-size: 12px; }

.perms-tree { display: grid; gap: 8px; }
.perm-group {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-1); overflow: hidden;
}
.perm-group-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--surface-2); font-size: 13px; font-weight: 600;
}
.perm-group-body {
  padding: 8px 14px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 16px;
}
.perm-item {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 0; cursor: pointer;
}
.perm-item input[type="checkbox"] { accent-color: var(--primary); }
.perm-code { font-weight: 500; }
.perm-desc { font-size: 11px; }

.chk-all { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.chk-all input[type="checkbox"] { accent-color: var(--primary); }

/* ========== 内容运营：选题卡片 ========== */
.topic-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}
.topic-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden;
}
.topic-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 0;
  background: var(--primary); border-radius: 0 2px 2px 0; transition: height .18s;
}
.topic-card:hover { border-color: var(--line-2); box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.topic-card:hover::before { height: 100%; }
.tc-head { display: flex; align-items: center; gap: 8px; }
.tc-title { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.4; margin: 0; }
.tc-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin: 0; }
.tc-meta { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.tc-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.tc-actions { display: flex; gap: 6px; }

/* ========== 内容运营：文案列表 ========== */
.copy-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.copy-row {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; display: flex; justify-content: space-between; gap: 16px;
  transition: border-color .15s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.copy-row::before {
  content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 0;
  background: var(--primary); border-radius: 0 2px 2px 0; transition: height .18s;
}
.copy-row:hover { border-color: var(--line-2); box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.copy-row:hover::before { height: 100%; }
.cr-left { flex: 1; min-width: 0; }
.cr-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.cr-version {
  background: #f1f2f6; color: var(--ink-2);
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  font-family: ui-monospace, monospace;
}
.cr-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.cr-hook {
  font-size: 12.5px; color: var(--ink-2); background: #f7f8fb;
  padding: 6px 10px; border-radius: 6px; margin: 6px 0; line-height: 1.5;
  border-left: 2px solid var(--line);
}
.cr-content-preview { font-size: 12.5px; color: var(--ink-2); margin: 0; line-height: 1.5; }
.cr-meta { display: flex; gap: 14px; font-size: 11.5px; margin-top: 8px; flex-wrap: wrap; }
.cr-right { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

@media (max-width: 900px) {
  .roles-layout { grid-template-columns: minmax(0, 1fr); }
  .roles-sidebar { max-height: 200px; }
  .perm-group-body { grid-template-columns: 1fr; }
}
