:root {
  --ink: #16242e;
  --ink-2: #3d4d58;
  --ink-3: #6b7b85;
  --line: #dbe2e6;
  --paper: #f3f6f7;
  --card: #ffffff;
  --blue: #14466b;
  --blue-2: #1d5b8a;
  --blue-soft: #eaf2f8;
  --green: #22614e;
  --green-2: #2f7a63;
  --green-soft: #e7f2ee;
  --amber: #c98a24;
  --amber-soft: #faf0dd;
  --red: #b3423a;
  --red-soft: #fbeae8;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(22, 36, 46, 0.06), 0 4px 14px rgba(22, 36, 46, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--blue-2);
  text-decoration: none;
}

#app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 60px;
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 20px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.14);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--green-2);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  white-space: nowrap;
}

.brand-text span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.role-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.role-chip strong {
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  border-color: #b7c3ca;
  background: #f7fafb;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-2);
  border-color: var(--blue-2);
}

.btn-green {
  background: var(--green-2);
  border-color: var(--green-2);
  color: #fff;
}

.btn-green:hover {
  background: var(--green);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: var(--card);
  border-color: #e2b7b3;
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red-soft);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-sm svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
}

.layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.nav-section {
  font-size: 11px;
  color: var(--ink-3);
  padding: 10px 10px 5px;
  letter-spacing: 0.06em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 1px 0;
  font-size: 13px;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--ink-3);
}

.nav-item:hover {
  background: #f2f6f8;
}

.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--blue);
}

.nav-item {
  position: relative;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 20px 24px 32px;
  overflow-x: hidden;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-head h1 {
  font-size: 20px;
  margin: 0 0 4px;
  line-height: 1.3;
}

.page-head p {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.panel-head .sub {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 8px;
}

.panel-body {
  padding: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card .label {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-card .hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
}

.stat-card .accent-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--green-2);
}

.stat-card.blue .accent-line { background: var(--blue-2); }
.stat-card.green .accent-line { background: var(--green-2); }
.stat-card.amber .accent-line { background: var(--amber); }
.stat-card.red .accent-line { background: var(--red); }

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  background: #f8fafb;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafcfd;
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: #8a5b13; }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-gray { background: #eef1f3; color: var(--ink-2); }
.badge-outline { background: transparent; border-color: var(--line); color: var(--ink-2); }

.field-row {
  display: grid;
  gap: 12px;
}

.field-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.form-field label .req {
  color: var(--red);
  margin-left: 2px;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--blue-2);
  box-shadow: 0 0 0 3px rgba(29, 91, 138, 0.12);
}

.form-field textarea {
  min-height: 84px;
  resize: vertical;
}

.form-field .help {
  font-size: 11px;
  color: var(--ink-3);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfe;
}

.toolbar .search {
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 340px;
}

.toolbar select {
  min-width: 120px;
}

.empty {
  text-align: center;
  color: var(--ink-3);
  padding: 34px 16px;
  font-size: 13px;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: #e8edf0;
  overflow: hidden;
  min-width: 90px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green-2);
}

.progress-fill.warn {
  background: var(--amber);
}

.progress-fill.danger {
  background: var(--red);
}

.chart-box {
  width: 100%;
  height: 320px;
}

.chart-box.tall {
  height: 420px;
}

.chart-box.short {
  height: 240px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
}

.kv-item {
  border-bottom: 1px dashed var(--line);
  padding: 6px 0;
  min-width: 0;
}

.kv-item .k {
  font-size: 11px;
  color: var(--ink-3);
}

.kv-item .v {
  font-weight: 600;
  word-break: break-word;
}

.contact-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfdfe;
}

.contact-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.contact-card .name {
  font-weight: 600;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 38, 0.48);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  z-index: 50;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(15, 28, 38, 0.28);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 15px;
}

.modal-body {
  padding: 18px;
}

.modal-close {
  border: 0;
  background: transparent;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
}

.modal-close:hover {
  background: #f0f3f5;
  color: var(--ink);
}

