/* 视图样式：客户目录 / 管理后台 / 设置页。
   仅使用 tokens.css 的变量，复用 base/components/layout 的通用类，不新增配色。 */

/* ==================== 通用小工具 ==================== */
.text-danger { color: var(--danger); }
.danger-text { color: var(--danger); }
.break-all { word-break: break-all; }
.ml-2 { margin-left: var(--space-2); }
.nowrap { white-space: nowrap; }
.desktop-only-inline { display: inline; }
.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}
.status-inline .dot { width: 7px; height: 7px; }
.chip svg { width: 12px; height: 12px; }
.chip.mini {
  height: 18px;
  padding: 0 6px;
  font-size: 10.5px;
  gap: 2px;
}
.chip .chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 1px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.62;
  cursor: pointer;
}
.chip .chip-x:hover { opacity: 1; }
.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  flex: none;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border), inset 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent);
  transition: box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }

/* ==================== 客户目录 ==================== */
.page-view.contacts-page {
  overflow: hidden;
  display: flex;
  min-height: 0;
}

.contacts-list {
  width: 352px;
  flex: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.contacts-list-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.contacts-list-head h1 { font-size: 20px; letter-spacing: -0.02em; }
.contacts-list-head .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.contacts-scopes {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.contacts-scopes::-webkit-scrollbar { height: 0; }
.scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.scope-pill:hover { background: var(--border); }
.scope-pill.active { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
.scope-pill .scope-count { font-size: 11px; opacity: 0.68; }
.scope-pill.active .scope-count { opacity: 0.9; }
.contacts-sorts { display: flex; gap: 2px; }
.contacts-tagbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 2px;
}
.contacts-tagbar .contact-tag { font-size: 11.5px; gap: 5px; }
.contacts-tagbar .contact-tag.active { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }

.contacts-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}
.contacts-list-foot {
  flex: none;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 11.5px;
}
.contact-item {
  width: 100%;
  text-align: left;
  align-items: center;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
}
.contact-item .ci-body { gap: 3px; }
.contact-item .ci-top { gap: 5px; }
.contact-item .ci-top svg { width: 12px; height: 12px; color: var(--text-3); flex: none; }
.contact-item .ci-name { min-width: 0; }
.contact-item .ci-bottom { min-width: 0; gap: 4px; }
.contact-item .ci-preview { flex: 1 1 auto; min-width: 0; }
.contact-item .ci-flags { display: flex; align-items: center; gap: 4px; flex: none; }
.contact-item .ci-flags svg { width: 12px; height: 12px; color: var(--text-3); }
.contact-skeleton {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 10px;
}
.contact-skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.contact-skeleton-body { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.contacts-empty { padding: 34px 22px; }
.contacts-list-scroll .contacts-empty { min-height: 100%; }

.contacts-detail {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
}
.contacts-detail-doc {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}
.contacts-detail-empty { min-height: 68vh; }
.contacts-detail-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.contacts-detail-head h2 { font-size: 22px; letter-spacing: -0.02em; word-break: break-word; }
.contacts-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.contacts-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.contacts-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    'icon value'
    'icon label';
  column-gap: 11px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.contacts-stat-icon {
  grid-area: icon;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-700);
  display: grid;
  place-items: center;
}
.contacts-stat-value { grid-area: value; font-size: 19px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.contacts-stat-label { grid-area: label; font-size: 11.5px; color: var(--text-3); }

.contacts-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: start;
}
.contacts-card { overflow: hidden; }
.contacts-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}
.contacts-card-head h3 { font-size: 14px; }
.contacts-card-head svg { color: var(--text-3); }
.contacts-info { padding: 6px 18px 14px; }
.contacts-info-row {
  display: flex;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.contacts-info-row:last-child { border-bottom: 0; }
.contacts-info-label { flex: none; width: 88px; color: var(--text-3); font-size: 12.5px; }
.contacts-info-value { flex: 1; min-width: 0; color: var(--text); word-break: break-word; }
.contacts-tag-editor { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.contacts-tag-input { align-items: stretch; }
.contacts-tag-input .input { min-height: 36px; height: 36px; flex: 1; }
.contacts-tag-input .btn { flex: none; height: 36px; }
.contacts-note-editor { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.contacts-note-editor textarea { min-height: 96px; }
.contacts-color-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 18px; }
.contacts-op-list { padding: 6px; }
.contacts-op {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  text-align: left;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.contacts-op svg { color: var(--text-3); flex: none; }
.contacts-op:hover { background: var(--surface-3); color: var(--text); }
.contacts-op.danger { color: var(--danger); }
.contacts-op.danger svg { color: var(--danger); }
.contacts-op.danger:hover { background: var(--danger-soft); }

.contacts-media-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 14px 0;
}
.contacts-media-filter .list-filter { height: 26px; font-size: 12px; }
.contacts-media-body { padding: 12px 18px 18px; }
.contacts-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.contacts-media-item {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.contacts-media-item:hover { border-color: var(--brand); box-shadow: var(--shadow-1); }
.contacts-media-item.image { padding: 0; }
.contacts-media-item.image img { width: 100%; height: 100%; object-fit: cover; }
.contacts-media-time {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  background: color-mix(in srgb, var(--text) 64%, transparent);
  color: var(--bg);
}
.contacts-media-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.contacts-media-name { max-width: 100%; font-size: 11px; color: var(--text-2); }
.contacts-media-meta { font-size: 10.5px; color: var(--text-3); }
.contacts-media-hint { padding: 20px 0; text-align: center; font-size: 13px; color: var(--text-3); }
.contacts-media-more { width: 100%; margin-top: 12px; }
.media-preview { display: flex; align-items: center; justify-content: center; }
.media-preview img, .media-preview video { max-width: 100%; max-height: 62vh; border-radius: var(--radius); }
.media-preview-file { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px; color: var(--text-2); }

/* ==================== 管理后台 ==================== */
.page-view.admin-page {
  overflow: hidden;
  display: flex;
  min-height: 0;
}
.admin-layout {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}
.admin-side {
  width: 228px;
  flex: none;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.admin-side-head { padding: 0 8px 12px; }
.admin-side-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 650;
}
.admin-side-badge svg { color: var(--brand); }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.admin-nav-item svg { color: var(--text-3); flex: none; transition: color var(--speed) var(--ease); }
.admin-nav-item:hover { background: var(--surface-3); color: var(--text); }
.admin-nav-item.active { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
.admin-nav-item.active svg { color: var(--brand-700); }
.admin-side-foot { margin-top: auto; padding: 14px 8px 0; color: var(--text-3); font-size: 11px; }
.admin-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.admin-main-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 28px 14px;
}
.admin-main-head h1 { font-size: 22px; letter-spacing: -0.02em; }
.admin-main-head .sub { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.admin-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 28px 48px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.admin-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
}
.admin-stat-icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-700);
  display: grid;
  place-items: center;
}
.admin-stat-value { font-size: 20px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; word-break: break-word; }
.admin-stat-label { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.admin-stat-sub {
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-3);
}

.admin-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}
.admin-side-cards { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.admin-panel { overflow: hidden; }
.admin-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.admin-card-head h3 { font-size: 14px; }
.admin-card-head svg { color: var(--text-3); flex: none; }
.admin-card-head .right { margin-left: auto; }
.admin-chart-card .admin-card-head { border-bottom: 0; padding-bottom: 4px; }
.admin-legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-3); flex: none; }
.admin-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend-dot.in { background: var(--brand); }
.legend-dot.out { background: var(--info); }
.admin-chart-scroll { overflow-x: auto; padding: 2px 12px 0; }
.admin-chart { display: block; width: 100%; min-width: 520px; height: auto; }
.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; }
.chart-axis { fill: var(--text-3); font-size: 10px; font-family: var(--font-sans); }
.chart-bar.in { fill: var(--brand); }
.chart-bar.out { fill: var(--info); }
.chart-bar { opacity: 0.92; transition: opacity var(--speed) var(--ease); }
.chart-bar:hover { opacity: 1; }
.chart-day { fill: var(--text-3); font-size: 10.5px; font-family: var(--font-sans); }
.chart-day.today { fill: var(--brand-700); font-weight: 700; }
.chart-zero { fill: var(--text-3); font-size: 9px; opacity: 0.55; font-family: var(--font-sans); }
.admin-chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px 14px;
  font-size: 12px;
  color: var(--text-3);
}
.admin-chart-foot strong { color: var(--text); font-weight: 650; }

