:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --ink: #18202a;
  --text: #374151;
  --text2: #6b7280;
  --muted: #687385;
  --line: #dfe4ea;
  --border: #dfe4ea;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --amber: #b45309;
  --red: #b91c1c;
  --blue: #2563eb;
  --green-soft: #e6f5f2;
  --amber-soft: #fff2d9;
  --red-soft: #fde8e8;
  --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #2dd4bf 100%);
}

.login-screen.open {
  display: grid;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(100%, 400px);
  padding: 40px 36px 32px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  text-align: center;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(15,118,110,.3);
}

.login-logo-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}

.login-subtitle {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.login-panel label {
  display: grid;
  gap: 6px;
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.login-panel input {
  min-height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  transition: border-color .2s;
}

.login-panel input:focus {
  outline: none;
  border-color: var(--brand);
}

.login-submit {
  min-height: 46px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  margin-top: 4px;
}

.login-submit:hover {
  opacity: .92;
}

.login-submit:active {
  transform: scale(.98);
}

#loginError {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
}

.login-hint {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 0;
  background: #f7f9fb;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.side-main {
  position: relative;
  min-width: 0;
  padding: 22px 16px;
  background: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 22px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #3e4a59;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #0877ff;
  background: #eaf4ff;
}

.side-status {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.side-status span,
.side-status strong {
  display: block;
}

.side-status span {
  color: var(--muted);
  font-size: 12px;
}

.side-status strong {
  margin: 6px 0 10px;
  font-size: 24px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e8ef;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #5eead4;
}

.main {
  min-width: 0;
  padding: 0 24px 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 82px;
  margin: 0 -24px 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
}

.top-actions,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.account-menu {
  position: relative;
}

.account-button {
  min-width: 116px;
  justify-content: center;
}

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 2500;
  display: none;
  min-width: 150px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.account-dropdown.show {
  display: grid;
  gap: 4px;
}

.account-dropdown button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0 10px;
}

.account-dropdown button:hover {
  background: #eef6ff;
  color: var(--brand);
}

.icon-button,
.primary-button,
.segmented button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 124px;
  padding: 18px;
}

.metric span,
.metric em {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.metric strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 30px;
  line-height: 1;
}

.metric.warning {
  background: var(--amber-soft);
  border-color: #f3d38b;
}

/* 维度切换器 */
.dim-btn {
  padding: 4px 14px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.dim-btn.active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}