.launch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 920px;
  margin: 0 auto;
}

.launch-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  text-align: left;
}

.launch-card:hover {
  border-color: var(--blue-2);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.launch-card .role {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 4px;
}

.launch-card .name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.launch-card .desc {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}

.launch-hero {
  max-width: 920px;
  margin: 0 auto 18px;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.launch-hero h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.launch-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.launch-hero .meta {
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.85);
}

#toast-root {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 320px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(15, 28, 38, 0.3);
  animation: toast-in 0.18s ease-out;
}

.toast.ok {
  background: var(--green);
}

.toast.warn {
  background: #8a5b13;
}

.toast.err {
  background: var(--red);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 登录页 */
.login-wrap {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 30px 24px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-brand strong {
  display: block;
  font-size: 15px;
  color: var(--ink);
}
.login-brand span {
  font-size: 12px;
  color: var(--ink-3);
}
.login-hints {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.login-hint {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-2);
  padding: 2px 0;
}
.login-hint code {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 6px;
  font-size: 12px;
  color: var(--ink);
}
.login-hint span {
  color: var(--ink-3);
}

/* ===== 登录页全屏布局（login-mode） ===== */
body.login-mode {
  background: #0e2b3f;
}
body.login-mode #app-shell.login-shell {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 85% -10%, rgba(29, 91, 138, 0.55), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, rgba(47, 122, 99, 0.4), transparent 55%),
              linear-gradient(135deg, #0d2436 0%, #0e2b3f 55%, #12384f 100%);
  padding: 24px;
}
/* 登录时隐藏 topbar / sidebar 占位，只留主区域 */
body.login-mode .topbar {
  display: none;
}
body.login-mode .layout {
  flex: none;
  width: 100%;
  max-width: 980px;
  min-height: 0;
}
body.login-mode .sidebar {
  display: none;
}
body.login-mode .main {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  background: transparent;
}

/* 分栏登录卡片：左品牌区 + 右表单区 */
.login-card {
  display: flex;
  width: 100%;
  max-width: 900px;
  min-height: 520px;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 60px rgba(6, 24, 36, 0.45);
}
.login-aside {
  flex: 1 1 46%;
  background: linear-gradient(160deg, #14466b 0%, #1d5b8a 55%, #22614e 130%);
  color: #fff;
  padding: 52px 44px;
  display: flex;
  flex-direction: column;
}
.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 26px;
}
.login-logo svg {
  width: 30px;
  height: 30px;
  color: #fff;
}
.login-aside h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.login-aside h2 {
  margin: 10px 0 6px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0.92;
}
.login-aside > p {
  margin: 0 0 30px;
  font-size: 13px;
  opacity: 0.72;
}
.login-features {
  list-style: none;
  margin: auto 0 20px;
  padding: 0;
  font-size: 13px;
  line-height: 2;
}
.login-features li::before {
  content: "✓";
  margin-right: 10px;
  font-weight: 700;
  color: #8fd3b8;
}
.login-footer {
  font-size: 12px;
  opacity: 0.55;
}
.login-panel {
  flex: 1 1 54%;
  padding: 56px 52px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
}
.login-title h2 {
  margin: 0 0 6px;
  font-size: 24px;
  color: var(--ink);
}
.login-title span {
  font-size: 14px;
  color: var(--ink-3);
}
.login-panel .form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.login-panel .form-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.login-panel .form-field input:focus {
  outline: none;
  border-color: var(--blue-2);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(29, 91, 138, 0.15);
}
.login-panel .btn-primary {
  border-radius: 10px;
  background: var(--blue);
  font-weight: 600;
  letter-spacing: 0.12em;
  transition: background 0.15s, transform 0.05s;
}
.login-panel .btn-primary:hover { background: var(--blue-2); }
.login-panel .btn-primary:active { transform: translateY(1px); }
.login-panel .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 720px) {
  body.login-mode .login-card { flex-direction: column; max-width: 420px; }
  .login-aside { padding: 30px 28px; }
  .login-aside h1 { font-size: 22px; }
  .login-features { margin-top: 20px; }
  .login-panel { padding: 36px 28px; }
}

.mini-stat {
  display: inline-flex;
  flex-direction: column;
  padding: 4px 10px;
  border-left: 3px solid var(--green-2);
  background: var(--green-soft);
  border-radius: 0 6px 6px 0;
}

.mini-stat .num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mini-stat .lbl {
  font-size: 11px;
  color: var(--ink-3);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.region-cascade {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.region-cascade select {
  flex: 1 1 150px;
  min-width: 140px;
}

/* 直辖市（北京/天津/上海/重庆）只有两级：隐藏"市"这一层，省下一级直接选区县 */
.region-cascade.municipality .region-city {
  display: none;
}

.region-filter-wrap {
  position: relative;
}

.region-cascade-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 30;
  width: 560px;
  max-width: 92vw;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
}

.region-cascade-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.region-cascade-col {
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
}

.region-cascade-col-head {
  font-size: 11px;
  color: var(--ink-3);
  padding: 4px 6px;
}

.region-cascade-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

.region-cascade-item:hover {
  background: var(--blue-soft);
}

.region-cascade-item.active {
  background: var(--blue);
  color: #fff;
}

.region-cascade-hint {
  color: var(--ink-3);
  font-size: 12px;
  padding: 10px 8px;
}

.region-cascade-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.rf-clear-x {
  color: var(--ink-3);
  margin-left: 6px;
  font-weight: 700;
}

@media (max-width: 700px) {
  .region-cascade-panel {
    width: 320px;
  }
  .region-cascade-cols {
    grid-template-columns: 1fr;
  }
}

.member-followups-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.member-followups-link {
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.member-followups-link:hover {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--blue-2);
}

#ff-range .pill {
  cursor: pointer;
}

.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--blue-2);
}