.admin-channel-list { padding: 6px 8px 8px; }
.admin-channel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
}
.admin-channel-row:hover { background: var(--surface-2); }
.admin-channel-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.admin-channel-icon.sm { width: 28px; height: 28px; border-radius: 8px; }
.admin-kv-list { padding: 8px 18px 14px; }
.admin-kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.admin-kv-row:last-child { border-bottom: 0; }
.admin-kv-row .strong { text-align: right; word-break: break-word; }
.admin-panel-actions { display: flex; gap: 8px; padding: 0 18px 16px; }
.admin-panel-empty { padding: 18px; }
.admin-memory { display: flex; flex-direction: column; gap: 6px; padding: 11px 0; }
.admin-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
}
.admin-quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
  text-align: left;
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.admin-quick-item svg { color: var(--brand); flex: none; }
.admin-quick-item:hover { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-700); }
.admin-quick { margin-bottom: 8px; }

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.admin-toolbar-search { width: 260px; flex: none; }
.admin-toolbar-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.admin-toolbar-search input { width: 100%; height: 36px; padding: 0 12px 0 32px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); }
.admin-toolbar-search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.admin-filter { display: inline-flex; align-items: center; gap: 8px; }
.admin-filter-select { width: 190px; min-height: 36px; padding: 6px 10px; }