.dim-btn:hover:not(.active) {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

/* 可点击的指标卡片 */
.metric.clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.metric.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.metric.clickable:hover strong {
  color: var(--primary, #2563eb);
}

/* 穿透详情抽屉 */
.drill-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 2100;
  display: flex; justify-content: flex-end;
}
.drill-drawer {
  width: 520px; max-width: 100vw; height: 100vh; overflow-y: auto;
  background: var(--surface); box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  display: flex; flex-direction: column;
}
.drill-drawer .drill-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.drill-drawer .drill-head h3 { font-size: 16px; margin: 0; }
.drill-drawer .drill-close {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 16px; display: flex;
  align-items: center; justify-content: center; color: var(--muted);
}
.drill-drawer .drill-close:hover { background: var(--hover-bg); color: var(--text); }
.drill-drawer .drill-body { padding: 16px 20px; flex: 1; }
.drill-drawer .drill-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.drill-drawer .drill-item:hover { background: var(--hover-bg, #f8fafc); margin: 0 -20px; padding: 10px 20px; }
.drill-drawer .drill-item-main { flex: 1; min-width: 0; }
.drill-drawer .drill-item-name { font-weight: 600; font-size: 14px; }
.drill-drawer .drill-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.drill-drawer .drill-item-amount { font-weight: 700; font-size: 15px; color: var(--primary, #2563eb); white-space: nowrap; margin-left: 12px; }
.drill-drawer .drill-empty { text-align: center; color: var(--muted); padding: 32px 0; }
.drill-drawer .drill-total { font-size: 13px; color: var(--muted); padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.drill-drawer .drill-summary-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 0;
  border-bottom: 1px solid var(--line); font-size: 14px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.funnel {
  display: grid;
  gap: 10px;
}

.funnel div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: var(--w);
  min-width: 220px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: #073b3a;
  background: linear-gradient(90deg, #99f6e4, #ccfbf1);
}

.task-list,
.audit-list,
.priority-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-list li,
.audit-list li,
.priority-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.task-list li:last-child,
.audit-list li:last-child,
.priority-list li:last-child {
  border-bottom: 0;
}

.audit-list li {
  align-items: flex-start;
  flex-direction: column;
  padding: 10px 0;
}

.audit-list small {
  color: var(--muted);
}

.tag,
.status,
.grade {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.tag {
  background: #edf2f7;
  color: #334155;
}

.grade {
  background: var(--green-soft);
  color: var(--brand-strong);
}

.status.danger {
  background: var(--red-soft);
  color: var(--red);
}

.status.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.status.ok {
  background: var(--green-soft);
  color: var(--brand-strong);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #f8fafb;
}

td strong {
  display: block;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.row-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.link-button {
  display: block;
  max-width: 360px;
  padding: 0;
  border: 0;
  color: var(--brand-strong);
  background: transparent;
  font-weight: 700;
  text-align: left;
}

.link-button:hover {
  text-decoration: underline;
}

.inline-status-select {
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: inherit;
  background: transparent;
  cursor: pointer;
  max-width: 120px;
}
.inline-status-select:hover {
  border-color: var(--line);
  background: var(--bg);
}
.inline-status-select:focus {
  outline: none;
  border-color: var(--brand);
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.crm-tabs {
  display: flex;
  gap: 36px;
  min-height: 64px;
  align-items: center;
  padding: 0 34px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fff;
  overflow-x: auto;
}

.compact-tabs {
  gap: 42px;
}

.crm-tabs button {
  position: relative;
  min-height: 62px;
  border: 0;
  background: transparent;
  color: #3e4a59;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-tabs button.active {
  color: #0877ff;
}

.crm-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #0877ff;
}

.filter-panel {
  position: relative;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.filter-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  min-height: 62px;
  border-bottom: 1px solid var(--line);
}

.filter-row:last-child {
  border-bottom: 0;
}

.filter-label {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 28px;
  color: #8a94a3;
  background: #f6f7f9;
  font-weight: 700;
}

.filter-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 20px;
  flex-wrap: wrap;
}

.search-line {
  flex-wrap: nowrap;
}

.filter-content select,
.filter-content input {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.search-line select {
  width: 160px;
}

.search-line input {
  width: min(100%, 480px);
}

.chip {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #3e4a59;
}

.chip:hover,
.chip.active {
  color: #0877ff;
  background: #eaf4ff;
}

.date-input {
  width: 160px;
}

.wide-select {
  width: 320px;
}

.link-action {
  border: 0;
  background: transparent;
  color: #0877ff;
}

.alphabet {
  gap: 18px;
}

.view-switch {
  display: inline-flex;
  margin-bottom: 28px;
  border: 1px solid #1683ff;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}

.view-switch button {
  min-width: 78px;
  min-height: 38px;
  border: 0;
  background: #fff;
  color: #3e4a59;
}

.view-switch button.active {
  color: #0877ff;
  background: #eef7ff;
  font-weight: 700;
}

.floating-check {
  position: absolute;
  right: -18px;
  top: 168px;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #1683ff;
  box-shadow: 0 10px 24px rgba(22, 131, 255, .28);
  font-weight: 800;
}

.table-toolbar {
  padding: 0 4px;
}

.result-count {
  color: var(--muted);
  font-weight: 700;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  border: 0;
  background: transparent;
}

.segmented button.active {
  background: #e7f4f2;
  color: var(--brand-strong);
}

.search {
  width: min(100%, 360px);
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.rule-list,
.check-list {
  display: grid;
  gap: 12px;
}

.rule-list label,
.check-list label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 38px;
}

.rule-list input[type="number"] {
  width: 82px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
}

.dictionary-list label {
  align-items: flex-start;
  flex-direction: column;
}

.dictionary-list textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  line-height: 1.6;
}

.org-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
}

.org-tree,
.org-users {
  min-width: 0;
}

.department-node {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbff;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.department-node span {
  color: var(--muted);
}

/* Enterprise tabs */
.enterprise-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.enterprise-tabs button {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all .2s;
}
.enterprise-tabs button.active {
  color: var(--brand-strong);
  border-bottom-color: var(--brand);
  font-weight: 600;
}
.enterprise-tabs button:hover:not(.active) { color: var(--text); }

.ent-tab-content { display: none; }
.ent-tab-content.active { display: block; }

/* Org user list item */
.org-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.org-user-item small, .org-user-item span:last-child { color: var(--muted); font-size: 12px; }
.empty-hint { text-align:center; color:var(--muted); padding:20px; font-size:13px; }

/* Role permission grid */
.permission-table { width:100%; border-collapse:collapse; font-size:12px; }
.permission-table th { background:var(--bg); padding:8px 6px; text-align:center; font-weight:600; white-space:nowrap; }
.permission-table td { padding:6px; text-align:center; border-bottom:1px solid var(--line); }
.role-name-cell { text-align:left !important; white-space:nowrap; }
.role-name-cell small { display:block; color:var(--muted); font-size:11px; margin-top:2px; }
.perm-cell.allowed { color:#16a34a; font-weight:700; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  justify-content: flex-end;
  background: rgba(15, 23, 42, .34);
}

.drawer.open {
  display: flex;
}

.drawer-panel,
.modal-panel {
  width: min(100%, 460px);
  padding: 24px;
  background: #fff;
}

.drawer-panel {
  position: relative;
  height: 100%;
  max-width: min(92vw, 520px);
  padding-top: 58px;
  overflow-y: auto;
  box-shadow: -18px 0 40px rgba(15, 23, 42, .18);
}

.drawer-panel h2 {
  margin-top: 0;
  padding-right: 44px;
}

.drawer.customer-detail {
  background: rgba(15, 23, 42, .22);
}

.drawer.customer-detail .drawer-panel {
  width: min(82vw, 1360px);
  max-width: none;
  padding: 64px 34px 34px;
  background: #eef2f6;
}

.drawer.customer-detail #drawerTitle,
.drawer.customer-detail #drawerText {
  display: none;
}

.drawer.customer-detail .drawer-close {
  top: 10px;
  left: 10px;
  right: auto;
  border-color: transparent;
  color: #1683ff;
  background: #eef2f6;
  box-shadow: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .34);
}

.modal.open {
  display: grid;
}

.modal-panel {
  width: min(100%, 560px);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, .22);
}

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.field-settings-section {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.field-settings-section h3 {
  margin: 0;
  font-size: 15px;
}

.field-settings-hint {
  color: var(--muted);
  font-size: 12px;
}

.field-settings-grid {
  display: grid;
  gap: 6px;
}

.field-setting-row {
  display: grid;
  grid-template-columns: 28px 24px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: grab;
}

.field-setting-row.dragging {
  opacity: .55;
  border-color: #1683ff;
  background: #eef7ff;
}

.drag-handle {
  color: #8a94a3;
  font-weight: 800;
  cursor: grab;
}

.sort-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
}

.form-grid textarea {
  min-height: 96px;
  padding-top: 10px;
  resize: vertical;
}

.import-box {
  display: grid;
  gap: 14px;
}

.import-box p,
.import-box small {
  margin: 0;
  color: var(--muted);
}

.duplicate-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.duplicate-card div {
  color: var(--muted);
}

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

.toast {
  position: fixed;
  z-index: 3200;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #101820;
  box-shadow: var(--shadow);
}

.th-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

.th-button:disabled {
  cursor: default;
}

.toast.show {
  display: block;
}

.close {
  float: right;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 22px;
}

.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  float: none;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
}

.drawer-close:hover,
.close:hover {
  border-color: #1683ff;
  color: #0877ff;
}

.timeline {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.timeline > .rule-line {
  padding: 12px;
  border-left: 3px solid var(--brand);
  background: #f7faf9;
}

.detail-card {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.detail-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.detail-row span,
.detail-subitem span {
  color: var(--muted);
}

.detail-row strong {
  overflow-wrap: anywhere;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.detail-title {
  margin: 18px 0 8px;
  font-size: 15px;
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-subitem {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-subitem small {
  color: var(--muted);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.attachment-list a {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  padding: 4px 8px;
  text-decoration: none;
}

.customer-detail-shell {
  display: grid;
  gap: 16px;
}

.customer-detail-hero,
.customer-main-card,
.customer-side-card {
  background: #fff;
  border: 1px solid #e8edf3;
}

.customer-detail-hero {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 132px;
  padding: 22px 26px;
}

.customer-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  color: #1683ff;
  background: #dff0ff;
  font-weight: 800;
}

.customer-identity span {
  color: var(--muted);
  font-size: 13px;
}

.customer-identity h2 {
  margin: 4px 0 18px;
  font-size: 22px;
}

.customer-identity p {
  margin: 0;
  color: var(--muted);
}

.customer-identity i {
  display: inline-block;
  width: 28px;
}

.customer-hero-actions,
.side-actions,
.section-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.customer-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .75fr);
  gap: 16px;
  align-items: start;
}

.customer-main-card,
.customer-side-card {
  min-width: 0;
  padding: 20px;
}

.detail-tabs {
  display: flex;
  gap: 0;
  margin: -20px -20px 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.detail-tabs button,
.field-group-tabs button,
.activity-tabs button {
  min-height: 44px;
  padding: 0 24px;
  border: 0;
  border-right: 1px solid #edf1f5;
  background: #fff;
  color: var(--muted);
  white-space: nowrap;
}

.detail-tabs button.active {
  color: #1683ff;
  border-bottom: 3px solid #1683ff;
  font-weight: 700;
}

.field-group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.field-group-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.field-group-tabs button.active {
  border-color: #1683ff;
  color: #1683ff;
}

.customer-info-table {
  border: 1px solid var(--line);
  border-bottom: 0;
}

.customer-info-table .detail-row {
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.customer-info-table .detail-row span {
  padding: 14px 18px;
  text-align: right;
  background: #fafafa;
}

.customer-info-table .detail-row strong {
  padding: 14px 18px;
  font-weight: 500;
}

.customer-side-card {
  display: grid;
  gap: 22px;
}

.side-block h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px;
  font-size: 15px;
}

.side-block h3::after {
  content: "";
  flex: 1;
  border-top: 1px dashed #b6c0cc;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 128px;
  color: #9aa4b2;
}

.activity-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.activity-tabs button.active {
  color: #1683ff;
  border-bottom: 2px solid #1683ff;
  font-weight: 700;
}

.contact-section {
  width: calc((100% - 16px) * .574);
}

.section-title-row {
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title-row h3 {
  margin: 0;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .side-main {
    padding: 16px;
  }

  .side-status {
    position: static;
    margin-top: 16px;
  }

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

  .metric-grid,
  .metric-grid.compact,
  .work-grid,
  .rule-grid,
  .customer-detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .drawer.customer-detail .drawer-panel {
    width: 100vw;
  }

  .customer-detail-hero {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .customer-hero-actions {
    grid-column: 1 / -1;
  }

  .contact-section {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav,
  .metric-grid,
  .metric-grid.compact,
  .work-grid,
  .rule-grid,
  .customer-detail-grid {
    grid-template-columns: 1fr;
  }

  .drawer.customer-detail .drawer-panel {
    padding: 58px 16px 24px;
  }

  .customer-detail-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .customer-info-table .detail-row {
    grid-template-columns: 1fr;
  }

  .customer-info-table .detail-row span {
    text-align: left;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .filter-label {
    justify-content: flex-start;
    min-height: 42px;
  }

  .floating-check {
    position: static;
    width: 100%;
    height: 44px;
    margin: 12px;
  }

  .funnel div {
    width: 100%;
    min-width: 0;
  }

}

/* ===== Customer Detail Two-Column Layout ===== */
.customer-detail-grid {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.customer-detail-left {
  flex: 0 0 62%;
  min-width: 0;
}

.customer-detail-right {
  flex: 1;
  min-width: 340px;
  position: sticky;
  top: 80px;
}

.customer-main-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

/* ===== Followup Timeline ===== */
.followup-timeline {
  padding: 4px 0;
}

.followup-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.followup-timeline-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.timeline-item {
  position: relative;
  padding: 14px 0 14px 32px;
  border-left: 2px solid var(--line);
}

.timeline-item:last-child {
  border-left-color: transparent;
}

.timeline-dot {
  position: absolute;
  left: -7px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--brand);
}

.timeline-dot.warm {
  background: var(--amber);
  box-shadow: 0 0 0 1px var(--amber);
}

.timeline-dot.hot {
  background: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}

.timeline-content {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 14px;
}

.timeline-content .tl-author {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.timeline-content .tl-author strong {
  color: var(--ink);
  font-weight: 600;
}

.timeline-content .tl-type {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.timeline-content .tl-text {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}

.timeline-content .tl-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

.followup-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

/* ===== Opportunity Progress Bar ===== */
.opportunity-progress {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}

.progress-bar-wrapper {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #14b8a6);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-bar-text {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 44px;
  text-align: right;
}

/* Kanban progress bar cards */
.kanban-progress-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 16px;
  margin-bottom: 8px;
}

.kanban-progress-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kanban-progress-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.kanban-progress-card .card-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
}

.kanban-progress-card .card-customer {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.kanban-progress-card .stage-indicator {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}

.kanban-progress-card .stage-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
  font-weight: 600;
  transition: all 0.3s;
}

.kanban-progress-card .stage-dot.completed {
  background: var(--brand);
}

.kanban-progress-card .stage-dot.current {
  background: var(--blue);
  box-shadow: 0 0 6px rgba(37, 99, 235, .3);
}

.kanban-progress-card .stage-label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}

/* ===== Checkbox Row Highlight ===== */
tr.row-selected {
  background: #e8f4fd !important;
  box-shadow: inset 3px 0 0 var(--blue);
}

tr.row-selected td:first-child {
  border-left: 3px solid var(--blue);
}

/* ===== Custom Fields Section in Settings ===== */
.field-editor {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
}

.field-editor h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink);
}

.custom-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.custom-field-row:last-child {
  border-bottom: none;
}

.custom-field-row .field-info {
  flex: 1;
}

.custom-field-row .field-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.custom-field-row .field-meta {
  font-size: 11px;
  color: var(--muted);
}

.add-field-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.add-field-row input,
.add-field-row select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
}

.add-field-row input {
  flex: 1;
  min-width: 100px;
}

.add-field-row select {
  min-width: 80px;
}

/* ===== Lead Pool Tab ===== */
.lead-pool-table .pool-lead-mobile {
  font-family: monospace;
  color: var(--muted);
}

/* Responsive for customer detail */
@media (max-width: 900px) {
  .customer-detail-grid {
    flex-direction: column;
  }
  .customer-detail-left,
  .customer-detail-right {
    flex: 1 1 auto;
    min-width: 0;
  }
  .customer-detail-right {
    position: static;
  }
}

/* ===== Nav Groups (折叠导航) ===== */
.nav-group {
  margin-bottom: 4px;
}
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.nav-group-header:hover { background: rgba(0,0,0,0.04); color: var(--ink); }
.nav-group-header.active { color: var(--brand); }
.nav-group-icon { font-size: 14px; width: 20px; text-align: center; }
.nav-arrow { margin-left: auto; font-size: 11px; transition: transform 0.2s; }
.nav-group-header.active .nav-arrow { transform: rotate(180deg); }
.nav-group-items { 
  display: none; 
  padding-left: 20px;
  overflow: hidden;
}
.nav-group-items.open { display: block; }
.nav-group-items .nav-item {
  padding: 7px 14px 7px 30px;
  font-size: 13px;
  border-radius: 4px;
  margin: 1px 0;
}
.nav-standalone { margin-top: 8px; }

/* ===== More Actions Dropdown (更多操作下拉) ===== */
.more-actions-dropdown {
  position: relative;
  display: inline-block;
}
.more-actions-btn {
  background: #f8f9fa;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
}
.more-actions-btn:hover { background: #e9ecef; }
.more-actions-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
  padding: 5px 0;
  animation: fadeInDown 0.15s ease;
}
.more-actions-menu.show { display: block; }
.more-actions-menu button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.more-actions-menu button:hover { background: rgba(15,118,110,0.08); color: var(--brand); }
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Attachments in Followups (跟进附件显示) ===== */
.followup-attachments {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #f0f4f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  max-width: 200px;
  overflow: hidden;
  transition: all 0.15s;
}
.attachment-item:hover { border-color: var(--brand); background: #eaf6f4; }
.attachment-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.attachment-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--blue);
}
.attachment-size { color: var(--muted); flex-shrink: 0; }

/* Image preview modal */
.image-preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
}
.image-preview-overlay.show { display: flex; }
.image-preview-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}
.image-preview-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
}

/* ===== Collaborator Tags (协作人标签) =====*/
.collaborator-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.collaborator-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 10px;
  font-size: 11px;
  color: #2e7d32;
}
.collaborator-tag .remove-collab {
  cursor: pointer;
  font-weight: bold;
  opacity: 0.6;
}
.collaborator-tag .remove-collab:hover { opacity: 1; }

/* Detail right panel tabs (跟进记录 / 操作记录) */
.detail-right-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.detail-tab {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.detail-tab:hover { color: var(--brand); }
.detail-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}
.detail-tab-content { display: none; }
.detail-tab-content.active { display: block; }

/* Operation log timeline */
.operation-log-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.operation-timeline .timeline-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
}
.operation-timeline .timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
  margin-top: 7px;
}

/* ===== Column Sort Modal (列排序模态框) ===== */
.column-sort-modal {
  display: grid;
  gap: 2px;
  padding: 8px 0;
}
.column-sort-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.column-sort-item .sort-name {
  flex: 1;
  font-size: 13px;
}
.column-sort-item button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  display: grid;
  place-items: center;
}
.column-sort-item button:hover:not(:disabled) {
  background: #eef6ff;
  border-color: #1683ff;
  color: #0877ff;
}
.column-sort-item button:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ===== Target Management (目标管理) ===== */
.target-tab-content {
  display: none;
}
.target-tab-content.active {
  display: block;
}
.target-progress-bar {
  height: 8px;
  background: #e3e8ef;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 4px;
}
.target-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #14b8a6);
  transition: width 0.5s;
}
.target-switch {
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  cursor: pointer;
  font-size: 12px;
}
.target-switch.active {
  background: #e6f5f2;
  border-color: var(--brand);
  color: var(--brand-strong);
}