.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.row-error td {
  background: var(--red-soft);
}

.import-step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fbfdfe;
}

.import-step-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.import-step-no {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.import-step-head strong {
  display: block;
  font-size: 13px;
}

.import-step-head .muted {
  display: block;
  font-size: 11px;
}

.import-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.import-template-box {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #fff;
  color: var(--ink-2);
  resize: vertical;
}

.import-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px dashed var(--blue-2);
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
}

.import-file-btn:hover {
  background: #dcebf5;
}

.import-file-name {
  margin-left: 10px;
  font-size: 12px;
}

.seg-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.seg-btn {
  padding: 7px 14px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  border-right: 1px solid var(--line);
  background: #fff;
}

.seg-btn:last-child {
  border-right: 0;
}

.seg-btn input {
  display: none;
}

.seg-btn.active {
  background: var(--blue);
  color: #fff;
}

.import-member-select {
  margin-top: 8px;
  max-width: 260px;
}

.import-overwrite {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--ink-2);
  margin: 2px 0 12px;
}

.inline-form .form-field {
  flex: 1 1 150px;
}

.section-note {
  background: var(--amber-soft);
  border: 1px solid #ecd9b2;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: #6f4a10;
  margin-bottom: 14px;
}

.section-note.blue-note {
  background: var(--blue-soft);
  border-color: #c5dcec;
  color: var(--blue);
}

.section-note.green-note {
  background: var(--green-soft);
  border-color: #c5e0d4;
  color: var(--green);
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--ink-2);
}

.pill.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.muted {
  color: var(--ink-3);
  font-size: 12px;
}