.admin-table-card { overflow: hidden; }
.admin-table { min-width: 760px; }
.admin-table.admin-audit-table { min-width: 880px; }
.admin-table th.num, .admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.admin-table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.admin-table .icon-btn.danger { color: var(--danger); }
.admin-table .icon-btn.danger:hover { background: var(--danger-soft); }
.admin-table .icon-btn:disabled { opacity: 0.35; }
.admin-table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}
.admin-self-chip { margin-left: 6px; height: 18px; font-size: 10.5px; }
.admin-user-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.audit-action { background: var(--surface-3); color: var(--text-2); }
.audit-action.danger { background: var(--danger-soft); color: var(--danger); }
.audit-detail-cell { max-width: 320px; }
.audit-detail {
  display: inline-block;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11.5px;
}
.admin-sys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.admin-sys-backups { margin-bottom: 24px; }
.admin-empty { padding: 44px 20px; }
.admin-user-preview { padding-bottom: 4px; }
.admin-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.admin-skeleton-card { height: 92px; border-radius: var(--radius-lg); }
.admin-skeleton-block { height: 260px; border-radius: var(--radius-lg); margin-bottom: 16px; }
.admin-skeleton-block.short { height: 150px; }

/* ==================== 设置页 ==================== */
.settings-layout {
  display: grid;
  grid-template-columns: 204px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.settings-toc {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.settings-toc-title {
  padding: 6px 10px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
.settings-toc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.settings-toc-item svg { color: var(--text-3); flex: none; }
.settings-toc-item:hover { background: var(--surface-3); color: var(--text); }
.settings-toc-item.active { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
.settings-toc-item.active svg { color: var(--brand-700); }
.settings-toc-foot {
  margin-top: 8px;
  padding: 8px 10px 2px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}
.settings-sections { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings-card { overflow: hidden; scroll-margin-top: 16px; }
.settings-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.settings-card-head h2 { font-size: 16px; }
.settings-card-icon {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-700);
  display: grid;
  place-items: center;
}
.settings-card-body { padding: 20px; }
.settings-profile { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.settings-profile h3 { font-size: 17px; }
.settings-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.settings-kv { display: flex; flex-direction: column; gap: 3px; padding: 11px 14px; background: var(--surface); min-width: 0; }
.settings-kv-label { font-size: 11.5px; color: var(--text-3); }
.settings-kv-value { font-size: 13.5px; color: var(--text); word-break: break-word; }

.settings-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.settings-block:first-child { padding-top: 0; border-top: 0; }
.settings-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.settings-block-head h3 { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.settings-block-head h3 svg { color: var(--text-3); }
.settings-block-head .muted { margin-left: auto; }
.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.settings-form-grid .field-full { grid-column: 1 / -1; }
.settings-retention-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.settings-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
}
.settings-color-input {
  width: 46px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.settings-color-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.settings-toggle-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.settings-toggle:first-child { border-top: 0; }
.settings-toggle:hover { background: var(--surface-2); }
.settings-toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-toggle-text .strong { font-size: 13.5px; }
.settings-toggle-text .muted { font-size: 12.5px; }
.settings-push {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.settings-push-state { display: flex; align-items: center; gap: 12px; }
.settings-push-icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.settings-theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: left;
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.theme-card:hover { border-color: var(--border-2); }
.theme-card-icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.theme-card-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.theme-card-text .muted { font-size: 12px; }
.theme-card-check { display: flex; align-items: center; color: var(--text-3); flex: none; }
.theme-card.active { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 1px var(--brand); }
.theme-card.active .theme-card-icon { background: var(--brand-soft); color: var(--brand-700); border-color: transparent; }
.theme-card.active .theme-card-check { color: var(--brand); }
.theme-card-dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border-2); display: block; }

.settings-totp-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.settings-steps {
  list-style: decimal;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
}
.settings-totp-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.settings-totp-qr {
  width: 168px;
  height: 168px;
  flex: none;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
}
.settings-totp-qr svg { width: 100%; height: 100%; }
.settings-totp-noqr { text-align: center; line-height: 1.6; }
.settings-secret {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface-3);
  font-size: 12.5px;
  word-break: break-all;
}
.settings-code-input {
  max-width: 190px;
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 0.18em;
  text-align: center;
}
.settings-totp-enabled .settings-totp-badge {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  background: var(--success-soft);
  color: var(--success);
  display: grid;
  place-items: center;
}
.settings-session-list { display: flex; flex-direction: column; gap: 8px; }
.settings-session {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.settings-session-icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--surface-3);
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.settings-health {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.settings-health-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 8px; }
.settings-about { display: flex; align-items: center; gap: 14px; }
.settings-about-brand {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand-700);
  display: grid;
  place-items: center;
}
.settings-page .loading-row { padding: 14px; }

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
  .admin-overview-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-sys-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (max-width: 1100px) {
  .contacts-list { width: 304px; }
  .contacts-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .contacts-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout { grid-template-columns: 176px minmax(0, 1fr); gap: 18px; }
  .settings-theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .admin-side { width: 196px; }
  .admin-main-head { padding: 18px 20px 12px; }
  .admin-content { padding: 4px 20px 40px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .settings-toc {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 8px;
  }
  .settings-toc::-webkit-scrollbar { height: 0; }
  .settings-toc-title, .settings-toc-foot { display: none; }
  .settings-toc-item { flex: none; height: 32px; width: auto; padding: 0 12px; white-space: nowrap; }
}

@media (max-width: 760px) {
  .desktop-only-inline { display: none !important; }

  /* 客户目录：列表全宽，详情抽屉式覆盖 */
  .contacts-page { position: relative; }
  .contacts-list { width: 100%; border-right: 0; }
  .contacts-list-head { padding: 14px 14px 10px; }
  .contacts-detail {
    position: absolute;
    inset: 0;
    z-index: 12;
    transform: translateX(100%);
    transition: transform 240ms var(--ease);
    background: var(--bg);
    box-shadow: var(--shadow-3);
  }
  .contacts-page.detail-open .contacts-detail { transform: none; }
  .contacts-detail-doc { padding: 14px 14px 92px; }
  .contacts-detail-head { flex-wrap: wrap; gap: 12px; }
  .contacts-detail-head h2 { font-size: 19px; }
  .contacts-head-actions { width: 100%; margin-left: 0; }
  .contacts-head-actions .btn { flex: 1; }
  .contacts-info-row { flex-direction: column; gap: 2px; }
  .contacts-media-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .contacts-list-foot { padding-bottom: 10px; }

  /* 管理后台：顶部横向标签 + 单列内容 */
  .admin-layout { flex-direction: column; }
  .admin-side {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .admin-side::-webkit-scrollbar { height: 0; }
  .admin-side-head, .admin-side-foot { display: none; }
  .admin-nav { flex-direction: row; gap: 2px; }
  .admin-nav-item { flex: none; width: auto; height: 34px; padding: 0 12px; }
  .admin-main-head { padding: 14px 14px 10px; }
  .admin-main-head h1 { font-size: 20px; }
  .admin-content { padding: 0 14px 92px; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .admin-stat { padding: 12px; gap: 10px; }
  .admin-stat-value { font-size: 18px; }
  .admin-side-cards { gap: 12px; }
  .admin-toolbar-search { width: 100%; flex: 1 1 100%; }
  .admin-filter { width: 100%; }
  .admin-filter-select { flex: 1; width: auto; }
  .admin-table { min-width: 720px; }
  .admin-empty { padding: 32px 16px; }
  .admin-stats .admin-stat-sub { font-size: 11px; }

  /* 设置页 */
  .settings-card-head { padding: 14px; }
  .settings-card-body { padding: 14px; }
  .settings-form-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-theme-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-profile { gap: 12px; }
  .settings-profile .avatar.xl { width: 60px; height: 60px; font-size: 22px; }
  .settings-kv-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-totp-body { gap: 14px; }
  .settings-totp-qr { width: 148px; height: 148px; }
  .settings-toggle { padding: 12px 14px; gap: 12px; }
  .settings-form-actions { gap: 10px; }
  .settings-form-actions .btn { flex: 1; }
  .settings-form-actions .muted { flex: 1 1 100%; }
  .settings-about { align-items: flex-start; }
  .settings-push-state { flex-wrap: wrap; }
  .settings-push-state .btn { width: 100%; }
}

@media (min-width: 761px) {
  .contacts-detail-empty { min-height: 0; }
}

/* 减少动态效果偏好：保留骨架动画但去掉位移过渡 */
@media (prefers-reduced-motion: reduce) {
  .contacts-detail { transition: none; }
}