/* Target tab content */
.target-tab-content { display: none; }
.target-tab-content.active { display: block; }

/* Column sort modal */
.column-sort-modal { padding: 4px 0; }
.column-sort-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.column-sort-item:hover { background: var(--hover); }
.column-sort-item .sort-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}
.column-sort-item button.col-move-up,
.column-sort-item button.col-move-down {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.column-sort-item button.col-move-up:hover,
.column-sort-item button.col-move-down:hover {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand);
}
.column-sort-item button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ==================== Settings Layout ==================== */
.settings-layout {
  display: flex;
  gap: 16px;
  min-height: 600px;
}
.settings-sidebar {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.settings-nav {
  padding: 10px 16px;
  border: none;
  background: none;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.15s;
}
.settings-nav:hover {
  background: var(--hover);
}
.settings-nav.active {
  background: var(--brand);
  color: #fff;
}
.settings-content {
  flex: 1;
  min-width: 0;
}
.settings-panel {
  display: none;
}
.settings-panel.active {
  display: block;
}
.settings-panel .panel {
  margin-bottom: 16px;
}

/* ==================== New Settings Layout (探迹CRM风格) ==================== */
.settings-layout-new {
  display: flex;
  gap: 0;
  min-height: 700px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.settings-sidebar-new {
  width: 200px;
  flex-shrink: 0;
  background: #f8faf9;
  border-right: 1px solid var(--line);
  padding: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-group-title {
  padding: 14px 16px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.settings-nav-new {
  padding: 10px 20px 10px 24px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: all 0.15s;
  position: relative;
  border-left: 3px solid transparent;
}
.settings-nav-new:hover { background: #eef5f3; }
.settings-nav-new.active {
  background: #fff;
  color: var(--brand);
  font-weight: 600;
  border-left-color: var(--brand);
}
.settings-main-new {
  flex: 1;
  min-width: 0;
  background: #fff;
  padding: 24px 28px;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}
.settings-panel-new { display: none; }
.settings-panel-new.active { display: block; }

/* Panel Tabs (字段设置/掉保规则 etc) */
.panel-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e8ecf1;
  margin-bottom: 16px;
}
.panel-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.panel-tab:hover { color: var(--brand); }
.panel-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* Field Settings Tip - 使用智鸥CRM品牌色 */
.field-settings-tip {
  background: linear-gradient(135deg, #f0faf8 0%, #e6f5f2 100%);
  border: 1px solid #b7e4dc;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.8;
}
.field-settings-tip p { margin: 0; }
.field-settings-tip p + p { margin-top: 4px; }

/* Field Settings Toolbar */
.field-settings-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.field-search-bar {
  position: relative;
  width: 280px;
}
.field-search-bar input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.field-search-bar input:focus { border-color: var(--brand); }
.search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 14px;
}

/* Field Table - 智鸥CRM风格 */
.field-table { width: 100%; border-collapse: collapse; }
.field-table th {
  background: #f4f6f5;
  padding: 11px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 2px solid var(--line);
}
.field-table td {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f0f2f1;
  vertical-align: middle;
}
.field-table tr:hover td { background: #fafbfa; }

/* Sort Buttons (字段排序) */
.sort-btns {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
.sort-btns .link-btn {
  padding: 2px 6px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  min-height: auto !important;
  border: none !important;
  background: transparent !important;
}
.sort-btns .link-btn:hover:not(:disabled) {
  color: var(--brand) !important;
  background: rgba(15,118,110,0.08) !important;
}

/* Dynamic Modal Overlay (用于新增/编辑字段的弹窗) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-overlay .modal-content {
  width: min(100%, 560px);
  max-height: 85vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
}
.modal-close:hover { background: #f0f2f1; color: var(--ink); }
.modal-body { flex: 1; overflow-y: auto; }
.modal-footer { flex-shrink: 0; }

/* Secondary Button */
.secondary-button {
  min-height: 38px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.secondary-button:hover {
  background: #f4f6f5;
  border-color: #d8ddd9;
}

/* Form Elements in Modals */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
  font-family: inherit;
}
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,0.1); }

/* Panel Heading */
.panel-heading {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 20px 0;
  color: var(--ink);
}
.sub-panel-heading {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 10px;
  color: var(--ink);
}

/* Pool Rule Sections - 智鸥CRM风格 */
.pool-rule-section {
  border-bottom: 1px solid #eef1f0;
  padding: 14px 0;
}
.pool-rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.pool-rule-title {
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
}
.pool-rule-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}
.link-btn:hover { background: #e6f5f2; }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--brand); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-switch-lg { position: relative; display: inline-block; width: 46px; height: 26px; }
.toggle-switch-lg .toggle-slider { border-radius: 26px; }
.toggle-switch-lg .toggle-slider::before { height: 22px; width: 22px; }
.toggle-switch-lg input:checked + .toggle-slider::before { transform: translateX(20px); }

.pool-rule-list {
  list-style: none;
  padding: 0;
  margin: 0;
  padding-left: 8px;
}
.pool-rule-list li {
  font-size: 13px;
  color: #4a5568;
  padding: 4px 0;
  line-height: 1.6;
}
.pool-rule-list li strong {
  color: var(--brand);
  font-weight: 600;
}

/* Dup Check Styles - 智鸥CRM风格 */
.dup-tip {
  background: linear-gradient(135deg, #f0faf8 0%, #e6f5f2 100%);
  border: 1px solid #b7e4dc;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--ink);
}
.dup-tip p { margin: 0; }
.dup-panel { display: none; }
.dup-panel.active { display: block; padding: 4px 0; }
.dup-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 14px;
}
.dup-field-section {
  background: #f8faf9;
  border: 1px solid #eef1f0;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 10px;
}
.dup-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.dup-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.dup-field-value {
  font-size: 13px;
  color: #666;
  padding-left: 8px;
}

/* Drag-and-Drop Field Sorting */
.field-drag-row {
  cursor: grab;
  transition: background 0.15s, opacity 0.15s;
}
.field-drag-row:hover {
  background: rgba(99, 102, 241, 0.04);
}
.field-drag-row.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.field-drag-row.drag-over-top {
  border-top: 2px solid var(--brand, #6366f1);
  background: rgba(99, 102, 241, 0.06);
}
.field-drag-row.drag-over-bottom {
  border-bottom: 2px solid var(--brand, #6366f1);
  background: rgba(99, 102, 241, 0.06);
}
.field-drag-row .drag-handle {
  font-size: 14px;
  color: #aaa;
  user-select: none;
  vertical-align: middle;
}
.field-drag-row .drag-handle:hover {
  color: var(--brand, #6366f1);
}
.sort-btns {
  display: inline-flex;
  gap: 2px;
}

/* Rule Grid New */
.rule-grid-new {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
  align-items: start;
}
.rule-item label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.rule-item input[type="number"],
.rule-item select {
  width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}
.rule-item textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}
.rule-item .unit {
  color: var(--muted);
  font-size: 13px;
  margin-left: 4px;
}
.rule-item.full-width { grid-column: 1 / -1; }
.rule-save-bar {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Rule Grid - clean 2-column layout for settings */
.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px;
  align-items: center;
}
.rule-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.rule-grid label > input[type="number"],
.rule-grid label > select {
  width: 80px;
  flex-shrink: 0;
}
.rule-grid textarea {
  width: 100%;
  min-height: 60px;
}
.panel-sub-head {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* ==================== Kanban Board ==================== */
.kanban-board {
  padding: 0;
}
.kanban-columns {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: 500px;
}
.kanban-column {
  flex: 1;
  min-width: 240px;
  max-width: 320px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}
.kanban-column-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kanban-column-title {
  font-weight: 600;
  font-size: 14px;
}
.kanban-column-count {
  background: var(--brand-light);
  color: var(--brand);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.kanban-column-amount {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.kanban-column-body {
  padding: 8px;
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
  transition: background 0.15s;
}
.kanban-column-body.drag-over {
  background: var(--brand-light);
  border: 2px dashed var(--brand);
  border-radius: 6px;
}
.kanban-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.kanban-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  border-color: var(--brand-light, #c7d2fe);
}
.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}
.kanban-card-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text);
}
.kanban-card-customer {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-card-amount {
  font-weight: 600;
  font-size: 13px;
  color: var(--brand);
}
.kanban-card-owner {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
}
.kanban-empty {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px 0;
}

/* ==================== Statistics ==================== */
#statistics .metric-grid {
  gap: 12px;
}
#statistics .metric {
  min-width: 140px;
}
#statistics table th[data-stat-sort] {
  user-select: none;
  white-space: nowrap;
}
#statistics table th[data-stat-sort]:hover {
  color: var(--brand);
}

/* ==================== Tag Management ==================== */
.tag-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
}

/* ==================== Opportunity View Switch ==================== */
.view-switch {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}
.view-switch button {
  padding: 6px 20px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all 0.15s;
}
.view-switch button.active {
  background: var(--brand);
  color: #fff;
}

/* ==================== Pool View Checkbox ==================== */
#poolview .table-wrap table td small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ==================== Checkbox Row Count Update ==================== */
.result-count b {
  color: var(--brand);
  font-weight: 600;
}

/* =================== Drag & Drop Column Sort =================== */
.column-sort-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.column-sort-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: grab;
  user-select: none;
}
.column-sort-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.column-sort-item.drag-over {
  border-top: 3px solid var(--brand);
}
.drag-handle {
  cursor: grab;
  font-size: 16px;
  color: var(--muted);
}
.drag-handle:hover {
  color: var(--brand);
}
.sort-name {
  flex: 1;
}

/* =================== Notification Button =================== */
.notif-button { position: relative; font-size: 18px; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red, #e74c3c);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 600;
}
.notif-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notif-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e0e0e0);
}
.notif-dropdown-list {
  overflow-y: auto;
  max-height: 420px;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #eee);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: var(--bg-hover, #f5f5f5); }
.notif-item.unread { background: rgba(var(--brand-rgb, 64,158,255), 0.06); }
.notif-item.unread::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red, #e74c3c);
  margin-right: 6px;
  vertical-align: middle;
}
.notif-item-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-item-content { font-size: 12px; color: var(--muted, #888); }
.notif-item-time { font-size: 11px; color: var(--muted, #aaa); margin-top: 4px; }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--muted, #aaa); font-size: 13px; }

/* =================== Todo Section =================== */
.todo-section {
  margin-top: 16px;
}
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  font-size: 13px;
}
.todo-item.completed { opacity: 0.5; text-decoration: line-through; }
.todo-item .todo-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brand, #409eff);
}
.todo-item .todo-title { flex: 1; }
.todo-item .todo-remind {
  font-size: 11px;
  color: var(--muted, #888);
  white-space: nowrap;
}
.todo-item .todo-remind.overdue { color: var(--red, #e74c3c); font-weight: 600; }
.todo-item .todo-delete {
  background: none;
  border: none;
  color: var(--muted, #aaa);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}
.todo-item .todo-delete:hover { color: var(--red, #e74c3c); }
.todo-empty { padding: 16px; text-align: center; color: var(--muted, #aaa); font-size: 13px; }

/* =================== Todo Reminder Lists (Dashboard) =================== */
.todo-reminder-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.todo-reminder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}
.todo-reminder-item.completed { opacity: 0.5; text-decoration: line-through; }
.todo-reminder-item.urgent { border-left: 3px solid var(--red); background: var(--red-soft); }
.todo-reminder-item .todo-reminder-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 60px;
}
.todo-reminder-item .todo-reminder-time.overdue { color: var(--red); font-weight: 600; }
.todo-reminder-item .todo-reminder-title { flex: 1; min-width: 0; }
.todo-reminder-item .todo-reminder-customer {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.todo-reminder-empty { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; }

/* =================== Persistent Reminder Overlay =================== */
.reminder-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}
.reminder-panel {
  width: min(100%, 520px);
  max-height: 80vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  animation: reminderSlideIn 0.3s ease;
}
@keyframes reminderSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.reminder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.reminder-header h2 { margin: 0; font-size: 18px; }
.reminder-close { float: none; width: 32px; height: 32px; font-size: 20px; }
.reminder-body { padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.reminder-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.reminder-item.urgent { border-left: 3px solid var(--red); background: var(--red-soft); }
.reminder-item-icon { font-size: 20px; flex-shrink: 0; }
.reminder-item-content { flex: 1; min-width: 0; }
.reminder-item-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.reminder-item-meta { font-size: 12px; color: var(--muted); }
.reminder-item-meta .overdue { color: var(--red); font-weight: 600; }
.reminder-actions { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* =================== Voice Input Button =================== */
.voice-input-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  transition: all 0.2s;
}
.voice-input-btn:hover { border-color: var(--brand); color: var(--brand); }
.voice-input-btn.recording {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== File Upload Area (跟进附件) ===== */
.file-upload-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.file-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 16px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 80px;
}

.file-upload-area:hover {
  border-color: var(--brand);
  background: #eaf6f4;
}

.file-upload-area:active {
  background: #d4ede9;
}

.file-upload-icon {
  font-size: 28px;
  opacity: 0.6;
  line-height: 1;
}

.file-upload-text {
  font-size: 13px;
  color: var(--brand);
  font-weight: 500;
}

.file-upload-hint {
  font-size: 11px;
  color: var(--muted);
}

.file-upload-hidden {
  display: none;
}

/* File list after selection */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 12px;
}

.file-item-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.file-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.file-item-size {
  color: var(--muted);
  flex-shrink: 0;
}

.file-item-remove {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-item-remove:hover {
  background: var(--red-soft);
  color: var(--red);
}
.voice-input-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ===== Dashboard Panel Toggle ===== */
.panel-toggle-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.panel-toggle-btn:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* ===== Leaderboard ===== */
#leaderboardRows tr td:first-child {
  text-align: center;
  font-weight: 700;
}

#leaderboardRows tr:hover {
  background: #f8fafc;
}

/* =================== Duplicate Check Modal =================== */
.duplicate-check-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.duplicate-match-card {
  padding: 12px 14px;
  border: 1px solid var(--amber-soft, #f3d38b);
  border-radius: 8px;
  background: var(--amber-soft);
}
.duplicate-match-card strong { font-size: 14px; }
.duplicate-match-card .dup-info { display: flex; gap: 16px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.duplicate-match-card .dup-info span { display: inline-flex; align-items: center; gap: 4px; }

/* =================== User Batch Operations =================== */
.user-batch-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

/* =================== Role Permission Edit =================== */
.role-edit-grid { overflow-x: auto; }
.role-edit-grid table { min-width: 600px; }
.role-edit-grid th, .role-edit-grid td { text-align: center; padding: 8px 6px; }
.role-edit-grid .perm-checkbox { width: 18px; height: 18px; cursor: pointer; }
.role-edit-grid .role-name-cell { text-align: left; }
.data-scope-select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.role-save-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* =================== Contract Approval Flow =================== */
.contract-approval-flow {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.approval-step {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}
.approval-step.completed { background: var(--green-soft); color: var(--brand-strong); }
.approval-step.current { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.approval-step.pending { background: var(--bg); color: var(--muted); }
.approval-arrow { color: var(--muted); font-size: 10px; }

/* ==================== Sign-in Management (签到管理) ==================== */

.signin-action-bar {
  display: flex;
  justify-content: center;
  padding: 16px 0;
  margin-bottom: 8px;
}

.signin-btn-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 48px;
  font-size: 16px;
  border-radius: 12px;
  min-width: 240px;
  position: relative;
}

.signin-btn-large .signin-icon {
  font-size: 28px;
}

.signin-btn-large .signin-text {
  font-weight: 600;
  font-size: 18px;
}

.signin-btn-large small {
  font-size: 11px;
  opacity: 0.8;
  font-weight: normal;
}

.signin-location-section {
  margin-bottom: 12px;
}

.signin-location-display {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 48px;
  display: flex;
  align-items: center;
}

.signin-location-display .location-placeholder {
  color: var(--muted);
  font-size: 13px;
}

.signin-location-display .location-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.signin-location-display .location-info strong {
  font-size: 14px;
  color: var(--ink);
}

.signin-location-display .location-info small {
  font-size: 11px;
  color: var(--muted);
}

.signin-photo-section {
  margin-bottom: 12px;
}

.signin-photo-area {
  border: 2px dashed var(--line);
  border-radius: 8px;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

.signin-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
}

.signin-photo-placeholder span {
  font-size: 14px;
}

.signin-photo-placeholder small {
  font-size: 11px;
}

#signinPhotoPreview {
  max-width: 100%;
  max-height: 320px;
  border-radius: 6px;
  object-fit: contain;
}

.signin-photo-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.signin-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: transform 0.15s;
}

.signin-thumb:hover {
  transform: scale(1.1);
}

/* Mobile responsive for checkin */
@media (max-width: 768px) {
  .signin-btn-large {
    width: 100%;
    min-width: unset;
    padding: 20px;
  }

  .signin-photo-area {
    min-height: 200px;
  }

  #signinPhotoPreview {
    max-height: 400px;
  }

  .signin-photo-actions {
    flex-wrap: wrap;
  }

  .signin-photo-actions button {
    flex: 1;
    min-width: 80px;
  }
}

/* Mobile app adaptation - checkin modal full screen on mobile */
@media (max-width: 600px) {
  #modal:has(.signin-photo-section) .modal-content {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    overflow-y: auto;
  }
}