.mono {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
  }
  .nav-section { display: none; }
  .nav-item { width: auto; }
  .main { padding: 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .field-grid-2, .field-grid-3 { grid-template-columns: 1fr; }
  .launch-grid { grid-template-columns: 1fr; }
  .launch-hero { flex-direction: column; align-items: flex-start; }
  .launch-hero .meta { text-align: left; }
  .topbar { padding: 0 10px; }
  .role-chip .role-label { display: none; }
  .brand-text span { display: none; }
  .brand-text strong { font-size: 14px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions { gap: 6px; }
}

/* AI 接入配置面板 */
.ai-key-body .form-field { max-width: 540px; }
.ai-status-badge { display: inline-flex; align-items: center; gap: 6px; }
.ai-panel-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--blue-soft);
  border: 1px solid #c5dcec;
  color: var(--blue);
  border-radius: var(--radius);
  font-size: 12px;
  padding: 9px 12px;
  max-width: 540px;
  margin-bottom: 14px;
}
.ai-panel-tip svg { width: 15px; height: 15px; flex: 0 0 15px; }

/* AI 结果中的 Markdown 表格 */
.ai-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 4px;
  font-size: 13px;
}
.ai-table th, .ai-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.ai-table thead th {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
  white-space: nowrap;
}
.ai-table tbody tr:nth-child(even) { background: var(--paper); }
/* AI 结果区：统一柔和卡片（洞察弹窗 / BI 看板内嵌 / BI 弹窗 / 摘要弹窗） */
#bi-p-answer, #bi-answer, #ai-insight-body, #ai-result {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
/* 小节标题：左侧强调条，替代全宽下划线 */
#bi-p-answer h3, #bi-answer h3, #ai-result h3, #ai-result h4,
#ai-insight-body h3, #ai-insight-body h4 {
  margin: 18px 0 8px;
  font-size: 14px;
  color: var(--blue);
  font-weight: 600;
  border-left: 3px solid var(--blue);
  padding-left: 8px;
  line-height: 1.4;
}
#bi-p-answer h3:first-child, #bi-answer h3:first-child,
#ai-result h3:first-child, #ai-insight-body h3:first-child { margin-top: 0; }
#bi-p-answer h3:not(:first-child), #bi-answer h3:not(:first-child),
#ai-result h3:not(:first-child), #ai-insight-body h3:not(:first-child) {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
/* 列表：无圆点、保留舒适间距与行高 */
#bi-p-answer ul, #bi-answer ul, #ai-result ul, #ai-insight-body ul {
  margin: 6px 0;
  padding-left: 4px;
  list-style: none;
}
#bi-p-answer li, #bi-answer li, #ai-result li, #ai-insight-body li {
  margin: 6px 0;
  line-height: 1.6;
}
#bi-p-answer p, #bi-answer p, #ai-result p, #ai-insight-body p {
  margin: 8px 0;
  line-height: 1.7;
}
#bi-p-answer strong, #bi-answer strong, #ai-result strong, #ai-insight-body strong {
  color: var(--ink);
}
#bi-p-answer .ai-table,
#bi-answer .ai-table,
#ai-result .ai-table,
#ai-insight-body .ai-table {
  overflow-x: auto;
  display: block;
}

/* ======== Apple 极简浅色 换肤（追加覆盖，置于文件末尾） ========
   设计令牌：苹果式留白 + 细字重 + 单强调色 + 大圆角柔和阴影 */

:root {
  --ink: #1d1d1f;
  --ink-2: #424245;
  --ink-3: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --paper: #f5f5f7;
  --card: #ffffff;
  --blue: #0071e3;
  --blue-2: #0a5dc2;
  --blue-soft: #eaf2ff;
  --green: #1a7f5a;
  --green-2: #128a6b;
  --green-soft: #e7f6f0;
  --amber: #c77d0e;
  --amber-soft: #fcf3e0;
  --red: #d1321f;
  --red-soft: #fdeaeA;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 14px 36px rgba(0, 0, 0, 0.07);
}

html, body {
  background: var(--paper);
  color: var(--ink);
}

/* 顶栏 → 白色毛玻璃 */
.topbar {
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}
.brand-mark {
  border-radius: 11px;
  background: linear-gradient(135deg, var(--blue-2), var(--blue));
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.28);
}
.brand-text strong { color: var(--ink); }
.brand-text span { color: var(--ink-3); }
.role-chip {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.role-chip strong { color: var(--ink); }

/* 侧栏 → 白底 */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
}
.nav-section {
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.nav-item { color: var(--ink-2); border-radius: 9px; }
.nav-item:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); }
.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue-2);
}
.nav-item.active svg { color: var(--blue-2); }

/* 页面标题 → 大而轻 */
.main { padding: 30px 34px; }
.page-head h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.page-head p { color: var(--ink-3); }

/* 卡片 → 白 + 大圆角柔和投影，去重边框感 */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.panel-head h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.panel-head .sub { color: var(--ink-3); }

/* 统计卡 */
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.stat-card .value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.stat-card .label { color: var(--ink-3); }

/* 按钮 → 苹果式胶囊 */
.btn { border-radius: 999px; transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary, .btn-primary:hover { background: var(--blue); border-color: var(--blue); }
.btn-green, .btn-green:hover { background: var(--green-2); border-color: var(--green-2); }
.btn-ghost {
  background: rgba(0, 0, 0, 0.04);
  border-color: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover { background: rgba(0, 0, 0, 0.07); color: var(--ink); }

/* 表格 → 轻表头 + 行悬浮 */
.table-wrap { border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); }
table, #reports-tbl, #analytics-tbl, #customers-tbl, #members-tbl {
  border-collapse: collapse;
}
thead th {
  background: #fafafa;
  color: var(--ink-3);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line);
}
tbody td, thead th { border-bottom: 1px solid var(--line); }
tbody tr:hover { background: rgba(0, 113, 227, 0.04); }

/* 徽标 → 柔和胶囊 */
.badge { border-radius: 999px; }
.badge-gray, .badge-outline { opacity: 0.9; }

/* 表单 → 白底圆角 + 聚焦蓝环 */
input, select, textarea, .input, .select, .textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}
.field-label { color: var(--ink-2); }

/* 弹窗 → 大圆角大投影 */
.modal-mask { background: rgba(29, 29, 31, 0.34); backdrop-filter: blur(3px); }
.modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}
.modal-head h3 { font-weight: 600; letter-spacing: -0.01em; }

/* 激活项 / 链接 */
.pill.active { background: var(--blue); border-color: var(--blue); }
a { color: var(--blue-2); }

/* AI 结果卡片随新令牌 */
#bi-p-answer, #bi-answer, #ai-insight-body, #ai-result {
  background: var(--surface-muted, var(--card));
  border-radius: 12px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* 移动端窄屏微调：控件换行、弹窗/卡片贴边、数字收敛，表格依赖既有 .table-wrap 横向滚动 */
@media (max-width: 720px) {
  .modal-mask { padding: 18px 10px; align-items: center; }
  .modal-body { padding: 14px; }
  .modal { max-width: 100%; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 24px; }
  .panel-head { align-items: flex-start; }
  .panel-head .sub { display: none; }
  .panel-actions,
  .panel-head .sub-tools { flex-wrap: wrap; }
  .toolbar .search { max-width: 100%; flex-basis: 100%; }
  .toolbar select { min-width: 90px; }
  .tab-btn { padding: 8px 12px; font-size: 13px; }
  /* 移动端表格：避免长地区名被逐字拆行、数值被断行——设为可横向滚动并保持单行 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 520px; width: auto; }
  .table-wrap td { white-space: nowrap; }
  .table-wrap td .progress-bar { white-space: normal; }
}

/* 真实 logo（图片徽标）适配：透明底、等比、圆角，去掉渐变方块样式 */
img.brand-mark {
  background: transparent;
  box-shadow: none;
  border-radius: 8px;
  object-fit: contain;
}
.topbar-brand img.brand-mark { width: 34px; height: 34px; }
.login-brand img.brand-mark { width: 44px; height: 44px; }

/* 多人时成员徽章/跟进链接自动换行，防横向溢出 */
#radar-select,
.member-followups-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
#radar-select .radar-chip,
.member-followups-links .chip {
  white-space: nowrap;
}
