/* ============================================================
   CSS Variables - Refined neutral palette, single accent.
   ============================================================ */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --text-xs: 11px;
  --text-sm: 12.5px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 20px;

  /* Neutral-forward palette. MaxMara = architectural, restrained. */
  --color-bg: #f6f5f4;
  --color-surface: #ffffff;
  --color-text: #1c1c1c;
  --color-text-secondary: #5c5c5c;
  --color-text-muted: #949494;
  --color-border: #e6e5e3;
  --color-border-light: #f0efed;
  --color-accent: #2c2c2c;
  --color-accent-hover: #1a1a1a;
  --color-success: #2d6a4f;
  --color-success-bg: #e8f5ee;
  --color-danger: #9b2226;
  --color-danger-bg: #fef2f2;
  --color-warning: #92400e;
  --color-warning-bg: #fffbeb;
  --color-table-year-bg: #d9e3f4;
  --color-tier-winner: #075985;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-xl: 0 8px 28px rgba(0,0,0,0.12);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --transition-fast: 0.12s ease;
  --transition-base: 0.18s ease;
  --transition-slow: 0.25s ease;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont,
               "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-8) var(--space-4);
}

.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100000;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-xl);
  transform: translateY(calc(-100% - var(--space-4)));
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  transform: translateY(0);
}

/* ============================================================
   Page layout
   ============================================================ */
.page {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.page-grid {
  display: grid;
  grid-template-columns: 155px 1fr;
  gap: var(--space-5);
  align-items: start;
}

.page-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
  overflow: visible;
}

@media (max-width: 1023px) {
  .page-grid { grid-template-columns: 1fr; }
  .page-nav { flex-direction: row; position: static; overflow-x: auto; }
}

/* ============================================================
   Header bar - clean, no glassmorphism
   ============================================================ */
.env-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-accent);
  border-radius: var(--radius-lg);
  color: #ffffff;
}

.env-bar-title {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.status-bar {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  opacity: 0.85;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
}
.status-dot.ok { background: #6ee7b7; }
.status-dot.err { background: #fca5a5; }

/* ============================================================
   Left navigation - clean, architectural
   ============================================================ */
.page-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--space-1);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: var(--space-4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px 12px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
  border: none;
  font-family: inherit;
  line-height: 1.4;
}

.nav-item:hover:not(.nav-item-active) {
  background: var(--color-border-light);
  color: var(--color-text);
}

.nav-item-active {
  background: var(--color-accent);
  color: #ffffff;
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  line-height: 1;
  flex-shrink: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  margin: -1px;
}

.nav-label { flex: 1; min-width: 0; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  overflow: visible;
}

.card h2 {
  margin: 0 0 var(--space-5) 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  line-height: 1.3;
  letter-spacing: -0.2px;
}

/* ============================================================
   Forms
   ============================================================ */
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.field { display: flex; flex-direction: column; }
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
  letter-spacing: 0.1px;
}
/* Input clear button */
.input-clear-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-clear-wrap input {
  width: 100%;
  padding-right: 28px;
}
.input-clear-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.input-clear-btn:hover {
  background: var(--color-text-muted);
  color: #fff;
}
.input-clear-wrap.has-value:hover .input-clear-btn,
.input-clear-wrap.has-value:focus-within .input-clear-btn {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
/* 下拉触发箭头：常驻可见，避免可下拉的输入框看起来像普通文本框 */
.input-drop-arrow {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: color var(--transition-fast);
}
.input-drop-arrow:hover { color: var(--color-text); }
.input-clear-wrap.has-datalist .input-drop-arrow { display: inline-flex; }
.input-clear-wrap.has-value.has-datalist .input-clear-btn { right: 22px; }
/* 隐藏浏览器为 <input list> 渲染的原生下拉箭头，避免和自定义 ▼ 重复 */
.input-clear-wrap.has-datalist input::-webkit-calendar-picker-indicator {
  display: none !important;
  -webkit-appearance: none;
  opacity: 0;
}
.input-clear-wrap.has-datalist input::-webkit-list-button {
  display: none !important;
  -webkit-appearance: none;
}
.input-clear-wrap.has-datalist input {
  -moz-appearance: textfield;
}

/* 会员 ID 自绘下拉：原生 datalist 展开后不随 DOM 更新，无法做到实时刷新 */
.member-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}
.member-suggest[hidden] { display: none; }
.member-suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
}
.member-suggest-item.is-active { background: var(--color-surface-muted); }
.member-suggest-item.is-pending {
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.member-suggest-item.is-pending.is-active { background: transparent; }
.member-suggest-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-suggest-badge {
  margin-left: auto;
  flex: none;
  font-size: 12px;
  color: var(--color-text-muted);
}
.member-suggest-empty {
  padding: 8px 10px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
/* 门店下拉行：编码 + 店名 + 区域徽标 */
.shop-suggest-item .shop-suggest-code { flex: none; font-weight: 600; }
.shop-suggest-item .shop-suggest-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-secondary);
}

.field input, .field select {
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: inherit;
  background-color: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  line-height: 1.5;
}
.field input:focus, .field select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(44,44,44,0.08);
}
.field input:disabled {
  background: var(--color-border-light);
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}
.field.error input, .field.error select {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(155,34,38,0.08);
}
.field-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: 3px;
  min-height: 16px;
}
.required { color: var(--color-danger); margin-left: 1px; }

/* ============================================================
   Buttons
   ============================================================ */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: var(--text-base);
  font-weight: 500;
  padding: 9px 16px;
  transition: background var(--transition-fast), transform var(--transition-fast),
              box-shadow var(--transition-fast);
  user-select: none;
  line-height: 1.4;
}
button:active { transform: scale(0.98); }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: #c5c5c3;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  padding: 6px 10px;
  font-size: var(--text-sm);
}
.btn-secondary:hover { background: var(--color-border-light); }

.btn-submit {
  width: 100%;
  padding: 11px 20px;
  margin-top: var(--space-5);
  font-size: 15px;
  font-weight: 600;
}

/* ============================================================
   Response area - terminal style, kept for code output
   ============================================================ */
.response {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.6;
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.response.success { background: #1a1a2e; color: #a6e3a1; border: 1px solid rgba(166,227,161,0.12); }
.response.warning { background: #1a1a2e; color: #fab387; border: 1px solid rgba(250,179,135,0.12); }
.response.error   { background: #1a1a2e; color: #f38ba8; border: 1px solid rgba(243,139,168,0.12); }
.response.info    { background: #1a1a2e; color: #89b4fa; border: 1px solid rgba(137,180,250,0.12); }

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -1px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Toast notifications
   ============================================================ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  color: #ffffff;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  box-shadow: var(--shadow-lg);
}
.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-info { background: var(--color-text-secondary); }

/* ============================================================
   Action log
   ============================================================ */
.action-log-clear {
  margin-left: auto;
  padding: 4px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.action-log-empty {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  text-align: center;
  padding: var(--space-3) 0;
}

.action-log-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.action-log-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  border-left-width: 3px;
}

.action-log-success { border-left-color: var(--color-success); }
.action-log-fail    { border-left-color: var(--color-danger); background: #fefafa; }

.action-log-item details summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  outline: none;
}

.action-log-item details summary::-webkit-details-marker { display: none; }

.action-log-item details summary::before {
  content: '\25B6';
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
  display: inline-block;
}

.action-log-item details[open] summary::before { transform: rotate(90deg); }

.action-log-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--color-border-light);
  color: var(--color-text-secondary);
  letter-spacing: 0.3px;
}

.action-log-fail .action-log-badge {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.action-log-status {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-success);
}

.action-log-fail .action-log-status { color: var(--color-danger); }

.action-log-code {
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-log-time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", monospace;
  white-space: nowrap;
}

.action-log-body {
  padding: var(--space-1) var(--space-3) var(--space-3);
  border-top: 1px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.action-log-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-top: var(--space-1);
  margin-bottom: var(--space-1);
}

.action-log-pre {
  margin: 0;
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow-y: auto;
}

.action-log-request {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.action-log-request-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.action-log-request-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 600;
}

.action-log-request-url {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.action-log-method {
  flex: 0 0 auto;
  color: #9a3412;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: .35px;
}

.action-log-method.method-get { color: #16803c; }
.action-log-method.method-put,
.action-log-method.method-patch { color: #9a6700; }
.action-log-method.method-delete { color: var(--color-danger); }

.action-log-url-value {
  min-width: 0;
  color: #344054;
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.action-log-mime {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: var(--text-xs);
  font-weight: 500;
}

.action-log-header-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}

.action-log-header-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.action-log-header-table th,
.action-log-header-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-light);
  text-align: left;
  vertical-align: top;
}

.action-log-header-table th {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .35px;
}

.action-log-header-table th:first-child,
.action-log-header-table td:first-child {
  width: 180px;
}

.action-log-header-table tr:last-child td { border-bottom: 0; }
.action-log-header-table td:first-child { color: var(--color-text-secondary); }
.action-log-header-table td:last-child {
  color: #344054;
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", monospace;
  overflow-wrap: anywhere;
}

.action-log-request-pre {
  margin: 0;
  padding: var(--space-3);
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: #344054;
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.action-log-request-empty {
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

@media (max-width: 640px) {
  .action-log-request-url { flex-direction: column; gap: var(--space-1); }
  .action-log-header-table th:first-child,
  .action-log-header-table td:first-child { width: 116px; }
}

/* ============================================================
   Members table
   ============================================================ */
#members-table-wrap {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.members-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.members-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.members-table th {
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}
.members-table td {
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-light);
}
.members-table tbody tr:hover { background: var(--color-bg); }
.member-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}
.member-badge-success { background: var(--color-success-bg); color: var(--color-success); }
.member-badge-fail { background: var(--color-danger-bg); color: var(--color-danger); }

/* Shop filter selects */
.shop-filter select {
  padding: 8px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: inherit;
  background-color: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-base);
}
.shop-filter select:focus {
  border-color: var(--color-accent);
}
.shop-filter #filter-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
}
.member-badge-pending { background: var(--color-bg); color: var(--color-text-secondary); }
.members-toolbar { display:flex; gap:var(--space-2); flex-wrap:wrap; margin-bottom:var(--space-3); }
.members-toolbar input, .members-toolbar select {
  min-height:34px; padding:6px 10px; border:1.5px solid var(--color-border);
  border-radius:var(--radius-md); background:var(--color-bg); color:var(--color-text); font:inherit; font-size:var(--text-sm);
}
.members-toolbar input { flex:1 1 220px; }
.members-summary { width:100%; color:var(--color-text-muted); font-size:var(--text-sm); }

/* Shared modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--color-surface); border-radius: var(--radius-lg);
  padding: 24px; width: 420px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.modal-box h3 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }
/* 核销弹窗字段较多，允许内部滚动，避免小屏被裁切 */
.redeem-box { max-height: 90vh; overflow-y: auto; }
/* 字段较多的表单弹窗（如 WK 会员资料修改）用更宽的版心 + 两列栅格。 */
.modal-box.modal-box-wide { width: 620px; max-width: 94vw; }
/* Inline modal hint: keeps long collection names readable inside the card
   instead of a floating tooltip that overflowed (and was clipped by) .modal-box. */
.modal-hint {
  position: relative;
  margin: -6px 0 14px;
  padding: 8px 10px 8px 28px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow-wrap: anywhere;
}
.modal-hint::before {
  content: "ⓘ";
  position: absolute;
  left: 9px;
  top: 7px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-muted);
}
.modal-hint code {
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.modal-field { margin-bottom: 12px; }
.modal-field label { display: block; font-size: 13px; font-weight: 500; color: var(--color-text-secondary); margin-bottom: 4px; }
.modal-field input, .modal-field select {
  width: 100%; padding: 8px 12px; border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md); font-size: var(--text-base); font-family: inherit;
  background-color: var(--color-bg); color: var(--color-text); outline: none;
  box-sizing: border-box;
}
.modal-field input:focus, .modal-field select:focus { border-color: var(--color-accent); }
.modal-field-note { margin-top: 4px; font-size: 12px; color: var(--color-text-muted); }
.modal-field input[readonly] { background: var(--color-border-light); color: var(--color-text-muted); cursor: not-allowed; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-actions button { padding: 8px 20px; border-radius: var(--radius-md); font-size: var(--text-base); cursor: pointer; border: none; }
.btn-cancel { background: var(--color-bg); color: var(--color-text); border: 1.5px solid var(--color-border) !important; }
.btn-confirm { background: var(--color-accent); color: #fff; }
.modal-result { margin-top: 12px; padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; white-space: pre-wrap; }
.modal-result-success { background: var(--color-success-bg); color: var(--color-success); }
.modal-result-error { background: var(--color-danger-bg); color: var(--color-danger); }
.bms-refund-summary {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  margin: 0 0 16px;
}
.bms-refund-summary div {
  min-width: 0; padding: 10px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md); background: var(--color-surface-muted);
}
.bms-refund-summary dt {
  color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.4;
}
.bms-refund-summary dd {
  margin: 3px 0 0; color: var(--color-text); font-size: var(--text-sm);
  font-weight: 600; overflow-wrap: anywhere;
}
.bms-refund-help {
  margin: 5px 0 0; color: var(--color-text-muted); font-size: var(--text-xs);
  line-height: 1.5;
}
.bms-refund-help strong { color: var(--color-danger); }
/* DW 标准退单：按 SKU 行选择退单数量，数量步进器与下单页同款。 */
.dw-refund-items { display: grid; gap: 8px; margin-bottom: 14px; }
.dw-refund-items:empty { display: none; }
.dw-refund-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md); background: var(--color-surface-muted);
}
.dw-refund-item.is-zero { border-style: dashed; }
.dw-refund-item.is-zero .dw-refund-item-head { opacity: .6; }
.dw-refund-item-head { min-width: 0; display: grid; gap: 3px; }
.dw-refund-item-head strong {
  color: var(--color-text); font-size: var(--text-sm);
  font-weight: 600; overflow-wrap: anywhere;
}
.dw-refund-item-head span { color: var(--color-text-muted); font-size: var(--text-xs); }
.dw-refund-item-picker {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
}
.dw-refund-item-picker > span {
  flex: 0 0 auto; color: var(--color-text-muted);
  font-size: var(--text-xs); white-space: nowrap;
}
.dw-refund-item .quantity-stepper {
  flex: 0 0 auto; width: 128px; min-height: 38px; background: var(--color-surface);
}
.dw-refund-item .quantity-stepper input {
  min-height: 36px; padding-left: 0; font-size: var(--text-base);
}
.dw-refund-item .quantity-stepper button { width: 34px; font-size: 16px; }
@media (max-width: 560px) {
  .dw-refund-item { flex-wrap: wrap; }
  .dw-refund-item-picker { width: 100%; justify-content: space-between; }
}
.jd-refund-sku-list { display: grid; gap: 8px; }
.jd-refund-sku-option {
  display: flex !important; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-md);
  background: var(--color-surface); cursor: pointer;
}
.jd-refund-sku-option:has(input:checked) {
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 1px rgba(31, 37, 33, .08);
}
.jd-refund-sku-option:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.jd-refund-sku-option input { width: auto !important; margin: 3px 0 0; flex: 0 0 auto; }
.jd-refund-sku-copy { min-width: 0; display: grid; gap: 2px; }
.jd-refund-sku-copy strong { color: var(--color-text); overflow-wrap: anywhere; }
.jd-refund-sku-copy span { color: var(--color-text-muted); font-size: var(--text-xs); }

/* 退单弹窗统一版式：DW / BMS / 天猫 / 京东 / 抖音共用「摘要 + 分区卡片」。 */
.refund-form-card {
  padding: 14px 14px 4px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}
.refund-form-card + .refund-form-card { margin-top: 10px; }
.refund-form-card .modal-field { margin-bottom: 10px; }
.refund-form-card .modal-field label { font-size: var(--text-sm); }
.refund-form-card .modal-field input { background: var(--color-surface); }
/* 退单金额一律只读并置灰，覆盖卡片内输入框的白底 */
.refund-form-card .modal-field input[readonly],
.refund-modal .modal-field input[readonly] {
  background: var(--color-border-light);
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.refund-modal .modal-field input[readonly]:focus { border-color: var(--color-border); }
/* DW / BMS 走 .field（43px 高），其它渠道统一到同一高度，否则并排看会有落差 */
.refund-modal .modal-field input,
.refund-modal .modal-field select { min-height: 43px; padding: 10px 12px; }
.refund-modal .jd-refund-sku-option input[type="checkbox"] {
  min-height: 0; padding: 0; accent-color: var(--color-accent);
}
.refund-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.refund-form-grid .refund-field-wide { grid-column: 1 / -1; }
.refund-form-card .field-hint { margin: 2px 0 8px; font-size: var(--text-xs); }
@media (max-width: 560px) {
  .refund-form-grid { grid-template-columns: minmax(0, 1fr); }
}
.import-actions { display: flex; align-items:center; gap: 4px; }
.btn-import { min-height: 32px; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; border: 1.5px solid var(--color-accent); background: transparent; color: var(--color-accent); }
.btn-import:hover { background: var(--color-accent); color: #fff; }
.btn-import:disabled { cursor:not-allowed; opacity:.65; }
.btn-import-warn { border-color: var(--color-warning); color: var(--color-warning); }
.btn-import-warn:hover { background: var(--color-warning); color: #fff; }
/* 退单是破坏性操作：各渠道统一 danger 色，避免同一张表里红框/棕框混排。
   颜色只由这里决定，渲染代码不再写内联 style。 */
.btn-import.btn-tmall-refund,
.btn-import.btn-jd-refund,
.btn-import.btn-bms-refund,
.btn-import.btn-douyin-refund,
.btn-import.btn-refund { border-color: var(--color-danger); color: var(--color-danger); }
.btn-import.btn-tmall-refund:hover,
.btn-import.btn-jd-refund:hover,
.btn-import.btn-bms-refund:hover,
.btn-import.btn-douyin-refund:hover,
.btn-import.btn-refund:hover { background: var(--color-danger); color: #fff; }
/* ============================================================
   Form sections
   ============================================================ */
.form-section {
  margin-bottom: var(--space-3);
}
.form-section + .form-section {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-light);
}
.form-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.form-section-label::before {
  content: "";
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--color-brand);
}
.form-section-progress { margin-left: auto; letter-spacing: 0.2px; }
.form-section-progress:empty { display: none; }
.form-section-progress.is-done { color: var(--color-success); }
.field-hint.is-miss { color: var(--color-danger); }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  gap: var(--space-4);
}
.form-actions .btn-submit {
  margin-top: 0;
  width: auto;
  padding: 11px 48px;
  font-size: 15px;
}

/* Toggle switch */
.toggle-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-switch .track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
  cursor: pointer;
}
.toggle-switch .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .track {
  background: var(--color-accent);
}
.toggle-switch input:checked + .track .knob {
  transform: translateX(18px);
}
.toggle-switch input:focus-visible + .track {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
}

/* Orders search */
.orders-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; padding: 14px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}
.orders-search {
  display: flex; flex: 1 1 320px; flex-direction: column; gap: 6px;
  max-width: 520px; color: var(--color-text-secondary);
  font-size: var(--text-xs); font-weight: 600;
}
.orders-search input {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-base);
}
.orders-search input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 14%, transparent);
}
.orders-toolbar-actions { display: flex; gap: 8px; }
.orders-toolbar-actions button { min-height: 42px; padding: 8px 16px; white-space: nowrap; }
.orders-toolbar-actions button:disabled { cursor: wait; opacity: .65; }
#orders-table-wrap {
  max-height: calc(100vh - 330px); min-height: 140px; overflow: auto;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
}
.orders-count {
  margin-top: 10px; color: var(--color-text-muted); font-size: var(--text-sm);
}
#orders-empty { margin: 8px 0; color: var(--color-text-secondary); }
.order-action-buttons {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 6px; flex-wrap: wrap;
}

@media (max-width: 680px) {
  .orders-toolbar { align-items: stretch; flex-direction: column; padding: 12px; }
  .orders-search { flex-basis: auto; max-width: none; }
  .orders-toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .orders-toolbar-actions button { width: 100%; }
}

/* ============================================================
   Workspace refresh - clearer hierarchy and denser workflows
   ============================================================ */
:root {
  --color-bg: #f3f1ed;
  --color-surface: #fffefa;
  --color-surface-muted: #f8f6f2;
  --color-text: #202320;
  --color-text-secondary: #60645f;
  --color-text-muted: #686d68;
  --color-border: #deddd7;
  --color-border-light: #eceae4;
  --color-accent: #202522;
  --color-accent-hover: #111411;
  --color-brand: #8d6452;
  --color-brand-soft: #efe5df;
  --color-primary: var(--color-brand);
  --shadow-sm: 0 1px 2px rgba(31, 37, 33, 0.04);
  --shadow-md: 0 8px 24px rgba(31, 37, 33, 0.07);
  --shadow-lg: 0 16px 44px rgba(31, 37, 33, 0.12);
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}
html { scroll-behavior: smooth; }
body {
  padding: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.52), transparent 260px), var(--color-bg);
  line-height: 1.5;
}
body.is-prod-environment::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  border: 5px solid #dc2626;
  box-shadow: inset 0 0 20px rgba(220, 38, 38, .42);
  animation: prod-border-pulse 2.4s ease-in-out infinite;
}
@keyframes prod-border-pulse {
  0%, 100% { opacity: .38; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body.is-prod-environment::after { animation: none; opacity: .78; }
}
.page { max-width: 1680px; gap: 16px; }
.env-bar {
  position: relative;
  min-height: 72px;
  padding: 14px 20px;
  border-radius: var(--radius-xl);
  background: #202522;
  box-shadow: 0 12px 30px rgba(25, 29, 26, 0.16);
}
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 0 auto; }
.brand-mark {
  width: 40px; height: 40px; display: block; flex: 0 0 auto;
  border-radius: 12px; overflow: hidden;
}
.brand-mark img,
.brand-mark svg { display: block; width: 100%; height: 100%; }
.env-bar-title { font-size: 15px; font-weight: 650; letter-spacing: .5px; }
.env-bar.is-prod { background: #6f2727; }
.env-bar-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  min-width: 0; flex: 1 1 auto;
  /* 账户菜单要浮出顶栏底部；状态栏自身已有 overflow:hidden，无需在父级裁切。 */
  overflow: visible;
}
.user-session {
  display: inline-flex; align-items: center;
  min-width: 0; flex: 0 0 auto;
}
.user-session[hidden] { display: none; }
.user-session-trigger {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px;
  padding: 3px 10px 3px 12px; border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-full); background: rgba(255,255,255,.055);
  color: #fff; font: inherit; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.user-session-trigger:hover,
.user-session-trigger[aria-expanded="true"] {
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22);
}
.user-session-trigger:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.user-session-name {
  max-width: 110px; overflow: hidden; color: rgba(255,255,255,.9);
  font-size: var(--text-xs); font-weight: 650; text-overflow: ellipsis; white-space: nowrap;
}
.user-session-caret {
  width: 12px; height: 12px; flex: 0 0 auto; opacity: .72;
  transition: transform var(--transition-fast);
}
.user-session-trigger[aria-expanded="true"] .user-session-caret { transform: rotate(180deg); }
.user-session-menu {
  position: absolute; top: calc(100% + 8px); right: 20px; z-index: 900;
  min-width: 176px; padding: 6px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 14px;
  background: #2b302c; box-shadow: 0 14px 34px rgba(16,20,17,.28);
}
.user-session-menu[hidden] { display: none; }
.env-bar.is-prod .user-session-menu {
  background: #3a2323; border-color: rgba(255,255,255,.18);
}
.user-session-menu-meta {
  display: grid; gap: 2px; margin: 2px 4px 6px; padding: 6px 8px;
  border-radius: 8px; background: rgba(255,255,255,.05);
  font-size: var(--text-xs); line-height: 1.5;
}
.user-session-menu-meta[hidden] { display: none; }
.user-session-menu-label { color: rgba(255,255,255,.9); font-weight: 650; }
.user-session-menu-expiry { color: rgba(255,255,255,.55); }
.user-session-menu-expiry[hidden] { display: none; }
.user-session-action,
.user-session-logout {
  display: flex; align-items: center; width: 100%; min-height: 36px;
  padding: 8px 10px; border: 0; border-radius: 9px;
  background: transparent; color: rgba(255,255,255,.82);
  font: inherit; font-size: 12px; font-weight: 650; text-align: left;
  cursor: pointer; transition: background var(--transition-fast), color var(--transition-fast);
}
.user-session-action:hover,
.user-session-logout:hover,
.user-session-action:focus-visible,
.user-session-logout:focus-visible {
  background: rgba(255,255,255,.12); color: #fff; outline: none;
}
.user-session-action[hidden] { display: none; }
.user-session-action:not([hidden]) + .user-session-logout {
  margin-top: 5px; padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.09);
  border-radius: 0 0 9px 9px;
}
.user-session-logout:disabled { cursor: wait; opacity: .55; }
.env-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius-full);
  background: rgba(255,255,255,.06);
}
.env-switch button {
  min-width: 48px; padding: 5px 10px; border: 0; border-radius: var(--radius-full);
  background: transparent; color: rgba(255,255,255,.62);
  font: inherit; font-size: var(--text-xs); font-weight: 650; cursor: pointer;
}
.env-switch button[aria-pressed="true"] {
  background: #fff; color: #252a27; box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.env-switch button:disabled { cursor: wait; opacity: .55; }
.env-switch.env-switch-pinned button:disabled { cursor: not-allowed; }
.env-switch.env-switch-pinned button[aria-pressed="true"]:disabled { opacity: 1; }
.env-switch[hidden] { display: none; }
.status-bar {
  padding: 5px 8px; border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-full); background: rgba(255,255,255,.045);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
  max-width: min(480px, 50vw); min-width: 0; flex: 0 1 auto;
  overflow: hidden; opacity: 1; white-space: nowrap;
}
/* 窄屏专用：健康灯收成一个可读的紧凑按钮，点开后才看逐项状态。 */
.health-compact {
  display: none; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 10px; border: 0;
  border-radius: var(--radius-full); background: rgba(255,255,255,.08);
  color: #fff; font: inherit; font-size: 11px; font-weight: 650; cursor: pointer;
}
.health-compact .health-dot { width: 7px; height: 7px; }
.health-compact[data-state="ok"] .health-dot { background: #72ddb4; }
.health-compact[data-state="err"] { background: rgba(255,141,141,.18); color: #ffd0d0; }
.health-compact[data-state="err"] .health-dot { background: #ff8d8d; }
.status-items {
  display: inline-flex; align-items: center; min-width: 0; max-width: 100%;
  overflow: hidden;
}
.status-item {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  min-width: 0; max-width: 100%;
  padding: 2px 8px; color: rgba(255,255,255,.68);
  font-size: 11px; font-weight: 550; letter-spacing: .1px;
}
.status-item > span:last-child {
  min-width: 0; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.status-item + .status-item::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 1px; background: rgba(255,255,255,.1);
}
.health-dot {
  width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%;
  background: rgba(255,255,255,.34);
}
.status-item[data-state="ok"] { color: rgba(255,255,255,.9); }
.status-item[data-state="ok"] .health-dot {
  background: #72ddb4; box-shadow: 0 0 0 3px rgba(114,221,180,.1);
}
.status-item[data-state="err"] { color: #ffd0d0; }
.status-item[data-state="err"] .health-dot {
  background: #ff8d8d; box-shadow: 0 0 0 3px rgba(255,141,141,.1);
}
.page-grid { grid-template-columns: 210px minmax(0, 1fr); gap: 16px; }
.page-nav {
  top: 20px; gap: 4px; padding: 14px 10px;
  border-radius: var(--radius-xl); box-shadow: none;
}
.nav-section-label {
  padding: 2px 10px 8px; color: var(--color-text-muted);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
}
/* 侧栏分组：业务 / 工具 / 系统。折叠后收成一条细分隔线，不占宽度。
   高度必须显式且可过渡：展开时列宽还在 56px，若让标签按内容 auto 高度，
   文字会被挤成多行（77px→44px→27.5px 阶梯），把菜单瞬间上下推，看起来像闪一下。 */
.nav-group-label {
  box-sizing: border-box;
  height: 28px;
  margin: 8px 4px 2px; padding: 10px 10px 0;
  border-top: 1px solid var(--color-border-light);
  color: var(--color-text-secondary);
  font-size: var(--text-xs); font-weight: 650; letter-spacing: .4px;
  line-height: 18px; white-space: nowrap; overflow: hidden;
}
.nav-group-label[hidden] { display: none; }
html.nav-collapsed .nav-group-label {
  height: 1px; margin: 8px 6px; padding: 0; border-top: 0;
  background: var(--color-border); color: transparent;
  font-size: 0; overflow: hidden;
}
@media (max-width: 1023px) {
  .nav-group-label { display: none; }
}
.nav-item { min-height: 42px; padding: 10px 12px; gap: 10px; border-radius: 10px; font-size: 13px; }
.nav-item-active {
  background: var(--color-brand-soft); color: #684637;
  box-shadow: inset 3px 0 0 var(--color-brand);
}
.nav-item:hover:not(.nav-item-active) { background: var(--color-surface-muted); }
.nav-icon { transform: scale(.9); }
/* 备案号必须保留（法定要求），但后台工作台里不该像正文链接一样抢眼。 */
.site-footer {
  padding: 8px 16px 2px;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-align: right;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--color-text-secondary); text-decoration: underline; }
.site-footer a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.page-content { gap: 16px; }
.field input, .field select,
.members-toolbar input, .members-toolbar select,
.orders-search input, .shop-filter select,
.modal-field input, .modal-field select {
  background-color: var(--color-surface-muted); border-width: 1px;
}
.card {
  min-height: 320px; padding: 28px; border-radius: var(--radius-xl);
  box-shadow: 0 3px 16px rgba(31, 37, 33, .035);
}
.card h2 { margin-bottom: 4px; font-size: 21px; font-weight: 650; letter-spacing: -.45px; }
.panel-description { margin: 0 0 24px; color: var(--color-text-muted); font-size: 13px; }
.form-section { margin: 0; padding: 19px 0; }
.form-section + .form-section { padding-top: 19px; }
.form-section-label { margin-bottom: 13px; color: #6f5a50; letter-spacing: .85px; }
.fields { gap: 14px 18px; }
.field label { margin-bottom: 6px; }
.field input, .field select { min-height: 43px; padding: 10px 12px; }
.field input:hover:not(:disabled), .field select:hover,
.members-toolbar input:hover, .members-toolbar select:hover,
.orders-search input:hover, .shop-filter select:hover { border-color: #c5c2ba; }
.field input:focus, .field select:focus,
.members-toolbar input:focus, .members-toolbar select:focus,
.orders-search input:focus, .shop-filter select:focus,
.modal-field input:focus, .modal-field select:focus {
  border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(141, 100, 82, .12);
}
button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-brand); outline-offset: 2px;
}
.btn-primary, .btn-confirm { box-shadow: 0 4px 12px rgba(32,37,34,.14); }
.btn-secondary, .btn-cancel { background: var(--color-surface); }
.form-actions { margin-top: 8px; padding-top: 20px; }
.form-actions .btn-submit { min-width: 172px; }
.member-profile-fields {
  grid-template-columns:
    minmax(0, .85fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, 2fr);
}
.fields-thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shop-filter, .members-toolbar, .orders-search {
  padding: 12px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg); background: var(--color-surface-muted);
}
.shop-filter select, .members-toolbar input, .members-toolbar select,
.orders-search input { background-color: var(--color-surface); }
.order-form-section {
  padding: 18px; margin-bottom: 12px;
  border: 1px solid var(--color-border-light) !important;
  border-radius: var(--radius-lg); background: var(--color-surface-muted);
}
.order-basic-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.order-form-section .field input,
.order-form-section .field select { background-color: var(--color-surface); }
.jd-sku-section-header, .douyin-sku-section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 13px;
}
.jd-sku-section-header .form-section-label,
.douyin-sku-section-header .form-section-label { margin-bottom: 0; }
/* 京东 SKU 行的启用开关：轨道 + 滑块 + 状态文字。
   原来是「绿点 + 药丸底」，看着像只读状态标签，点不动也说不清是开关 */
.jd-sku-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 0; border: 0; background: transparent;
  color: var(--color-success); font-size: 11px; font-weight: 650;
  line-height: 1; white-space: nowrap; cursor: pointer;
}
.jd-sku-toggle::after {
  content: "";
  flex: 0 0 auto;
  width: 32px; height: 18px;
  border-radius: var(--radius-full);
  background-color: var(--color-success);
  background-image: radial-gradient(circle at 50% 50%, #fff 0 4.6px, rgba(255,255,255,0) 5px);
  background-repeat: no-repeat;
  background-size: 10px 10px;
  background-position: right 4px center;
  box-shadow: inset 0 0 0 1px rgba(45, 106, 79, .18);
  transition: background-color var(--transition-base), background-position var(--transition-base);
}
.jd-sku-toggle:hover::after { background-color: #245740; }
.jd-sku-toggle:active::after { background-position: right 4.5px center; }
.jd-sku-toggle[aria-checked="false"] { color: var(--color-text-muted); }
.jd-sku-toggle[aria-checked="false"]::after {
  background-color: #cfd0cb;
  background-position: left 4px center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.jd-sku-toggle[aria-checked="false"]:hover::after { background-color: #c1c2bd; }
.jd-sku-toggle[aria-checked="false"]:active::after { background-position: left 4.5px center; }
/* 通用按钮规则给了 44px 的点击热区，会把紧凑行撑高；开关本身只有 18px 高，
   这里收回高度，热区靠外层行高补足 */
.order-form-section .store-sku-row .jd-sku-toggle { min-height: 0; }
.jd-sku-section.is-disabled { border-style: dashed !important; }
.jd-sku-section.is-disabled > .fields,
.jd-sku-section.is-disabled > .jd-sku-optional { opacity: .48; }
.jd-sku-list-actions, .douyin-sku-list-actions {
  display: flex; align-items: center; gap: 12px; margin: 4px 0 16px;
  color: var(--color-text-muted); font-size: var(--text-xs);
}
.douyin-sku-remove {
  min-height: 44px; padding: 8px 14px; flex: 0 0 auto;
  color: var(--color-danger); white-space: nowrap;
}
.douyin-sku-remove:hover:not(:disabled) { background: var(--color-danger-bg); }
.douyin-sku-remove:disabled { cursor: not-allowed; opacity: .42; }
.douyin-order-total input[readonly] {
  background: var(--color-border-light) !important;
  color: var(--color-text-secondary); cursor: default;
}
.jd-sku-optional {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--color-border-light);
}
.jd-sku-optional summary {
  width: fit-content; color: var(--color-brand); cursor: pointer;
  font-size: var(--text-sm); font-weight: 600; user-select: none;
}
.jd-sku-optional summary::marker { color: var(--color-text-muted); }
.jd-sku-optional .fields { margin-top: 14px; }
/* 京东 SKU 行：第 6 列留给删除按钮，表头同步多一列空白占位 */
.order-form-section.jd-sku-block .jd-sku-head,
.order-form-section.jd-sku-block .jd-sku-section.store-sku-row {
  grid-template-columns: 24px minmax(0, 1.9fr) minmax(0, 1fr) 108px 96px 34px;
}
.order-form-section.jd-sku-block .jd-sku-section .store-remove-sku {
  grid-area: 1 / 6;
  align-self: center;
  justify-self: end;
}
/* 第 6 列是删除位，表头「启用」不再是 last-child，单独指定右对齐 */
.order-form-section.jd-sku-block .jd-sku-head > span:nth-child(5) { text-align: right; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-label-with-help { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.field .field-label-with-help > label { margin-bottom: 0; }
.field-quick-action {
  padding: 0; border-radius: 0; background: transparent;
  color: var(--color-brand); font-size: 11px; font-weight: 600;
}
.field-quick-action:hover { color: #644537; text-decoration: underline; }
.money-input, .quantity-stepper {
  min-height: 43px; display: flex; align-items: center;
  overflow: hidden; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.money-input:focus-within, .quantity-stepper:focus-within {
  border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(141,100,82,.12);
}
.field.error .money-input, .field.error .quantity-stepper {
  border-color: var(--color-danger); box-shadow: 0 0 0 3px rgba(155,34,38,.08);
}
.money-input > span:first-child {
  align-self: stretch; display: grid; place-items: center; width: 40px;
  border-right: 1px solid var(--color-border-light); color: var(--color-text-secondary);
  background: var(--color-surface-muted); font-weight: 650;
}
.money-input .input-clear-wrap, .quantity-stepper .input-clear-wrap { flex: 1; }
.money-input input, .quantity-stepper input {
  width: 100%; min-height: 41px; border: 0 !important; border-radius: 0;
  background: transparent !important; box-shadow: none !important;
}
.quantity-stepper button {
  align-self: stretch; width: 42px; padding: 0; border-radius: 0;
  background: var(--color-surface-muted); color: var(--color-text-secondary); font-size: 18px;
}
.quantity-stepper button:first-child { border-right: 1px solid var(--color-border-light); }
.quantity-stepper button:last-child { border-left: 1px solid var(--color-border-light); }
.quantity-stepper input { text-align: center; padding-left: 28px; }
.order-shop-filter {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  background: transparent;
  border: none;
}
.order-shop-filter .shop-filter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}
.order-shop-filter .choice-field { min-width: 0; }
/* 与商品品牌一致的「单行横向滚动」胶囊，右侧渐隐提示还有更多 */
.order-shop-filter .choice-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.order-shop-filter .choice-chips::-webkit-scrollbar { display: none; }
.order-shop-filter .choice-chip { flex: 0 0 auto; }
.order-shop-filter .shop-filter-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-bottom: 2px;
}
.order-shop-filter .shop-filter-status strong {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 600;
}
.shop-filter-copy { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.shop-filter-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.shop-filter-copy strong { color: var(--color-text); font-size: 13px; font-weight: 650; }
.shop-filter-copy p { margin: 0; color: var(--color-text-secondary); font-size: 11px; line-height: 1.6; }
.order-shop-filter #filter-count {
  display: inline-flex; min-height: 24px; padding: 3px 9px;
  border-radius: var(--radius-full); background: var(--color-surface-muted);
  color: var(--color-text-secondary); font-size: 11px; line-height: 1.4;
}
.order-shop-filter #filter-count:empty { display: none; }
.shop-filter-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shop-filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.shop-filter-field > span { color: var(--color-text-secondary); font-size: 11px; font-weight: 600; }
.sku-filter-bar { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 14px; }
.sku-filter-bar .shop-filter-field { flex: 0 1 240px; }
.sku-filter-bar .choice-field { flex: 1 1 320px; gap: 8px; }
.choice-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.choice-head > span:first-child { color: var(--color-text-secondary); font-size: 11px; font-weight: 600; }
.choice-head #sku-catalog-status,
.choice-head #douyin-sku-catalog-status {
  margin-left: auto; padding-bottom: 0; text-align: right;
}
.choice-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* 品牌接口返回前的占位：否则只剩「全部品牌」，看起来像已经加载完了 */
.choice-chip.is-skeleton {
  min-height: 30px; pointer-events: none; cursor: default;
  background: var(--color-border-light); border-color: transparent;
  animation: choice-chip-pulse 1.2s ease-in-out infinite;
}
.choice-chips.is-loading .choice-chip:not(.is-skeleton) { opacity: .65; }
@keyframes choice-chip-pulse {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}
/* 品牌较多时收成一行横向滚动，避免把 SKU 表头推远 */
.sku-filter-bar .choice-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.sku-filter-bar .choice-chips::-webkit-scrollbar { display: none; }
.sku-filter-bar .choice-chip { flex: 0 0 auto; }
/* 溢出且未滚到底时右侧渐隐，提示还可以横向滚动（门店/SKU 筛选条通用） */
.choice-chips.is-overflowing:not(.is-scrolled-end) {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
}
/* 原生 select 仅作状态容器：值读写与 change 事件照旧，但不参与视觉与焦点顺序 */
.choice-chips-native, .choice-chips > select { display: none; }
/* 表单里的胶囊与相邻输入框等高，点按区域不比下拉小 */
.field .choice-chips, .modal-field .choice-chips { min-height: 46px; }
.field .choice-chips .choice-chip,
.modal-field .choice-chips .choice-chip { min-height: 34px; padding: 7px 14px; font-size: 13px; }
.choice-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 6px 11px 6px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-full);
  background: var(--color-surface); color: var(--color-text-secondary);
  font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.3;
  cursor: pointer; transition: border-color var(--transition-fast), color var(--transition-fast),
    background-color var(--transition-fast), box-shadow var(--transition-fast);
}
.choice-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice-chip:hover { border-color: #d6d2cd; color: var(--color-text); }
.choice-chip:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.choice-chip.is-active {
  border-color: var(--color-accent); background: var(--color-accent); color: #fff;
  box-shadow: 0 1px 3px rgba(28, 28, 28, .18);
}
.choice-chip.is-active:hover { border-color: var(--color-accent-hover); background: var(--color-accent-hover); color: #fff; }
.choice-chip-count {
  min-width: 18px; padding: 1px 6px; border-radius: var(--radius-full);
  background: var(--color-surface-muted); color: var(--color-text-muted);
  font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; text-align: center;
}
.choice-chip.is-active .choice-chip-count { background: rgba(255, 255, 255, .2); color: #fff; }
@media (max-width: 700px) {
  .sku-filter-bar .choice-field { flex: 1 1 100%; }
  .choice-chip { padding: 6px 10px; font-size: 12px; }
  .choice-head #sku-catalog-status,
  .choice-head #douyin-sku-catalog-status { margin-left: 0; text-align: left; }
}
.sku-filter-bar select {
  width: 100%; min-height: 42px; padding: 9px 12px; font: inherit;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background-color: var(--color-surface); color: var(--color-text);
}
#sku-catalog-status { padding-bottom: 10px; color: var(--color-text-secondary); font-size: 11px; }
.order-review {
  margin-top: 4px; padding: 16px 18px; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface);
}
.order-review-heading {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.order-review-heading > div { display: flex; flex-direction: column; gap: 2px; }
.order-review-heading strong { font-size: 13px; }
.order-review-heading span { color: var(--color-text-muted); font-size: var(--text-xs); }
.order-review-ready {
  padding: 3px 8px; border-radius: var(--radius-full);
  background: var(--color-surface-muted); font-weight: 650;
}
.order-review-ready.is-ready { background: var(--color-success-bg); color: var(--color-success); }

/* 吸底操作栏：摘要 chips + 预览/提交，长表单滚动时始终可见 */
.order-actions-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: var(--space-5) -24px 0;
  padding: 12px 24px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.06);
}
.order-actions-bar .btn-submit { min-width: 132px; }
.order-actions-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-width: 0;
}
.order-actions-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.order-actions-chip small { color: var(--color-text-muted); font-size: 11px; }
.order-actions-chip strong {
  max-width: 180px;
  overflow: hidden;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-actions-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.order-actions-buttons .eoss-option strong { font-size: 12px; }
.order-review-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.order-review-grid > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.order-review-grid span { color: var(--color-text-muted); font-size: var(--text-xs); }
.order-review-grid strong {
  overflow: hidden; color: var(--color-text-secondary); font-size: 12px;
  font-weight: 600; text-overflow: ellipsis; white-space: nowrap;
}
.order-level-badge {
  display: inline-flex; margin-left: 5px; padding: 1px 6px;
  border-radius: var(--radius-full); background: var(--color-brand-soft);
  color: #684637; font-size: var(--text-xs); font-weight: 650; white-space: nowrap;
}
.order-level-badge.is-success { background: var(--color-success-bg); color: var(--color-success); }
.order-level-badge.is-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.order-level-badge.is-error { background: var(--color-danger-bg); color: var(--color-danger); }
.order-action-state { color: var(--color-text-muted); font-size: var(--text-xs); }
.order-channel-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; padding: 2px 7px; border-radius: var(--radius-full);
  background: #eef0f2; color: #50565b; font-size: var(--text-xs);
  font-weight: 700; white-space: nowrap;
}
.order-channel-badge.tmall { background: #fff0ec; color: #a2422d; }
.order-channel-badge.jd { background: #eef3fb; color: #315d91; }
.order-channel-badge.douyin { background: #f3efff; color: #6941a5; }
.order-channel-badge.bms { background: #eef6f3; color: #276653; }
.eoss-option, .xid-toggle-option, .bms-normal-only-option,
.order-comparison-scope-option { align-items: flex-start; white-space: normal; }
.eoss-option > span:last-child, .xid-toggle-option > span:last-child,
.bms-normal-only-option > span:last-child,
.order-comparison-scope-option > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.eoss-option strong, .xid-toggle-option strong, .bms-normal-only-option strong,
.order-comparison-scope-option strong { color: var(--color-text-secondary); font-size: 12px; }
.eoss-option small, .xid-toggle-option small, .bms-normal-only-option small,
.order-comparison-scope-option small { max-width: 460px; color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 400; }
.xid-toggle-option { grid-column: 1 / -1; }
/* xid 开关：说明文字收进标题右侧的 ⓘ 气泡，行内只保留开关与标题 */
.toggle-switch-wrap.xid-toggle-option { align-items: center; gap: 8px; }
.xid-toggle-label {
  margin: 0; color: var(--color-text-secondary);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.bms-normal-only-option {
  display: flex; margin: 0 0 12px; padding: 12px 14px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}
.order-result {
  display: flex; flex-direction: column; gap: 3px; margin-top: 14px; padding: 13px 15px;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
}
.order-result strong { font-size: 13px; }
.order-result span { font-size: 11px; }
.order-result.info { background: #eef3f8; color: #34536f; border-color: #d7e2ec; }
.order-result.success { background: var(--color-success-bg); color: var(--color-success); border-color: #cce3d6; }
.order-result.warning { background: var(--color-warning-bg); color: var(--color-warning); border-color: #f0dfbd; }
.order-result.error { background: var(--color-danger-bg); color: var(--color-danger); border-color: #efd1d1; }
.bms-submit-progress {
  display: grid; grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
  align-items: center; gap: 10px; margin-top: 14px; padding: 13px 15px;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}
.bms-progress-step { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bms-progress-step > span {
  width: 28px; height: 28px; flex: 0 0 28px; display: inline-flex;
  align-items: center; justify-content: center; border: 1px solid var(--color-border);
  border-radius: var(--radius-full); background: var(--color-surface);
  color: var(--color-text-muted); font-size: 11px; font-weight: 700;
}
.bms-progress-step > div { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.bms-progress-step strong { color: var(--color-text-secondary); font-size: 12px; }
.bms-progress-step small { color: var(--color-text-muted); font-size: var(--text-xs); }
.bms-progress-connector { height: 1px; background: var(--color-border); }
.bms-progress-step.is-running > span { border-color: #8ca5bc; background: #eef3f8; color: #34536f; }
.bms-progress-step.is-success > span { border-color: #a9cfb9; background: var(--color-success-bg); color: var(--color-success); }
.bms-progress-step.is-error > span { border-color: #dfaaaa; background: var(--color-danger-bg); color: var(--color-danger); }
.response-details { margin-top: 8px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.response-details summary {
  padding: 9px 12px; color: var(--color-text-muted); cursor: pointer; font-size: 11px;
}
.response-details .response { margin: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.register-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
}
.register-heading .panel-description { margin-bottom: 0; }
.register-random-btn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.register-random-btn span { font-size: 17px; line-height: 1; }
.reg-mode-tabs {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px; padding: 5px; margin-bottom: 18px;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}
.field-inline-action { display: flex; align-items: center; gap: 8px; }
.field-inline-action .input-clear-wrap { flex: 1 1 auto; min-width: 0; }
.field-inline-action .btn-secondary { flex: 0 0 auto; white-space: nowrap; }
.order-mode-tabs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.reg-mode-tab {
  min-height: 58px; display: flex; flex-direction: column; align-items: flex-start;
  justify-content: center; gap: 2px; padding: 9px 14px;
  border: 0; border-radius: 10px; background: transparent; text-align: left;
}
.reg-mode-tab span { font-size: 13px; font-weight: 650; }
.reg-mode-tab[data-reg-mode], .order-mode-tab {
  flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px;
}
.reg-channel-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: 0 0 36px;
  border: 1px solid var(--color-border-light); border-radius: 9px; background: #fff;
}
.reg-channel-logo { display: block; width: 24px; height: 24px; object-fit: contain; }
.reg-mode-tab[data-reg-mode="tmall"] .reg-channel-logo,
.order-mode-tab[data-order-mode="tmall"] .reg-channel-logo { width: 28px; }
.reg-channel-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.reg-channel-title { line-height: 1.35; }
.reg-mode-tab:disabled { cursor: not-allowed; opacity: .48; }
.reg-mode-tab.reg-mode-active {
  background: var(--color-surface); color: var(--color-text);
  box-shadow: 0 2px 8px rgba(31,37,33,.08), inset 3px 0 0 var(--color-brand);
}
/* 请求预览弹窗：注册会员与各类订单共用 */
.modal-overlay.preview-overlay { padding: 24px; }
.modal-box.preview-box {
  display: flex; flex-direction: column; overflow: hidden;
  width: min(920px, 94vw); padding: 0;
  max-height: min(760px, calc(100vh - 48px));
}
.preview-box-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--color-border-light);
}
.preview-box-heading { min-width: 0; }
.preview-box-heading h3 { margin: 0 0 5px; font-size: 16px; font-weight: 620; }
.preview-box-desc { margin: 0; color: var(--color-text-muted); font-size: 12px; line-height: 1.6; }
.preview-box-x {
  flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center;
  margin: -2px -4px 0 0;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-text-muted);
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast);
}
.preview-box-x:hover { background: var(--color-surface-muted); color: var(--color-text); border-color: var(--color-border-light); }
.preview-box-x:focus-visible { outline-offset: 0; }
.preview-box-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 20px 18px; }
.preview-box-status { color: var(--color-text-secondary); font-size: 12px; }
.preview-box-status:empty { display: none; }
.preview-box-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 20px; border-top: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
}
.preview-box-note { color: var(--color-text-muted); font-size: 11.5px; }
.request-preview-step {
  margin-top: 12px; padding: 14px; min-width: 0;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-md);
  background: var(--color-surface);
}
.request-preview-step:first-child { margin-top: 10px; }
.request-preview-step h4 { margin: 0 0 8px; font-size: 13px; }
.request-preview-step-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.request-preview-step-head h4 { margin: 0; min-width: 0; }
.request-preview-copy {
  flex: 0 0 auto; padding: 4px 10px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text-secondary);
  font-size: 11.5px; line-height: 1.5; cursor: pointer; white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast);
}
.request-preview-copy:hover { background: var(--color-surface-muted); color: var(--color-text); }
.request-preview-copy:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.request-preview-copy.is-copied { color: var(--color-brand); border-color: var(--color-brand); }
.request-preview-copy.is-failed { color: var(--color-danger); border-color: var(--color-danger); }
/* 命令里还有 [提交时…] 占位，复制前先提醒要替换 */
.request-preview-copy.is-pending { border-style: dashed; }
.request-preview-step code {
  display: block; overflow-wrap: anywhere;
  font-size: 12px; color: var(--color-text-secondary);
}
.request-preview-step pre {
  margin: 10px 0 0; max-height: 320px; overflow: auto; white-space: pre-wrap;
  overflow-wrap: anywhere; font-size: 12px; line-height: 1.6;
  padding: 12px; border-radius: var(--radius-sm); background: var(--color-surface-muted);
}
.request-preview-step pre:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
@media (max-width: 720px) {
  .modal-overlay.preview-overlay { padding: 10px; }
  .modal-box.preview-box { width: 100%; max-height: calc(100vh - 20px); }
  .preview-box-head { padding: 14px 14px 12px; }
  .preview-box-body { padding: 12px 14px 14px; }
  .preview-box-foot { padding: 10px 14px; justify-content: flex-end; }
  .preview-box-note { display: none; }
}
.register-form-section {
  padding: 18px; margin-bottom: 12px;
  border: 1px solid var(--color-border-light) !important;
  border-radius: var(--radius-lg); background: var(--color-surface-muted);
}
.register-error-summary {
  margin-bottom: 14px; padding: 13px 15px;
  border: 1px solid #efd1d1; border-left: 3px solid var(--color-danger);
  border-radius: var(--radius-md); background: var(--color-danger-bg);
  color: var(--color-danger);
}
.register-error-summary strong { display: block; margin-bottom: 4px; font-size: 13px; }
.register-error-summary:focus { outline: 2px solid var(--color-danger); outline-offset: 2px; }
.register-error-summary ul { margin: 0; padding-left: 18px; }
.register-error-summary a {
  color: inherit; font-size: 11px; text-decoration: underline;
  text-underline-offset: 2px;
}
/* 渠道开关：并进「01 注册身份」第三列，与品牌/手机号同一行，不再单独占一条卡片 */
.field-switch .field-title {
  display: block; margin-bottom: 6px;
  color: var(--color-text-secondary); font-size: 12.5px;
  font-weight: 600; letter-spacing: .1px;
}
.field label.channel-switch {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 43px; margin: 0; padding: 0;
  color: var(--color-text-secondary); font-size: 12.5px; font-weight: 500;
  letter-spacing: 0; cursor: pointer; user-select: none;
}
.field label.channel-switch:hover .channel-switch-name { color: var(--color-text); }
.field-switch .field-hint { margin-top: 2px; }

.wechat-register-layout {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 14px; align-items: start;
}
.wechat-register-main { min-width: 0; }
.register-section-heading {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px;
}
.register-section-heading .form-section-label { margin: 1px 0 2px; }
.register-section-heading p {
  margin: 0; color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.5;
}
.register-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex: 0 0 28px;
  border: 1px solid #d8c5bb; border-radius: 9px;
  background: var(--color-surface); color: #684637;
  font-size: var(--text-xs); font-weight: 750; letter-spacing: .4px;
}
.field-hint {
  margin-top: 4px; color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.45;
}
.register-form-section .field input,
.register-form-section .field select { background-color: var(--color-surface); }
.privacy-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.privacy-heading .form-section-label { margin-bottom: 3px; }
.privacy-heading .register-section-heading { margin-bottom: 0; }
.privacy-heading p { margin: 0; color: var(--color-text-muted); font-size: 11px; }
.privacy-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.privacy-option {
  display: flex; align-items: flex-start; gap: 9px; min-height: 62px;
  padding: 11px; border: 1px solid var(--color-border-light);
  border-radius: 10px; background: var(--color-surface); cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.privacy-option:has(input:checked) { border-color: #cdb7ac; background: #fcf8f5; }
.privacy-option input { margin: 3px 0 0; accent-color: var(--color-brand); }
.privacy-option span { display: flex; flex-direction: column; gap: 2px; }
.privacy-option strong { font-size: 12px; font-weight: 650; }
.privacy-option small { color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.45; }
.privacy-heading-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.privacy-heading-actions .btn-secondary {
  min-height: 30px; padding: 4px 14px;
  border-radius: var(--radius-full); font-size: 12px;
}
/* BMS 隐私授权矩阵：卡片化表格，行首「全选」独立成控制列 */
.bms-privacy-matrix-wrap {
  overflow-x: auto; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.bms-privacy-matrix {
  width: 100%; min-width: 660px;
  border-collapse: separate; border-spacing: 0; font-size: 12px;
}
.bms-privacy-matrix th,
.bms-privacy-matrix td {
  padding: 11px 10px; border-bottom: 1px solid var(--color-border-light);
}
.bms-privacy-matrix thead th {
  padding: 9px 10px; border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-muted); color: var(--color-text-secondary);
  font-size: 12px; font-weight: 650; letter-spacing: .2px;
  text-align: center; white-space: nowrap;
}
.bms-privacy-matrix thead th:nth-child(1) { width: 70px; }
.bms-privacy-matrix thead th:nth-child(2) { width: 172px; padding-left: 16px; text-align: left; }
.bms-privacy-matrix thead th small,
.bms-privacy-matrix tbody th small {
  display: block; margin-top: 3px; color: var(--color-text-muted);
  font-size: var(--text-xs); font-weight: 400; letter-spacing: .1px;
}
.bms-privacy-matrix thead th:nth-child(1),
.bms-privacy-matrix .bms-privacy-row-all {
  border-right: 1px solid var(--color-border-light);
  background: rgba(32, 37, 33, .015); text-align: center;
}
/* 四类授权之间加浅分隔线，宽屏下也容易横向对齐 */
.bms-privacy-matrix thead th:nth-child(n+3),
.bms-privacy-matrix tbody td:nth-child(n+3) {
  border-left: 1px solid var(--color-border-light);
}
.bms-privacy-matrix tbody th {
  padding-left: 16px; text-align: left; font-weight: 650; white-space: nowrap;
}
.bms-privacy-brand-code {
  display: inline-flex; align-items: center; height: 21px; padding: 0 8px;
  border: 1px solid var(--color-border); border-radius: 6px;
  background: var(--color-surface); color: var(--color-text);
  font-size: 12px; font-weight: 700; letter-spacing: .6px;
}
.bms-privacy-matrix tbody td { text-align: center; }
.bms-privacy-matrix tbody tr { transition: background var(--transition-fast); }
.bms-privacy-matrix tbody tr:has(.bms-privacy-row-toggle:checked) {
  background: rgba(141, 100, 82, .05);
}
.bms-privacy-matrix tbody tr:hover { background: rgba(141, 100, 82, .085); }
.bms-privacy-matrix tbody tr:last-child th,
.bms-privacy-matrix tbody tr:last-child td { border-bottom: 0; }
/* 自绘勾选框：勾选实心、半选横杠，与品牌色统一 */
.bms-privacy-matrix input[type="checkbox"] {
  position: relative; width: 18px; height: 18px; margin: 0;
  border: 1.5px solid #cbc5ba; border-radius: 5px;
  background: var(--color-surface); cursor: pointer; vertical-align: middle;
  -webkit-appearance: none; appearance: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.bms-privacy-matrix input[type="checkbox"]:hover { border-color: var(--color-brand); }
.bms-privacy-matrix input[type="checkbox"]:checked,
.bms-privacy-matrix input[type="checkbox"]:indeterminate {
  border-color: var(--color-brand); background: var(--color-brand);
}
.bms-privacy-matrix input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 5px; top: 2px;
  width: 6px; height: 10px;
  border: solid #fff; border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg);
}
.bms-privacy-matrix input[type="checkbox"]:indeterminate::after {
  content: ""; position: absolute; left: 4px; top: 7px;
  width: 8px; height: 2px; border-radius: 1px; background: #fff;
}
.bms-privacy-matrix input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .5; }
/* 订单页渠道说明：一行标题 + ⓘ，正文收进浮层，不再常驻占掉首屏 */
/* 订单页说明统一收进标题旁的「?」：标题行只占一行，正文点开才看 */
.order-heading-main {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex-wrap: wrap;
}
.order-heading-main h2 { margin: 0; }
.order-heading-main .section-help { font-size: 11px; }

/* 说明按钮：视觉只留 18px 的小圆点，点按区由透明的按钮本体承载（桌面 32 / 窄屏 44）。
   之前直接给 .section-help 加 min-width/min-height:32px 会把圆圈本身撑大，标题行显得笨重。 */
.section-help {
  position: relative;
  flex: 0 0 auto; display: inline-grid; place-items: center;
  width: 32px; height: 32px; min-width: 32px; min-height: 32px;
  margin: 0; padding: 0;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--color-text-muted);
  font: inherit; font-size: var(--text-xs); line-height: 1; font-weight: 600;
  letter-spacing: 0; cursor: pointer;
  transition: color var(--transition-fast);
}
.section-help::before {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 18px; height: 18px; box-sizing: border-box;
  transform: translate(-50%, -50%);
  border: 1px solid var(--color-border); border-radius: 50%;
  background: var(--color-surface);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.section-help > span { position: relative; z-index: 1; }
.section-help:hover { color: var(--color-text-secondary); }
.section-help:hover::before { border-color: #c5c2ba; }
.section-help[aria-expanded="true"] { color: var(--color-brand); }
.section-help[aria-expanded="true"]::before {
  border-color: var(--color-brand); background: var(--color-brand-soft);
}
.section-help:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

.section-help-pop {
  position: fixed; z-index: 1200; left: 0; top: 0;
  max-width: min(340px, calc(100vw - 24px)); padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #262320; color: #f8f5f0;
  font-size: 11px; line-height: 1.55;
  box-shadow: 0 8px 22px rgba(31, 27, 23, .22);
  opacity: 0; visibility: hidden; transform: translateY(-3px);
  /* visibility 是离散属性：淡出结束后再隐藏，避免过渡期间被卡在 hidden */
  transition: opacity var(--transition-fast), transform var(--transition-fast),
              visibility 0s linear var(--transition-fast);
  pointer-events: none;
}
.section-help-pop.is-open {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: opacity var(--transition-fast), transform var(--transition-fast),
              visibility 0s linear 0s;
}
/* 注册页京东 Tab：xid 开关独占一行，在「01 注册身份」末尾说明请求是否携带 pin */
[data-panel="register"] .xid-toggle-option {
  grid-column: 1 / -1;
  align-self: center;
  min-height: 0;
  margin: 2px 0 0;
}
.register-success {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 14px; padding: 13px 15px; border: 1px solid #cce3d6;
  border-radius: var(--radius-lg); background: var(--color-success-bg);
}
.register-success > div { display: flex; flex-direction: column; gap: 2px; }
.register-success strong { color: var(--color-success); font-size: 13px; }
.register-success span { color: #51705f; font-size: 11px; }
.register-success-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.register-actions { margin-top: var(--space-5); }
.register-submit-context { color: var(--color-text-muted); font-size: 12px; }
[data-panel="register"].is-busy .reg-mode-tabs,
[data-panel="register"].is-busy .register-random-btn,
[data-panel="register"].is-busy .privacy-heading button { opacity: .55; pointer-events: none; }
.members-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
}
.members-heading .panel-description { margin-bottom: 0; }
.members-primary-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-wrap: wrap;
}
.members-overview {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.member-stat {
  min-height: 66px; display: flex; flex-direction: column; justify-content: space-between;
  gap: 6px; padding: 11px 14px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg); background: var(--color-surface-muted);
  text-align: left; font: inherit; cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.member-stat:hover { border-color: var(--color-border); background: var(--color-surface); }
.member-stat:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.member-stat.is-active {
  border-color: var(--color-brand); background: var(--color-brand-soft);
  box-shadow: inset 0 0 0 1px var(--color-brand);
}
.member-stat-label { color: var(--color-text-secondary); font-size: 11px; font-weight: 600; }
.member-stat strong { color: var(--color-text); font-size: 21px; font-weight: 600; line-height: 1; }
.member-stat.is-active .member-stat-label { color: var(--color-brand); }
.member-stat-warn strong { color: var(--color-warning); }
.members-toolbar { align-items: center; margin-bottom: 10px; }
.members-toolbar .input-clear-wrap { flex: 1 1 260px; min-width: 180px; }
.members-summary {
  margin-left: auto; padding: 0 2px; text-align: right;
  color: var(--color-text-muted); font-size: var(--text-sm); white-space: nowrap;
}
.members-filters { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; }
.members-filters .choice-chips { flex: 0 1 auto; max-width: 100%; min-width: 0; }

/* 加载态骨架 */
.members-skeleton { display: grid; gap: 8px; padding: 4px 0; }
.members-skeleton-row {
  height: 54px; border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-surface-muted) 25%, #f6f3ee 37%, var(--color-surface-muted) 63%);
  background-size: 400% 100%;
  animation: members-skeleton-sweep 1.4s ease infinite;
}
@keyframes members-skeleton-sweep {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .members-skeleton-row { animation: none; }
}
/* 会员表 6 列：定宽布局，长 ID 一律省略号，不再靠横向滚动看全 */
#members-table-wrap .members-table { min-width: 0; table-layout: fixed; }
.members-table th:nth-child(1) { width: 24%; }
.members-table th:nth-child(2) { width: 15%; }
.members-table th:nth-child(3) { width: 24%; }
.members-table th:nth-child(4) { width: 12%; }
.members-table th:nth-child(5) { width: 13%; }
.members-table th:nth-child(6) { width: 12%; }
/* 订单表：定宽列 + 长文本截断，避免「成功」被挤成竖排、操作列压住相邻列 */
#orders-table-wrap .orders-table {
  width: 100%; min-width: 1040px;
  table-layout: fixed; font-variant-numeric: tabular-nums;
}
#orders-table-wrap .orders-table th,
#orders-table-wrap .orders-table td { white-space: nowrap; }
#orders-table-wrap .orders-table th:nth-child(1) { width: 9%; }
#orders-table-wrap .orders-table th:nth-child(2) { width: 6%; }
#orders-table-wrap .orders-table th:nth-child(3) { width: 16%; }
#orders-table-wrap .orders-table th:nth-child(4) { width: 28%; }
#orders-table-wrap .orders-table th:nth-child(5) { width: 12%; }
#orders-table-wrap .orders-table th:nth-child(6) { width: 5%; }
#orders-table-wrap .orders-table th:nth-child(7) { width: 8%; }
#orders-table-wrap .orders-table th:nth-child(8) { width: 8%; }
#orders-table-wrap .orders-table th:nth-child(9) { width: 8%; }
#orders-table-wrap .orders-table th:nth-child(6),
#orders-table-wrap .orders-table th:nth-child(7) { text-align: right; }
#orders-table-wrap .orders-table td.order-cell-num { text-align: right; }
#orders-table-wrap .orders-table td.order-cell-clamp {
  overflow: hidden; text-overflow: ellipsis;
}
/* 隔行浅底色：9 列数据宽，斑马纹比纯白更好定位同一行 */
#orders-table-wrap .orders-table tbody tr:nth-child(even),
#orders-table-wrap .orders-table tbody tr:nth-child(even) td:last-child {
  background: #fbfaf5;
}
#orders-table-wrap .orders-table tbody tr:hover,
#orders-table-wrap .orders-table tbody tr:hover td:last-child { background: #f6f2ea; }
/* 表头是 sticky（继承自 .members-table thead 的 z-index: 1），操作列也是 sticky。
   两层必须拉开层级，否则纵向滚动时操作列的按钮会盖住表头「操作」。 */
#orders-table-wrap .orders-table thead { z-index: 3; }
#orders-table-wrap .orders-table th:last-child,
#orders-table-wrap .orders-table td:last-child {
  position: sticky; right: 0;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border-light);
  box-shadow: -10px 0 14px -10px rgba(31, 37, 33, .28);
}
#orders-table-wrap .orders-table td:last-child { z-index: 2; }
#orders-table-wrap .orders-table th:last-child { z-index: 4; background: #f1eee8; }
#orders-table-wrap .orders-table th:last-child,
#orders-table-wrap .orders-table td:last-child { text-align: center; }
#orders-table-wrap .orders-table td:last-child .order-action-buttons { justify-content: center; }

/* 下单时间拆成「日期 / 时刻」两行，窄列里也保持整齐 */
.order-time-date { display: block; color: var(--color-text); font-size: 12.5px; }
.order-time-clock {
  display: block; margin-top: 1px; color: var(--color-text-muted);
  font-size: 11.5px; font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

/* 状态胶囊：比裸文字更耐窄列，也更容易一眼扫完 */
.order-status-group {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
}
.order-status-group .order-level-badge { margin-left: 0; }
.order-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 600; line-height: 1.7; white-space: nowrap;
}
.order-status-pill.is-ok { background: var(--color-success-bg); color: #276653; }
.order-status-pill.is-failed { background: var(--color-danger-bg); color: var(--color-danger); }
.order-status-pill .status-dot { width: 6px; height: 6px; }
.order-status-pill.is-ok .status-dot { background: #3f8d68; }
.order-status-pill.is-failed .status-dot { background: var(--color-danger); }
.member-badge-bms { background: #edf4ef; color: #37634a; }
.member-badge-bms-pending { background: var(--color-warning-bg); color: var(--color-warning); }
.member-badge-unknown {
  background: transparent; color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
}
.member-badge-fail { background: var(--color-danger-bg); color: var(--color-danger); }

/* 单元格内部：主行 + 副行 */
.member-cell-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.member-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--color-text); font-size: 13px; font-weight: 600;
}
.member-name.is-empty { color: var(--color-text-muted); font-weight: 400; }
.member-source {
  flex: 0 0 auto; padding: 1px 6px; font-size: var(--text-xs); font-weight: 600; line-height: 1.6;
}
.member-cell-meta { margin-top: 2px; color: var(--color-text-muted); font-size: 11px; }
.member-mobile {
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.member-ids { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.member-id-copy {
  display: block; max-width: 100%; padding: 0; border: 0; background: none;
  color: var(--color-text-secondary); font: inherit;
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  font-size: 11.5px; line-height: 1.5; text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member-id-copy:hover { color: var(--color-accent); text-decoration: underline; }
.member-id-copy.member-bms { color: var(--color-text-muted); }
.member-id-missing { color: var(--color-text-muted); font-size: 12px; }
.member-bms-pending { color: var(--color-warning); font-size: 11px; font-weight: 600; }
.member-time { position: relative; display: flex; flex-direction: column; gap: 2px; }
.member-time-date { color: var(--color-text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.member-time-clock { color: var(--color-text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.member-fail-dot {
  position: absolute; left: -11px; top: 5px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--color-danger);
}
.members-table tr.is-failed .member-name { color: var(--color-danger); }
.member-actions-cell { text-align: right; }
.member-actions-cell .import-actions { justify-content: flex-end; flex-wrap: nowrap; }
.member-actions-cell .btn-import { white-space: nowrap; }

/* 表头排序 */
.th-sort {
  display: inline-flex; align-items: center; gap: 4px; padding: 0;
  border: 0; background: none; color: inherit; font: inherit;
  font-size: 11px; letter-spacing: .35px; cursor: pointer;
}
.th-sort:hover { color: var(--color-text); }
.th-sort-arrow { font-size: var(--text-xs); color: var(--color-text-muted); }
.members-table th[aria-sort] .th-sort { color: var(--color-text); }
.members-table th.th-actions { text-align: right; }

.btn-more-actions {
  width: 30px; min-width: 30px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-surface);
  color: var(--color-text-secondary); font-size: 15px; line-height: 1;
}
.btn-more-actions:hover, .btn-more-actions[aria-expanded="true"] {
  border-color: var(--color-brand); color: var(--color-brand); background: var(--color-brand-soft);
}
.member-action-layer { position: fixed; inset: 0; z-index: 1200; pointer-events: none; }
.member-action-scrim {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0;
  border-radius: 0; background: transparent; pointer-events: auto;
}
.member-action-sheet {
  position: fixed; width: 280px; max-height: calc(100vh - 24px);
  overflow-y: auto; padding: 10px;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: member-action-in .16s ease-out;
}
@keyframes member-action-in {
  from { opacity: 0; transform: translateY(-6px); }
}
.member-action-sheet::-webkit-scrollbar { width: 6px; }
.member-action-sheet::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--color-border); }
.member-action-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 6px 6px 10px;
}
.member-action-eyebrow {
  margin-bottom: 2px; color: var(--color-text-muted);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .7px;
}
#member-action-title { display: block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-action-close {
  width: 30px; height: 30px; display: grid; place-items: center;
  padding: 0; border-radius: 50%; background: var(--color-surface-muted);
  color: var(--color-text-muted); font-size: 20px; line-height: 1;
}
.member-action-group { padding: 6px 0; border-top: 1px solid var(--color-border-light); }
.member-action-group-label {
  padding: 4px 8px 5px; color: var(--color-text-muted);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .5px;
}
.member-action-option {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start;
  gap: 1px; padding: 8px; border-radius: 8px; background: transparent;
  color: var(--color-text); text-align: left;
}
.member-action-option:hover { background: var(--color-surface-muted); }
.member-action-option:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.member-action-option span { font-size: 13px; font-weight: 600; }
.member-action-option small { color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 400; }
.member-action-option:disabled { cursor: not-allowed; opacity: .42; background: transparent; }
.member-action-danger span { color: var(--color-danger); }
.member-action-danger:hover { background: var(--color-danger-bg); }
#members-table-wrap, #orders-table-wrap {
  border-radius: var(--radius-lg) !important; background: var(--color-surface);
}
.members-table th {
  height: 42px; padding: 9px 12px; background: #f1eee8;
  color: #66665f; font-size: 11px; letter-spacing: .35px;
}
.members-table td { height: 48px; padding: 10px 12px; }
.members-table tbody tr { transition: background var(--transition-fast); }
.members-table tbody tr:hover { background: #f6f2ea; }
.action-log-empty {
  padding: 54px 16px; border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface-muted);
}
.modal-overlay {
  padding: 20px; background: rgba(20, 24, 21, .48); backdrop-filter: blur(4px);
}
.modal-box {
  max-height: calc(100vh - 40px); overflow-y: auto;
  border: 1px solid rgba(255,255,255,.5); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.toast { top: 24px; border-radius: var(--radius-full); }
[hidden] { display: none !important; }

@media (max-width: 1023px) {
  body { padding: 12px; }
  .page-grid { grid-template-columns: 1fr; }
  .page-nav {
    position: sticky; top: 8px; z-index: 20; flex-direction: row;
    padding: 6px; overflow-x: auto; box-shadow: var(--shadow-md); scrollbar-width: none;
  }
  .page-nav::-webkit-scrollbar { display: none; }
  .nav-section-label { display: none; }
  .nav-item { flex: 0 0 auto; min-height: 40px; }
  .nav-item-active { box-shadow: inset 0 -3px 0 var(--color-brand); }
  .members-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .members-heading { flex-direction: column; }
  .members-primary-actions { justify-content: flex-start; }
  .register-heading { flex-direction: column; }
  .wechat-register-layout { grid-template-columns: 1fr; }
  .order-review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  #members-table-wrap {
    max-height: none; overflow: visible; border: 0; background: transparent;
  }
  #members-table-wrap .members-table {
    min-width: 0; width: 100%; table-layout: auto; display: block;
  }
  #members-table-wrap .members-table thead { display: none; }
  #members-table-wrap .members-table tbody { display: grid; gap: 10px; }
  #members-table-wrap .member-id-copy { white-space: normal; overflow-wrap: anywhere; }
  #members-table-wrap .members-table tr {
    width: 100%; min-width: 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
    overflow: visible; border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); background: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }
  #members-table-wrap .members-table td {
    min-width: 0; height: auto; display: flex; flex-direction: column;
    gap: 3px; padding: 10px 12px; border-bottom: 1px solid var(--color-border-light);
    overflow-wrap: anywhere;
  }
  #members-table-wrap .members-table td::before {
    content: attr(data-label); color: var(--color-text-muted);
    font-family: "Inter", "PingFang SC", sans-serif;
    font-size: var(--text-xs); font-weight: 650; letter-spacing: .25px;
  }
  /* 卡片布局：会员整行，手机号与企微并排，其余整行 */
  #members-table-wrap .members-table td:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  #members-table-wrap .members-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  #members-table-wrap .members-table td:nth-child(4) { grid-column: 2; grid-row: 2; }
  #members-table-wrap .members-table td:nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  #members-table-wrap .members-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 4; }
  #members-table-wrap .members-table td:nth-child(6) { grid-column: 1 / -1; grid-row: 5; }
  #members-table-wrap .members-table td:nth-child(5),
  #members-table-wrap .members-table td:nth-child(6) { border-bottom: 0; }
  #members-table-wrap .members-table td:nth-child(6) {
    position: static; background: #faf8f4; box-shadow: none;
  }
  #members-table-wrap .members-table td.member-actions-cell { text-align: left; }
  #members-table-wrap .members-table td.member-actions-cell .import-actions {
    justify-content: flex-start; flex-wrap: wrap;
  }
  #members-table-wrap .members-table td:nth-child(5) .member-time { flex-direction: row; gap: 8px; }
  #members-table-wrap .members-table td:nth-child(5) .member-fail-dot { position: static; align-self: center; }
  .import-actions { flex-wrap: wrap; gap: 6px; }
  .member-action-layer { pointer-events: auto; }
  .member-action-scrim { background: rgba(20,24,21,.46); backdrop-filter: blur(3px); }
  .member-action-sheet {
    left: 0 !important; right: 0; top: auto !important; bottom: 0;
    width: 100%; padding: 14px 14px max(14px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    animation: member-sheet-in .18s ease-out;
  }
  .member-action-option { min-height: 51px; padding: 9px 10px; }
}
@media (max-width: 680px) {
  body { padding: 8px; }
  .page { gap: 10px; }
  .env-bar { min-height: 62px; padding: 10px 12px; border-radius: 16px; }
  .brand-mark { width: 36px; height: 36px; }
  .env-bar-actions { gap: 5px; }
  .user-session-name { display: none; }
  .user-session-trigger { min-width: 44px; min-height: 44px; justify-content: center; padding: 6px; }
  .user-session-action,
  .user-session-logout { min-height: 44px; }
  .user-session-menu { min-width: 168px; right: 12px; }
  .env-switch button { min-width: 40px; padding: 4px 7px; }
  .status-bar {
    max-width: none; min-width: 0; overflow: visible;
    position: relative; padding: 3px;
  }
  .health-compact { display: inline-flex; }
  .status-items { display: none; }
  .status-bar.is-open .status-items {
    display: flex; position: absolute; top: calc(100% + 8px); right: 0; z-index: 950;
    flex-direction: column; align-items: stretch; gap: 2px;
    min-width: 168px; max-width: calc(100vw - 32px); padding: 8px;
    border: 1px solid rgba(255,255,255,.14); border-radius: 12px;
    background: #2b302c; box-shadow: 0 14px 34px rgba(16,20,17,.28);
  }
  .status-bar.is-open .status-item { font-size: 12px; padding: 6px 8px; }
  .status-item + .status-item::before { display: none; }
  .page-grid, .page-content { gap: 10px; }
  .nav-label { display: none; }
  .nav-item { width: 42px; justify-content: center; padding: 8px; }
  .nav-icon { transform: scale(1); }
  .card { min-height: 0; padding: 20px 16px; border-radius: 16px; }
  .card h2 { font-size: 19px; }
  .panel-description { margin-bottom: 18px; }
  [data-panel="register"] .field input,
  [data-panel="register"] .field select { font-size: 16px; }
  .fields { grid-template-columns: 1fr; }
  .fields.fields-thirds { grid-template-columns: minmax(0, 1fr); }
  .douyin-sku-section-header { align-items: flex-start; }
  .douyin-sku-list-actions { align-items: stretch; flex-direction: column; }
  .douyin-sku-list-actions button { min-height: 44px; width: 100%; }
  .field[style*="grid-column"] { grid-column: auto !important; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .btn-submit { width: 100%; }
  .shop-filter select { flex: 1 1 120px; min-width: 0; }
  .orders-search { flex-wrap: wrap; }
  .orders-search .input-clear-wrap { flex: 1 1 100%; }
  .orders-search button { flex: 1 1 100%; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { width: 100%; max-width: none; max-height: 88vh; border-radius: 18px 18px 0 0; }
  .modal-actions button { min-height: 44px; }
  .bms-refund-summary { grid-template-columns: 1fr; }
  .toast { top: 12px; width: calc(100% - 24px); text-align: center; }
  .members-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .member-stat { min-height: 68px; padding: 11px 12px; }
  .member-stat strong { font-size: 20px; }
  .member-stat .member-stat-label { white-space: nowrap; }
  .members-primary-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .members-primary-actions button:last-child { grid-column: 1 / -1; }
  .members-toolbar .input-clear-wrap,
  .members-toolbar > button { flex: 1 1 100%; width: 100%; }
  .members-filters .choice-chips { flex: 1 1 100%; }
  .members-summary { margin-left: 0; text-align: left; white-space: normal; }
  .register-random-btn { width: 100%; justify-content: center; }
  .reg-mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reg-mode-tab[data-reg-mode], .order-mode-tab { gap: 8px; padding: 9px 10px; }
  .reg-channel-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 8px; }
  .reg-channel-logo { width: 22px; height: 22px; }
  .reg-mode-tab[data-reg-mode="tmall"] .reg-channel-logo,
  .order-mode-tab[data-order-mode="tmall"] .reg-channel-logo { width: 24px; }
  .privacy-options { grid-template-columns: 1fr; }
  .privacy-heading { flex-direction: column; }
  .privacy-heading-actions { width: 100%; }
  .privacy-heading button { width: 100%; }
  .privacy-heading-actions .btn-secondary {
    width: 100%; min-height: 40px; padding: 6px 14px;
    border-radius: var(--radius-md); font-size: 13px;
  }
  .register-success { align-items: stretch; flex-direction: column; }
  .register-success button { width: 100%; }
  .register-actions { flex-direction: column; align-items: stretch; }
  .order-shop-filter { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; }
  .order-review-grid { grid-template-columns: 1fr 1fr; }
  .order-review-heading { align-items: flex-start; }
  .bms-submit-progress { grid-template-columns: 1fr; }
  .bms-progress-connector { width: 1px; height: 18px; margin-left: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important; animation-duration: .01ms !important;
    animation-iteration-count: 1 !important; transition-duration: .01ms !important;
  }
}
@keyframes member-sheet-in {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   Frequently used websites
   ============================================================ */
.bookmark-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.bookmark-heading h2 { margin-bottom: 6px; }
.bookmark-heading .panel-description { margin-bottom: 0; }
.bookmark-heading .btn-primary { flex: 0 0 auto; }
.bookmark-summary {
  margin-bottom: 12px;
  color: var(--color-text-muted);
  font-size: 12px;
}
.bookmark-empty {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  text-align: center;
}
.bookmark-empty strong {
  color: var(--color-text);
  font-size: 15px;
}
.bookmark-empty .btn-secondary { margin-top: 8px; }
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.bookmark-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.bookmark-card:hover {
  border-color: #c9b8ae;
  box-shadow: var(--shadow-md);
}
.bookmark-card-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  color: inherit;
  text-decoration: none;
}
.bookmark-card-main:focus-visible {
  outline: 3px solid rgba(141,100,82,.32);
  outline-offset: -3px;
}
.bookmark-initial {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--color-brand-soft);
  color: #684637;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
}
.bookmark-copy { min-width: 0; }
.bookmark-copy strong {
  display: block;
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.bookmark-host {
  display: block;
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.bookmark-description {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.bookmark-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: auto;
  padding: 8px 10px;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
}
.bookmark-action {
  min-width: 48px;
  padding: 6px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 12px;
}
.bookmark-action:hover {
  border-color: var(--color-border);
  background: var(--color-surface);
}
.bookmark-action-danger { color: var(--color-danger); }
.bookmark-modal-box textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  line-height: 1.5;
  outline: none;
}
.bookmark-modal-box textarea:focus { border-color: var(--color-accent); }
.field-help {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.5;
}

/* ============================================================
   Server-persisted memos
   ============================================================ */
.memo-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 18px;
}
.memo-heading h2 { margin-bottom: 6px; }
.memo-heading .panel-description { margin-bottom: 0; }
.memo-heading .btn-primary { flex: 0 0 auto; min-height: 44px; }
.memo-summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
  color: var(--color-text-muted); font-size: 12px;
}
.memo-status {
  flex: 0 0 auto; padding: 5px 10px;
  border: 1px solid var(--color-border); border-radius: var(--radius-full);
  background: var(--color-surface-muted); color: var(--color-text-muted);
  font-size: 11px; font-weight: 650;
}
.memo-status.is-dirty {
  border-color: #dfc59e; background: var(--color-warning-bg);
  color: var(--color-warning);
}
.memo-status.is-saved {
  border-color: #b9d8c4; background: var(--color-success-bg);
  color: var(--color-success);
}
.memo-workspace {
  display: grid; grid-template-columns: minmax(220px, .36fr) minmax(0, 1fr);
  gap: 14px; align-items: stretch;
}
.memo-list-panel {
  min-width: 0; max-height: 560px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface-muted);
}
.memo-filter {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 8px; padding: 2px;
}
.memo-search {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  outline: none; background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: 12px; line-height: 1.5;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.memo-search:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 12%, transparent);
}
.memo-category-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.memo-chip {
  padding: 3px 10px; border: 1px solid var(--color-border);
  border-radius: var(--radius-full); background: var(--color-surface);
  color: var(--color-text-muted); font: inherit; font-size: 11px;
  font-weight: 650; line-height: 1.7; cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast),
    background var(--transition-fast);
}
.memo-chip:hover { border-color: var(--color-text-muted); color: var(--color-text); }
.memo-chip.is-active {
  border-color: var(--color-accent); background: var(--color-accent);
  color: #fff;
}
.memo-chip span { margin-left: 5px; opacity: .7; font-weight: 500; }
.memo-list { display: flex; flex-direction: column; gap: 7px; }
.memo-list-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 6px;
}
.memo-list-head strong { flex: 1 1 auto; min-width: 0; }
.memo-pin-mark {
  flex: 0 0 auto; padding: 0 7px; border: 1px solid #dfc59e;
  border-radius: var(--radius-full); background: var(--color-warning-bg);
  color: var(--color-warning); font-size: var(--text-xs); font-weight: 700;
  line-height: 1.7;
}
.memo-list-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: auto;
}
.memo-list-foot time { margin-top: 0; }
.memo-category-badge {
  display: inline-flex; align-items: center; max-width: 100%;
  padding: 1px 8px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-full); background: var(--color-surface-muted);
  color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 600;
  line-height: 1.7; overflow-wrap: anywhere;
}
.memo-category-badge.is-uncategorized {
  border-style: dashed; background: transparent;
}
.memo-list-item {
  width: 100%; min-height: 84px; display: flex; flex-direction: column;
  align-items: stretch; gap: 4px; padding: 12px;
  border: 1px solid transparent; border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
  box-shadow: var(--shadow-sm); text-align: left;
}
.memo-list-item:hover { border-color: var(--color-border); background: var(--color-bg); }
.memo-list-item.is-selected {
  border-color: var(--color-accent); background: var(--color-brand-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 10%, transparent);
}
.memo-list-item strong {
  font-size: 13px; line-height: 1.45; overflow-wrap: anywhere;
}
.memo-list-preview {
  display: -webkit-box; overflow: hidden; color: var(--color-text-secondary);
  font-size: 11px; font-weight: 400; line-height: 1.45;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.memo-list-item time {
  margin-top: auto; color: var(--color-text-secondary); font-size: var(--text-xs);
  font-weight: 450;
}
.memo-empty {
  min-height: 220px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 24px 14px;
  color: var(--color-text-muted); text-align: center; font-size: 12px;
}
.memo-empty strong { color: var(--color-text); font-size: 14px; }
.memo-empty .btn-secondary { min-height: 44px; margin-top: 6px; }
.memo-editor {
  min-width: 0; padding: 16px; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface);
}
.memo-editor-heading {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.memo-editor-heading strong { color: var(--color-text); font-size: 14px; }
.memo-editor-heading span { color: var(--color-text-muted); font-size: var(--text-xs); }
.memo-field { display: flex; flex-direction: column; gap: 7px; }
.memo-field + .memo-field { margin-top: 10px; }
.memo-field-row {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 10px; align-items: start;
}
.memo-field-row .memo-field + .memo-field { margin-top: 0; }
.memo-field-row + .memo-field { margin-top: 10px; }
.memo-hint { color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.5; }
.memo-field label {
  color: var(--color-text-secondary); font-size: 12px; font-weight: 650;
}
.memo-field input,
.memo-field textarea {
  width: 100%; box-sizing: border-box;
  padding: 14px 16px; border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg); outline: none;
  background: var(--color-bg); color: var(--color-text);
  font: inherit; font-size: 14px; line-height: 1.5;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.memo-field textarea { min-height: 300px; resize: vertical; line-height: 1.7; }
.memo-field input:focus,
.memo-field textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 14%, transparent);
}
.memo-field.error input,
.memo-field.error textarea {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(155,34,38,.08);
}
.memo-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-top: 12px;
}
.memo-meta {
  min-width: 0; display: flex; flex-direction: column; gap: 3px;
  color: var(--color-text-muted); font-size: 11px; line-height: 1.5;
}
.memo-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.memo-actions button { min-height: 44px; }
.memo-actions button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.memo-delete { color: var(--color-danger); }
.memo-delete:hover { background: var(--color-danger-bg); }
.memo-pin { color: var(--color-text-secondary); }
.memo-pin.is-active {
  border-color: #dfc59e; background: var(--color-warning-bg);
  color: var(--color-warning);
}
.memo-shortcut-hint { color: var(--color-text-muted); }

/* ============================================================
   API directory
   ============================================================ */
.endpoint-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 22px;
}
.endpoint-heading .panel-description { margin-bottom: 0; }
.endpoint-env {
  flex: 0 0 auto; padding: 5px 10px; border: 1px solid #dbcfc7;
  border-radius: var(--radius-full); background: var(--color-brand-soft);
  color: #765244; font-size: var(--text-xs); font-weight: 750; letter-spacing: .7px;
  text-transform: uppercase;
}
.endpoint-summary {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.endpoint-stat {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}
.endpoint-stat span { color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 650; }
.endpoint-stat strong { font-size: 20px; font-weight: 650; line-height: 1.25; }
.endpoint-toolbar {
  display: flex; gap: 8px; margin-bottom: 20px; padding: 10px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}
.endpoint-toolbar .input-clear-wrap { flex: 1; }
.endpoint-toolbar input, .endpoint-toolbar select {
  min-height: 38px; padding: 8px 11px; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background-color: var(--color-surface);
  color: var(--color-text); font: inherit; font-size: 12px;
}
.endpoint-toolbar input { width: 100%; }
.endpoint-toolbar select { min-width: 128px; }
.endpoint-expand-all {
  flex: 0 0 auto; min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text-secondary);
  font: inherit; font-size: 12px; font-weight: 650; cursor: pointer;
  white-space: nowrap;
}
.endpoint-expand-all:hover { border-color: var(--color-brand); color: var(--color-brand); }
.endpoint-section + .endpoint-section { margin-top: 22px; }
.endpoint-section-title {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  width: 100%; margin: 0 2px 8px; padding: 0;
  border: 0; background: transparent; color: #6f5a50;
  font: inherit; font-size: 11px; font-weight: 750; letter-spacing: .55px;
  text-align: left; cursor: pointer;
}
.endpoint-section-title span:last-child {
  margin-left: auto; color: var(--color-text-secondary); font-size: var(--text-xs); font-weight: 600;
}
.endpoint-section-title::after {
  content: "▾"; color: var(--color-text-muted); font-size: 12px;
  transition: transform var(--transition-fast);
}
.endpoint-section.is-collapsed .endpoint-section-title::after { transform: rotate(-90deg); }
.endpoint-section.is-collapsed .endpoint-rows { display: none; }
.endpoint-rows {
  overflow: hidden; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface);
}
.endpoint-row {
  display: grid;
  grid-template-columns: 62px minmax(240px, 1.45fr) minmax(180px, 1fr) auto;
  gap: 14px; align-items: center; min-height: 66px; padding: 11px 13px;
}
.endpoint-row + .endpoint-row { border-top: 1px solid var(--color-border-light); }
.endpoint-method {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; padding: 4px 5px; border-radius: 6px;
  font-family: "SF Mono", Consolas, monospace; font-size: var(--text-xs);
  font-weight: 800; letter-spacing: .3px;
}
.endpoint-method-get { background: #e8f5ee; color: #25624a; }
.endpoint-method-post { background: #f5ece7; color: #82513d; }
.endpoint-method-other { background: #eef0f2; color: #50565b; }
.endpoint-target { min-width: 0; }
.endpoint-target a, .endpoint-target code {
  color: var(--color-text); font-family: "SF Mono", Consolas, monospace;
  font-size: 11px; font-weight: 600; overflow-wrap: anywhere;
}
.endpoint-target a { text-decoration-color: #c9b8ae; text-underline-offset: 3px; }
.endpoint-target a:hover { color: #7a5140; }
.endpoint-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
  color: var(--color-text-muted); font-size: var(--text-xs);
}
.endpoint-status-dot {
  width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #a6aaa7;
}
.endpoint-status-dot.is-ready { background: var(--color-success); }
.endpoint-status-dot.is-missing { background: #c18452; }
.endpoint-copy strong { display: block; font-size: 12px; font-weight: 650; }
.endpoint-copy span { display: block; margin-top: 2px; color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.45; }
.endpoint-copy-btn {
  padding: 6px 9px; border: 1px solid var(--color-border); border-radius: 7px;
  background: var(--color-surface); color: var(--color-text-secondary);
  font: inherit; font-size: var(--text-xs); font-weight: 650; cursor: pointer;
}
.endpoint-copy-btn:hover { border-color: #c5b7ae; background: var(--color-brand-soft); color: #6e493a; }
.endpoint-actions { display: flex; align-items: center; gap: 6px; }
.endpoint-call-btn {
  padding: 6px 10px; border: 1px solid var(--color-border); border-radius: 8px;
  background: var(--color-surface); color: var(--color-text); cursor: pointer; font-size: 11px;
}
.endpoint-call-btn:hover {
  border-color: var(--color-brand); background: var(--color-brand-soft); color: #6e493a;
}
.endpoint-call-btn:disabled { opacity: .45; cursor: not-allowed; }
.endpoint-invoke-box { width: min(760px, calc(100vw - 32px)); }
.endpoint-invoke-grid { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; }
.endpoint-invoke-box textarea {
  width: 100%; min-height: 92px; padding: 10px 12px; resize: vertical;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-bg); color: var(--color-text);
  font: 12px/1.55 "SF Mono", Consolas, monospace; box-sizing: border-box;
}
.endpoint-invoke-box textarea:focus { border-color: var(--color-accent); }
.endpoint-invoke-result {
  max-height: 280px; overflow: auto; margin: 12px 0 0; padding: 12px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: #202522; color: #e9efe9; font: 11px/1.55 "SF Mono", Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.endpoint-empty {
  padding: 44px 16px; border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface-muted);
  color: var(--color-text-muted); text-align: center; font-size: 12px;
}

@media (max-width: 760px) {
  .bookmark-heading { align-items: stretch; flex-direction: column; gap: 12px; }
  .bookmark-heading .btn-primary { width: 100%; }
  .bookmark-grid { grid-template-columns: 1fr; }
  .bookmark-action { min-height: 44px; }
  .memo-heading { align-items: stretch; flex-direction: column; gap: 12px; }
  .memo-heading .btn-primary { width: 100%; }
  .memo-summary { align-items: flex-start; flex-direction: column; }
  .memo-workspace { grid-template-columns: 1fr; }
  .memo-list-panel { max-height: 320px; }
  .memo-editor { padding: 14px; }
  .memo-editor-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .memo-field-row { grid-template-columns: 1fr; }
  .memo-field input,
  .memo-field textarea { min-height: 300px; font-size: 16px; }
  .memo-field input { min-height: 48px; }
  .memo-toolbar { align-items: stretch; flex-direction: column; }
  .memo-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .memo-actions button { min-height: 44px; }
  .memo-actions #memo-save { grid-column: 1 / -1; }
  .endpoint-heading { flex-direction: column; gap: 10px; }
  .endpoint-summary { grid-template-columns: 1fr 1fr; }
  .endpoint-stat:last-child { grid-column: 1 / -1; }
  .endpoint-toolbar { flex-direction: column; }
  .endpoint-toolbar select { width: 100%; }
  .endpoint-row { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 9px; }
  .endpoint-copy { grid-column: 2 / -1; }
  .endpoint-actions { grid-column: 3; grid-row: 1; flex-direction: column; }
  .endpoint-invoke-grid { grid-template-columns: 1fr; }
}

/* Site-wide mobile accessibility and touch-target overrides */
.orders-search {
  padding: 0; border: 0; border-radius: 0; background: transparent;
}
@media (max-width: 680px) {
  html { scroll-padding-top: 84px; }
  body { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  /* 视觉圆圈仍是 18px，只把命中区向外扩到 44px，不占标题行布局 */
  .section-help::after {
    content: ""; position: absolute; inset: -6px; border-radius: 50%;
  }
  .nav-label { display: inline; }
  .nav-item {
    width: auto; min-width: max-content; min-height: 44px;
    justify-content: flex-start; gap: 8px; padding: 8px 11px;
  }
  .page-nav { scrollbar-width: thin; }
  .page-nav::-webkit-scrollbar { display: block; height: 3px; }
  .page-nav::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--color-border); }
  .env-switch button { min-height: 44px; min-width: 44px; }
  input[type="text"], input[type="search"], input[type="url"],
  input[type="number"], select, textarea { font-size: 16px !important; }
  .btn-primary, .btn-secondary, .btn-cancel, .btn-confirm,
  .btn-import, .btn-more-actions, .field-quick-action,
  .endpoint-call-btn, .action-log-clear, .reg-mode-tab,
  .member-action-close, .quantity-stepper button { min-height: 44px; }
  .member-action-close { width: 44px; }
  .quantity-stepper button { width: 44px; }
  .input-clear-wrap input { min-height: 44px; padding-right: 48px; }
  .input-clear-wrap.has-datalist input { padding-right: 96px; }
  .input-clear-btn { right: 0; width: 44px; height: 44px; font-size: 15px; }
  .input-clear-wrap.has-value.has-datalist .input-clear-btn { right: 48px; }
  .input-drop-arrow { right: 0; width: 44px; height: 44px; font-size: 12px; }
  .modal-box {
    max-height: 88dvh;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

/* 平板宽度（≤1023px）也走卡片布局：1040px 的定宽表格在 768px 只能横向滚动，
   且 sticky 操作列常驻右侧，会出现「看得见退单、看不见金额与状态」的危险组合。 */
@media (max-width: 1023px) {
  #orders-table-wrap {
    max-height: none; min-height: 0; overflow: visible;
    border: 0; background: transparent;
  }
  #orders-table-wrap .orders-table { min-width: 0; display: block; }
  #orders-table-wrap .orders-table thead { display: none; }
  #orders-table-wrap .orders-table tbody { display: grid; gap: 10px; }
  #orders-table-wrap .orders-table tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
    overflow: hidden; border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); background: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }
  #orders-table-wrap .orders-table td {
    min-width: 0; height: auto; display: flex; flex-direction: column;
    justify-content: center; gap: 4px; padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
    align-items: flex-start; white-space: normal; overflow-wrap: anywhere;
  }
  #orders-table-wrap .orders-table td::before {
    content: attr(data-label); color: var(--color-text-muted);
    font-size: 11px; font-weight: 650; letter-spacing: .2px;
  }
  /* 卡片分区：时间 / 渠道+状态 / 订单号 / 会员 / SKU / 数量+金额 / 操作 */
  #orders-table-wrap .orders-table td:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  #orders-table-wrap .orders-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  #orders-table-wrap .orders-table td:nth-child(8) { grid-column: 2; grid-row: 2; }
  #orders-table-wrap .orders-table td:nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  #orders-table-wrap .orders-table td:nth-child(4) { grid-column: 1 / -1; grid-row: 4; }
  #orders-table-wrap .orders-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 5; }
  #orders-table-wrap .orders-table td:nth-child(6) { grid-column: 1; grid-row: 6; }
  #orders-table-wrap .orders-table td:nth-child(7) { grid-column: 2; grid-row: 6; }
  #orders-table-wrap .orders-table td:last-child { grid-column: 1 / -1; grid-row: 7; }
  #orders-table-wrap .orders-table td:last-child {
    position: static; background: #faf8f4; box-shadow: none; border-bottom: 0;
    text-align: left;
  }
  #orders-table-wrap .orders-table button { min-height: 44px; }
  #orders-table-wrap .order-action-buttons { width: 100%; justify-content: stretch; }
  #orders-table-wrap .order-action-buttons button { flex: 1 1 120px; }
  /* 卡片布局下不需要截断 / 右对齐 / 粘性操作列 */
  #orders-table-wrap .orders-table td.order-cell-clamp { overflow: visible; text-overflow: clip; }
  #orders-table-wrap .orders-table td.order-cell-num { text-align: left; }
  #orders-table-wrap .orders-table td:last-child { border-left: 0; }
  #orders-table-wrap .order-time-date { font-size: 13px; }
  #orders-table-wrap .order-time-clock { font-size: 12px; }
}
.input-clear-btn:active { transform: translateY(-50%) scale(.98); }
.input-drop-arrow:active { transform: translateY(-50%) scale(.98); }

/* ============================================================
   Application login
   ============================================================ */
body.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: #f1efeb;
}
.login-shell {
  width: min(100%, 980px);
  min-height: 590px;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(360px, .94fr);
  overflow: hidden;
  border: 1px solid rgba(32, 37, 34, .08);
  border-radius: 24px;
  background: var(--color-surface);
  box-shadow: 0 28px 80px rgba(32, 37, 34, .14);
}
.login-intro {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: clamp(32px, 5vw, 56px);
  background: #202522;
  color: #ffffff;
}
.login-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
}
.login-brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .65px;
}
.login-brand-caption {
  margin-top: 1px;
  color: rgba(255,255,255,.56);
  font-size: 11px;
  letter-spacing: .25px;
}
.login-intro-copy {
  max-width: 430px;
}
.login-eyebrow {
  margin: 0 0 12px;
  color: #d4b9ab;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.25px;
  text-transform: uppercase;
}
.login-intro h1 {
  max-width: 390px;
  margin: 0;
  font-size: clamp(32px, 4.5vw, 46px);
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: -1.6px;
}
.login-intro-copy > p:last-child {
  max-width: 430px;
  margin: 22px 0 0;
  color: rgba(255,255,255,.66);
  font-size: 13px;
  line-height: 1.85;
}
.login-trust-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: rgba(255,255,255,.7);
  font-size: 11px;
  list-style: none;
}
.login-trust-list li {
  display: flex;
  align-items: center;
  gap: 9px;
}
.login-trust-list li span {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #72ddb4;
  box-shadow: 0 0 0 4px rgba(114,221,180,.1);
}
.login-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 5vw, 58px);
}
.login-card-heading {
  margin-bottom: 28px;
}
.login-card-kicker {
  color: var(--color-brand);
  font-size: var(--text-xs);
  font-weight: 750;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}
.login-card h2 {
  margin: 8px 0 6px;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.7px;
}
.login-card-heading p,
.login-session-note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
}
.login-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid #edc6c8;
  border-radius: var(--radius-md);
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.login-error > span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.login-error p {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
}
.login-error:focus {
  outline: 2px solid var(--color-danger);
  outline-offset: 2px;
}
.login-form {
  display: grid;
  gap: 18px;
}
.login-field {
  display: grid;
  gap: 7px;
}
.login-field label {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 650;
}
.login-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-muted);
  color: var(--color-text);
  font: inherit;
  font-size: 16px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.login-field input:hover {
  border-color: #c5c2ba;
  background: var(--color-surface);
}
.login-field input:focus {
  border-color: var(--color-brand);
  outline: none;
  background: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(141,100,82,.13);
}
.login-submit {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: #202522;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.login-submit:hover {
  background: #151917;
  box-shadow: 0 6px 16px rgba(32,37,34,.18);
}
.login-submit-arrow {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}
.login-session-note {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border-light);
  line-height: 1.7;
}

@media (max-width: 760px) {
  body.login-page {
    align-items: flex-start;
    padding: 12px;
  }
  .login-shell {
    min-height: 0;
    grid-template-columns: 1fr;
    border-radius: 18px;
  }
  .login-intro {
    gap: 28px;
    padding: 28px 24px;
  }
  .login-intro h1 {
    font-size: 30px;
    letter-spacing: -1px;
  }
  .login-intro-copy > p:last-child {
    margin-top: 14px;
  }
  .login-trust-list {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 32px 24px max(32px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .login-intro-copy > p:last-child {
    font-size: 12px;
  }
  .login-card h2 {
    font-size: 25px;
  }
}

/* Five-year WK member consumption test tool. */
.consumption-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4);
  margin: var(--space-6) 0;
}
.consumption-form .field { flex: 1 1 220px; min-width: 0; }
.consumption-form .field input { width: 100%; }
.consumption-form button { min-height: 44px; }
.consumption-year-table-wrap { max-width: 100%; margin: var(--space-5) 0; overflow-x: auto; }
.consumption-year-table { width: 100%; min-width: 1000px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.consumption-year-table caption { text-align: left; margin-bottom: var(--space-3); }
.consumption-year-table th,
.consumption-year-table td { border: 1px solid var(--color-text); padding: var(--space-4); overflow-wrap: anywhere; }
.consumption-year-table thead th { background: var(--color-table-year-bg); text-align: center; font-size: var(--text-lg); }
.consumption-year-table tbody th { width: 90px; background: var(--color-table-year-bg); text-align: left; font-size: var(--text-xl); }
.consumption-year-table td { background: var(--color-surface); text-align: center; font-size: var(--text-lg); }
.consumption-year-table tbody td:nth-child(2) { font-size: var(--text-xl); }
.consumption-year-table .is-prospect { color: var(--color-danger); }
.consumption-year-table .is-tier-winner { color: var(--color-tier-winner); font-weight: 700; background: var(--color-table-year-bg); }
.consumption-year-table small { display: block; margin-top: var(--space-1); font-size: var(--text-sm); }
.consumption-year-table tfoot th { background: var(--color-table-year-bg); }
.consumption-year-table tfoot td { font-weight: 600; }
.consumption-tier-summary { font-size: var(--text-lg); font-weight: 600; overflow-wrap: anywhere; }
.consumption-tier-rules summary { cursor: pointer; padding: var(--space-3) 0; }
.consumption-tier-rules li { margin-bottom: var(--space-2); line-height: 1.6; }
#consumption-context { overflow-wrap: anywhere; }

#member-comparison-context,
#member-comparison-status,
#order-comparison-context,
#order-comparison-status { overflow-wrap: anywhere; }
.member-comparison-table { overflow-x: auto; margin: var(--space-4) 0; }
.member-comparison-table table { width: 100%; border-collapse: collapse; }
.member-comparison-table th,
.member-comparison-table td {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}
.member-comparison-table caption { text-align: left; margin-bottom: var(--space-3); }
.order-split-analysis {
  padding: var(--space-4);
  margin: var(--space-4) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow-wrap: anywhere;
}
.order-split-analysis h3 { margin-top: 0; }
.order-split-analysis p,
.order-split-analysis li { line-height: 1.6; }
#order-split-analysis-basis { color: var(--color-text-secondary); }
#order-split-analysis-notes { padding-left: var(--space-5); }
#order-split-analysis-notes li + li { margin-top: var(--space-2); }
.order-split-explanation { min-width: 260px; max-width: 420px; }
.order-split-explanation p { margin: var(--space-2) 0; line-height: 1.6; white-space: pre-line; }
.order-split-explanation small { color: var(--color-text-secondary); font-size: var(--text-sm); }
.order-split-assessment { display: inline-block; padding: var(--space-1) var(--space-2); border-radius: var(--radius-md); }
.order-split-assessment.expected { color: var(--color-success); background: var(--color-success-bg); }
.order-split-assessment.review { color: var(--color-danger); background: var(--color-danger-bg); }
.order-split-assessment.unconfirmed { color: var(--color-warning); background: var(--color-warning-bg); }
#order-quantity-result { overflow-wrap: anywhere; }
#order-quantity-member-list { white-space: pre-wrap; }
#order-quantity-orders td { min-width: 90px; }
#order-quantity-orders td:nth-child(2) { min-width: 200px; }
#order-quantity-orders td:last-child { min-width: 180px; }
.order-quantity-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
#quantity-audit-export {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  text-decoration: none;
}
#quantity-audit-context { color: var(--color-text-secondary); }
#member-comparison-result pre,
#order-comparison-result pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}
#member-comparison-result details,
#order-comparison-result details { margin-top: var(--space-4); }
#member-comparison-result summary,
#order-comparison-result summary { cursor: pointer; padding: var(--space-3) 0; }
.member-comparison-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
}
.member-comparison-columns > section { min-width: 0; }
.member-comparison-columns h3 { margin-top: 0; }
.member-comparison-columns pre {
  max-height: 60vh;
  overflow: auto;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-border-light);
}
@media (max-width: 760px) {
  .member-comparison-columns { grid-template-columns: minmax(0, 1fr); }
}

.store-sku-row {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.store-sku-heading, .store-sku-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.store-sku-heading { justify-content: space-between; margin-bottom: var(--space-3); }
.store-sku-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.store-sku-summary:empty { display: none; }
.store-sku-heading button, .store-sku-actions button { min-height: 44px; }
.store-sku-actions { margin-top: var(--space-4); }
.store-sku-fields { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 700px) {
  .store-sku-fields { grid-template-columns: minmax(0, 1fr); }
}
.order-basic-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) {
  .order-basic-fields { grid-template-columns: minmax(0, 1fr); }
}

.fields.douyin-sku-fields {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr) minmax(0, 1fr);
}
.douyin-sku-fields > .field { min-width: 0; }
@media (max-width: 700px) {
  .fields.douyin-sku-fields { grid-template-columns: minmax(0, 1fr); }
}

/* 微商城订单：6 列栅格，靠 span 拼出「3 个编码并排 + 单价/数量对半」的行；
   收货信息同理（省/市/区三等分，详细地址整行），窄屏统一回落单列。 */
.fields.mp-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.mp-grid > .field { min-width: 0; }
.mp-grid > .mp-span-2 { grid-column: span 2; }
.mp-grid > .mp-span-3 { grid-column: span 3; }
.mp-grid > .mp-span-4 { grid-column: span 4; }
.mp-grid > .mp-span-6 { grid-column: span 6; }
/* UnionID 是长标识，独占一行；门店与订单时间在下一行对半 */
.order-basic-fields > .mp-field-full { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .mp-grid > .mp-span-2 { grid-column: span 3; }
  .mp-grid > .mp-span-3 { grid-column: span 6; }
  .mp-grid > .mp-span-4 { grid-column: span 6; }
}
@media (max-width: 560px) {
  .mp-grid > .field { grid-column: span 6; }
}

/* UnionID 下拉：只列最近注册的微商城会员 */
.member-combo { position: relative; }
/* 输入框会被全局“一键清空”包一层 .input-clear-wrap，宽度与右侧留白在这里收口 */
.member-combo .input-clear-wrap { width: 100%; --clear-gutter: 52px; }
.member-combo .input-clear-wrap input { cursor: pointer; }
.member-combo::after {
  content: ""; position: absolute; right: 32px; top: 50%; width: 7px; height: 7px;
  border-right: 1.5px solid var(--color-text-muted);
  border-bottom: 1.5px solid var(--color-text-muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform var(--transition-fast);
  pointer-events: none;
}
.member-combo.is-open::after { transform: translateY(-20%) rotate(-135deg); }
.member-combo-menu {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 420px; overflow: auto; padding: 6px;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
}
.member-combo-state {
  padding: 8px 10px 9px; color: var(--color-text-muted);
  font-size: 11px; line-height: 1.5;
}
.member-combo-list { display: flex; flex-direction: column; gap: 2px; }
.member-combo-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--radius-md);
  background: transparent; text-align: left; cursor: pointer;
  font-family: inherit; color: inherit;
}
.member-combo-item:hover,
.member-combo-item.is-active { background: var(--color-surface-muted); }
.member-combo-avatar {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--color-brand-soft); color: #6f5a50;
  font-size: 12px; font-weight: 650;
}
.member-combo-body { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 1px; }
.member-combo-name {
  display: flex; align-items: center; gap: 6px;
  color: var(--color-text); font-size: 12.5px; font-weight: 650;
}
.member-combo-brand {
  padding: 1px 5px; border-radius: var(--radius-full);
  background: var(--color-surface-muted); color: var(--color-text-secondary);
  font-size: var(--text-xs); font-style: normal; font-weight: 650;
}
.member-combo-meta { color: var(--color-text-muted); font-size: 11px; }
.member-combo-union {
  overflow: hidden; color: var(--color-text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap;
}
.member-combo-item.is-unresolved .member-combo-union { color: var(--color-warning); }
.member-combo-flag {
  padding: 1px 5px; border-radius: var(--radius-full);
  background: var(--color-warning-bg); color: var(--color-warning);
  font-size: var(--text-xs); font-style: normal; font-weight: 650;
}
.member-combo-empty {
  padding: 14px 10px; color: var(--color-text-muted);
  font-size: 11.5px; line-height: 1.6;
}
.member-combo-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 4px; padding: 7px 10px 3px;
  border-top: 1px solid var(--color-border-light);
  color: var(--color-text-muted); font-size: var(--text-xs);
}
.member-combo-refresh {
  padding: 0; border: 0; background: transparent;
  color: var(--color-brand); font-size: var(--text-xs); font-weight: 650; cursor: pointer;
}
.member-combo-refresh:hover { text-decoration: underline; }
.field-hint.is-warn { color: var(--color-warning); }
@media (max-width: 560px) {
  .member-combo-menu { max-height: 280px; }
}

.bookmark-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.bookmark-environment-switch button { min-width: 64px; min-height: 44px; }
/* env-switch 原样式是给深色状态栏的（白色文字），在白色卡片上未选中项不可见 */
.bookmark-environment-switch {
  border-color: var(--color-border); background: var(--color-surface-muted);
}
.bookmark-environment-switch button { font-size: 12px; color: var(--color-text-secondary); }
.bookmark-environment-switch button:hover { color: var(--color-text); }
.bookmark-environment-switch button[aria-pressed="true"] {
  background: var(--color-surface); color: var(--color-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.bookmark-environment-help { margin: 0; color: var(--color-text-muted); font-size: var(--text-xs); }

/* 搜索框：整行可伸缩，右侧留出 “/” 快捷键提示的位置 */
.bookmark-search-field { position: relative; flex: 1 1 260px; min-width: 200px; }
.bookmark-search-field input[type="search"] {
  width: 100%; min-height: 44px; padding: 9px 42px 9px 14px;
  border: 1px solid var(--color-border); border-radius: var(--radius-full);
  background: var(--color-surface-muted); color: var(--color-text);
  font: inherit; font-size: 13px; outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}
.bookmark-search-field input[type="search"]::placeholder { color: var(--color-text-muted); }
.bookmark-search-field input[type="search"]:hover { border-color: #c5c2ba; }
.bookmark-search-field input[type="search"]:focus {
  border-color: var(--color-brand); background: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(141, 100, 82, .12);
}
.bookmark-search-field input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.bookmark-search-kbd {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%);
  min-width: 20px; padding: 0 6px; border: 1px solid var(--color-border);
  border-radius: 6px; background: var(--color-surface); color: var(--color-text-muted);
  font-family: inherit; font-size: 11px; line-height: 18px; text-align: center;
  pointer-events: none; transition: opacity var(--transition-fast);
}
.bookmark-search-field:focus-within .bookmark-search-kbd { opacity: 0; }

.bookmark-sort-field {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--color-text-muted); font-size: var(--text-xs); white-space: nowrap;
}
.bookmark-sort-field select {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius-full); background-color: var(--color-surface-muted);
  color: var(--color-text-secondary); font: inherit; font-size: 13px; cursor: pointer;
}
.bookmark-sort-field select:hover { border-color: #c5c2ba; }
.bookmark-sort-field select:focus {
  border-color: var(--color-brand); background-color: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(141, 100, 82, .12);
}

/* 分类胶囊：分类多时单行横向滚动，避免把卡片区往下推；右侧固定「管理分类」 */
.bookmark-category-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.bookmark-category-chips.choice-chips {
  flex: 1 1 auto; min-width: 0;
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none;
}
.bookmark-category-chips.choice-chips::-webkit-scrollbar { display: none; }
.bookmark-category-chips .choice-chip { flex: 0 0 auto; }
.bookmark-category-bar .btn-secondary { flex: 0 0 auto; min-height: 44px; }

.bookmark-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.bookmark-category-badge {
  display: inline-flex; align-items: center; align-self: flex-start; max-width: 100%;
  margin-top: 7px; padding: 1px 8px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-full); background: var(--color-surface-muted);
  color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.7;
  overflow-wrap: anywhere;
}
.bookmark-category-badge.is-uncategorized { border-style: dashed; background: transparent; }
.bookmark-category-list { display: grid; gap: 8px; margin-top: 16px; max-height: 40vh; overflow-y: auto; }
.bookmark-category-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.bookmark-category-row > span { min-width: 0; overflow-wrap: anywhere; }
.bookmark-category-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bookmark-category-form-actions button { min-height: 44px; }

/* 卡片：悬停轻微上浮 + 右上角外链提示，色块按域名固定 */
.bookmark-card { transition: transform var(--transition-base), border-color var(--transition-fast), box-shadow var(--transition-base); }
.bookmark-card:hover {
  transform: translateY(-2px); border-color: #d8cfc9; box-shadow: var(--shadow-lg);
}
.bookmark-card-main {
  grid-template-columns: 40px minmax(0, 1fr) 16px;
  align-items: start; padding: 16px 16px 14px;
}
.bookmark-initial { width: 40px; height: 40px; border-radius: 12px; }
.bookmark-initial[data-tone="0"] { background: #efe5df; color: #684637; }
.bookmark-initial[data-tone="1"] { background: #e4eae3; color: #405442; }
.bookmark-initial[data-tone="2"] { background: #e4e8ee; color: #3f4f63; }
.bookmark-initial[data-tone="3"] { background: #efe4e7; color: #6b4149; }
.bookmark-initial[data-tone="4"] { background: #ece7de; color: #5c4b35; }
.bookmark-initial[data-tone="5"] { background: #e3e9eb; color: #38515a; }
.bookmark-open-hint {
  justify-self: end; margin-top: 2px; color: var(--color-text-muted);
  font-size: 12px; opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.bookmark-card:hover .bookmark-open-hint,
.bookmark-card-main:focus-visible .bookmark-open-hint { opacity: 1; transform: translate(1px, -1px); }
.bookmark-description {
  display: -webkit-box; margin-top: 10px; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
/* 卡片底部工具条：拖动柄与文字操作共用一条细底线，去掉灰底色块，卡片看起来更整 */
.bookmark-card-actions {
  justify-content: flex-end; gap: 2px; padding: 4px 8px 5px;
  border-top: 1px solid var(--color-border-light); background: transparent;
}
.bookmark-action {
  min-width: 0; padding: 5px 9px; border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.bookmark-action:hover {
  border-color: transparent; background: var(--color-surface-muted); color: var(--color-text);
}
/* 删除和「编辑 / 复制」之间留一条细线，避免误点 */
.bookmark-card-actions .bookmark-action-danger { position: relative; margin-left: 8px; color: #a3564f; }
.bookmark-card-actions .bookmark-action-danger::before {
  content: ""; position: absolute; left: -5px; top: 50%; width: 1px; height: 12px;
  margin-top: -6px; background: var(--color-border);
}
.bookmark-card-actions .bookmark-action-danger:hover {
  border-color: transparent; background: var(--color-danger-bg); color: var(--color-danger);
}

/* 拖动排序：常驻手柄、跟手预览及虚线落位框 */
.bookmark-sort-status { margin: 0 0 12px; color: var(--color-text-secondary); font-size: 12px; }
.bookmark-sort-status:empty { margin: 0; }
/* 拖动柄：常态低调，鼠标移上卡片或聚焦时才浮出来，不跟三个操作按钮抢注意力 */
.bookmark-drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; min-width: 30px; min-height: 30px;
  margin-right: auto; padding: 0;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--color-text-muted);
  opacity: .55; cursor: grab; touch-action: none;
  transition: opacity var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}
.bookmark-card:hover .bookmark-drag-handle,
.bookmark-card:focus-within .bookmark-drag-handle { opacity: 1; }
.bookmark-drag-handle:hover {
  border-color: transparent; background: var(--color-surface-muted); color: var(--color-text);
}
.bookmark-drag-handle:focus-visible { opacity: 1; outline: 2px solid rgba(141,100,82,.32); outline-offset: 1px; }
.bookmark-card.is-dragging {
  position: relative; border: 1px dashed var(--color-brand);
  background: var(--color-brand-soft); box-shadow: none; transform: none;
}
.bookmark-card.is-dragging > * { opacity: .15; }
.bookmark-card.is-dragging::after {
  content: "松开置于此处"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text); font-size: 13px; font-weight: 600; pointer-events: none;
}
.bookmark-drag-preview {
  position: fixed; left: 0; top: 0; z-index: 1100; margin: 0;
  pointer-events: none; box-sizing: border-box; opacity: .96;
  border-color: var(--color-brand); box-shadow: var(--shadow-lg); transition: none;
}
.bookmark-drag-preview .bookmark-drag-handle { background: var(--color-brand-soft); }
/* 按下卡片即进入待拖状态：先禁用选中，避免拖动时把文字刷蓝 */
.bookmark-card.is-drag-source,
.bookmark-card.is-drag-source * { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.bookmark-card.is-dragging .bookmark-drag-handle { cursor: grabbing; }
body.is-bookmark-dragging { cursor: grabbing; user-select: none; }
body.is-bookmark-dragging .bookmark-card:not(.is-dragging):hover { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .bookmark-card, .bookmark-drag-handle { transition: none; }
}

@media (max-width: 680px) {
  .bookmark-search-field { flex: 1 1 100%; order: -1; }
  .bookmark-search-kbd { display: none; }
  .bookmark-sort-field { flex: 1 1 auto; }
  .bookmark-category-bar { flex-wrap: wrap; }
  .bookmark-category-bar .btn-secondary { flex: 1 1 auto; }
  .bookmark-category-chips .choice-chip { min-height: 36px; }
  /* 触屏没有 hover，手柄常亮并留出更大的点击区 */
  .bookmark-drag-handle { width: 34px; height: 34px; min-width: 34px; opacity: 1; }
  .bookmark-card-actions { padding: 4px 6px; }
  .bookmark-action { padding: 6px 9px; }
}

/* ============================================================
   Create-order form — visual refresh
   区块卡片化：带底色的标题带 + 胶囊完成度；SKU 行内嵌卡片；
   控件统一高度；底部吸底栏改为悬浮摘要条。
   ============================================================ */
.order-form-section {
  padding: 0 0 18px;
  margin-bottom: 14px;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(28, 28, 28, .04), 0 6px 18px rgba(28, 28, 28, .03);
}
.order-form-section > *:not(.form-section-label) {
  margin-left: 18px;
  margin-right: 18px;
}
.order-form-section .form-section-label {
  margin: 0 0 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: #f9f5f2;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  text-transform: none;
}
.order-form-section .form-section-label::before {
  width: 3px;
  height: 15px;
  border-radius: var(--radius-full);
}
.order-form-section .form-section-progress {
  min-width: 40px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: #f1eeeb;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
  text-align: center;
}
.order-form-section .form-section-progress.is-done {
  background: var(--color-success-bg);
  color: var(--color-success);
}
.order-form-section .field label {
  margin-bottom: 6px;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .1px;
}
.order-form-section .field input,
.order-form-section .field select {
  min-height: 46px;
  padding: 11px 13px;
  border-width: 1px;
  border-radius: 10px;
}
.order-form-section .field input:hover:not(:disabled),
.order-form-section .field select:hover { border-color: #d6d2cd; }
.order-form-section .sku-filter-bar { margin-bottom: 16px; }
.order-form-section .sku-filter-bar select,
.order-form-section .order-shop-filter select { min-height: 44px; border-radius: 10px; }
.order-form-section .store-sku-row {
  margin-top: 0;
  padding: 14px;
  border: 1px solid var(--color-border-light);
  border-radius: 12px;
  background: #fbfaf9;
}
.order-form-section .store-sku-row + .store-sku-row { margin-top: 12px; }
.order-form-section .store-sku-heading strong { font-size: 12.5px; color: var(--color-text); }
.order-form-section .store-sku-summary { color: var(--color-text-muted); }
.order-form-section .store-sku-actions { margin-top: 14px; }
.order-form-section .panel-description { margin-bottom: 0; }

.order-draft-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid #e8dccc;
  border-radius: var(--radius-md);
  background: #fdf8f2;
  color: var(--color-text-secondary);
  font-size: 12.5px;
}
.order-draft-banner[hidden] { display: none; }
.order-draft-copy { flex: 1 1 240px; min-width: 0; }
.order-draft-copy strong { color: var(--color-text); font-weight: 600; }
.order-draft-copy small { margin-left: 8px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.order-draft-actions { display: flex; gap: 8px; margin-left: auto; }
.order-draft-actions .btn-secondary { min-height: 30px; padding: 4px 12px; font-size: 12px; }

.order-actions-bar {
  gap: 10px 16px;
  margin: var(--space-4) 0 0;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  /* 吸底时会盖住上一段内容：必须完全不透明，且保留一圈清晰的顶部边界 */
  background: var(--color-surface);
  box-shadow: 0 -4px 20px rgba(28, 28, 28, .07);
}
.order-actions-summary { gap: 4px 14px; }
.order-actions-chip {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding-right: 14px;
  border-right: 1px solid var(--color-border-light);
}
.order-actions-chip:last-child { padding-right: 0; border-right: 0; }
.order-actions-chip small { font-size: var(--text-xs); letter-spacing: .3px; }
.order-actions-chip strong { max-width: 150px; font-size: 12.5px; }
.order-actions-bar .order-review-ready { min-width: 56px; text-align: center; }

@media (max-width: 760px) {
  .order-form-section > *:not(.form-section-label) { margin-left: 14px; margin-right: 14px; }
  /* 长表单在窄屏同样吸底：摘要压成单行横向滚动，按钮撑满一行且满足触摸高度 */
  .order-actions-bar {
    position: sticky; bottom: 0; z-index: 30;
    margin: var(--space-4) -12px 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -6px 18px rgba(28, 28, 28, .1);
  }
  .order-actions-summary {
    flex-wrap: nowrap; width: 100%; overflow-x: auto;
    scrollbar-width: none;
  }
  .order-actions-summary::-webkit-scrollbar { display: none; }
  .order-actions-chip { flex: 0 0 auto; padding-right: 0; border-right: 0; }
  .order-actions-buttons {
    width: 100%; margin-left: 0; flex-wrap: wrap; gap: 8px;
  }
  /* EOSS 开关独占一行，两个主按钮各占一半，避免「预览请求」被压成竖排 */
  .order-actions-buttons .eoss-option { flex: 1 1 100%; order: -1; }
  .order-actions-buttons > button {
    flex: 1 1 0; min-width: 110px; min-height: 44px; white-space: nowrap;
  }
}

/* ============================================================
   Items section — compact rows
   桌面端：一行表头 + 行内纯输入（高度约 58px），行间细分隔线；
   窄屏：回落为原来的卡片式（标签重新显示）。
   ============================================================ */
.store-sku-head {
  display: grid;
  grid-template-columns: 24px minmax(0, 1.9fr) minmax(0, 1fr) 108px 30px;
  gap: 10px;
  padding: 0 2px 7px;
  color: var(--color-text-muted);
  font-size: 11px;
  letter-spacing: .2px;
}
.store-sku-head > span:nth-child(3) { text-align: right; }
.store-sku-head > span:nth-child(4) { padding-left: 4px; }
.store-sku-head > span:nth-child(3) { text-align: right; }
.store-sku-head > span:nth-child(4) { padding-left: 4px; }
#store-sku-list { counter-reset: sku-row; }
.order-form-section .store-sku-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1.9fr) minmax(0, 1fr) 108px 30px;
  gap: 10px;
  align-items: center;
  margin-top: 0;
  padding: 9px 2px;
  border: 0;
  border-top: 1px solid var(--color-border-light);
  border-radius: 0;
  background: transparent;
  counter-increment: sku-row;
}
.order-form-section .store-sku-row:first-child { border-top: 0; }
.order-form-section .store-sku-row:hover { background: #fbfaf9; }
.order-form-section .store-sku-row:hover { background: #fbfaf9; }
.order-form-section .store-sku-row::before {
  content: counter(sku-row);
  grid-column: 1;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--color-border-light);
  color: var(--color-text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.order-form-section .store-sku-heading { display: contents; }
.order-form-section .store-sku-heading strong,
.order-form-section .store-sku-summary { display: none; }
.order-form-section .store-sku-fields { display: contents; }
.order-form-section .store-sku-fields > .field:nth-child(1) { grid-area: 1 / 2; }
.order-form-section .store-sku-fields > .field:nth-child(2) { grid-area: 1 / 3; }
.order-form-section .store-sku-fields > .field:nth-child(3) { grid-area: 1 / 4; }
.order-form-section .store-sku-row .field > label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.order-form-section .store-sku-row .field-error:empty { display: none; }
.order-form-section .store-sku-row .field input {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
}
.order-form-section .store-sku-row .field input[data-store-item="actual"] { text-align: right; font-variant-numeric: tabular-nums; }
.order-form-section .store-sku-row .money-input,
.order-form-section .store-sku-row .quantity-stepper { min-height: 38px; border-radius: 8px; }
.order-form-section .store-sku-row .money-input > span:first-child { width: 26px; font-size: 12px; }
.order-form-section .store-sku-row .money-input input,
.order-form-section .store-sku-row .quantity-stepper input { min-height: 36px; font-size: 13px; }
.order-form-section .store-sku-row .quantity-stepper button { width: 26px; font-size: 14px; }
.order-form-section .store-sku-row .quantity-stepper input { padding-left: 24px; }
.order-form-section .store-remove-sku {
  grid-area: 1 / 5;
  align-self: center;
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1;
}
.order-form-section .store-remove-sku:hover:not(:disabled) {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.order-form-section .store-remove-sku:disabled { opacity: .3; cursor: not-allowed; }
.order-form-section .store-sku-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border-light);
}
#store-add-sku,
#douyin-add-sku {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 12.5px;
}
#store-add-sku:hover:not(:disabled),
#douyin-add-sku:hover:not(:disabled) {
  border-color: var(--color-brand);
  background: #fdf8f5;
  color: var(--color-brand);
}
#store-sku-summary,
#douyin-sku-summary { margin-left: auto; color: var(--color-text-muted); font-size: 12.5px; }
#store-sku-summary strong,
#douyin-sku-summary strong { margin-left: 4px; color: var(--color-text); font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .store-sku-head { display: none; }
  .order-form-section .store-sku-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
    background: #fbfaf9;
    counter-increment: none;
  }
  .order-form-section .store-sku-row::before { display: none; }
  .order-form-section .store-sku-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .order-form-section .store-sku-heading strong,
  .order-form-section .store-sku-summary { display: block; }
  .order-form-section .store-sku-summary { flex: 1; }
  .order-form-section .store-sku-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .order-form-section .store-sku-fields > .field:nth-child(n) { grid-area: auto; }
  .order-form-section .store-sku-row .field > label {
    position: static;
    width: auto;
    height: auto;
    margin: 0 0 6px;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }
  .order-form-section .store-sku-actions { flex-wrap: wrap; }
}

/* ============ 渠道 SKU 行复用 DW 紧凑行（京东/抖音/天猫） ============ */
#jd-sku-list, #douyin-sku-list, .tmall-sku-block { counter-reset: sku-row; }
.jd-sku-head,
.jd-sku-section.store-sku-row { grid-template-columns: 24px minmax(0, 1.9fr) minmax(0, 1fr) 108px 84px; }
.jd-sku-head > span:last-child { text-align: right; }
.jd-sku-section .jd-sku-toggle { grid-area: 1 / 5; align-self: center; justify-self: end; }
.jd-sku-section .jd-sku-optional { grid-column: 1 / -1; }
/* 金额列右对齐，与 DW 的「该行金额」一致 */
.order-form-section .store-sku-row .field input[data-douyin-sku-field="payAmount"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   弹窗外壳：标题栏 / 可滚动正文 / 固定底栏
   （核销卡券、绑定企微等字段较多的弹窗共用）
   ============================================================ */
.modal-box.dialog-box {
  display: flex;
  flex-direction: column;
  width: min(560px, 94vw);
  max-height: min(90vh, 820px);
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
}
.modal-box.wecom-box { width: min(520px, 94vw); }
.modal-box.manual-points-box { width: min(520px, 94vw); }
.modal-box.douyin-point-box { width: min(480px, 94vw); }

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 17px 18px 15px 20px;
  border-bottom: 1px solid var(--color-border-light);
  background:
    radial-gradient(130% 150% at 0% 0%, rgba(141, 100, 82, .10), transparent 60%),
    var(--color-surface);
}
.dialog-head-main { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.dialog-head-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 11px;
  background: var(--color-brand-soft);
  color: var(--color-brand);
}
.dialog-head-icon svg { width: 19px; height: 19px; }
.dialog-head-text { min-width: 0; padding-top: 2px; }
.dialog-box .dialog-head h3 {
  margin: 0;
  font-size: 17px; font-weight: 650; letter-spacing: -.2px; line-height: 1.35;
}
.dialog-box .modal-hint {
  margin: 3px 0 0;
  padding: 0;
  background: none;
  border: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--color-text-muted);
}
.dialog-box .modal-hint::before { content: none; }
.dialog-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: 0 0 auto;
  padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.dialog-close svg { width: 15px; height: 15px; }
.dialog-close:hover { background: var(--color-surface-muted); color: var(--color-text); }

.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 16px 20px 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dialog-section { min-width: 0; }
.dialog-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.dialog-section-title {
  flex: 0 0 auto;
  font-size: 11px; font-weight: 700;
  letter-spacing: .1em;
  color: var(--color-brand);
}
.dialog-section-line {
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--color-border), rgba(0, 0, 0, 0));
}

.dialog-box .modal-field { margin-bottom: 0; }
.dialog-box .modal-field label { margin-bottom: 5px; font-size: 12.5px; font-weight: 500; }
.dialog-box .modal-field input,
.dialog-box .modal-field select {
  min-height: 38px;
  border-width: 1px;
  background-color: var(--color-surface-muted);
}
.dialog-box .modal-field input:disabled,
.dialog-box .modal-field select:disabled {
  color: var(--color-text-muted);
  background-color: var(--color-border-light);
  cursor: not-allowed;
}

.dialog-lookup-row { display: flex; gap: 8px; align-items: stretch; }
.dialog-lookup-row input { flex: 1 1 auto; min-width: 0; }
.dialog-lookup-row button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 18px;
  white-space: nowrap;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: inherit;
}

/* 只读字段压成一条紧凑信息栏，避免整行灰框占满一屏 */
.dialog-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}
.dialog-readout .modal-field { min-width: 0; }
.dialog-readout .modal-field + .modal-field {
  padding-left: 12px;
  border-left: 1px solid var(--color-border-light);
}
.dialog-readout .modal-field label {
  margin-bottom: 2px;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--color-text-muted);
}
.dialog-readout .modal-field input[readonly] {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text);
  text-overflow: ellipsis;
}
/* 姓名类只读值不用等宽字体 */
.dialog-readout .dialog-readout-text input[readonly] {
  font-family: inherit;
  font-size: 13.5px;
}
.dialog-readout .modal-field input[readonly]::placeholder {
  color: var(--color-text-muted);
  font-family: inherit;
}

.dialog-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
/* 单值信息栏（只有一项时不必强行两列） */
.dialog-readout-single { grid-template-columns: minmax(0, 1fr); }
/* 信息栏下面再跟字段时补一点间距 */
.dialog-readout + .modal-field { margin-top: 12px; }
/* 需要完整展示的编码类字段：只读但仍是关键信息，不能灰成禁用态 */
.dialog-box .modal-field input.dialog-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.dialog-box .modal-field input[readonly].dialog-mono {
  background: var(--color-surface-muted);
  color: var(--color-text);
  cursor: text;
}
.dialog-box .modal-field input[readonly].dialog-mono::placeholder {
  color: var(--color-text-muted);
  font-family: inherit;
}
/* 数字输入框去掉原生上下箭头（积分数量都是整数，用不到步进器） */
.dialog-box .modal-field input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.dialog-box .modal-field input[type="number"]::-webkit-outer-spin-button,
.dialog-box .modal-field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* 抖音积分弹窗：加分是「＋」、减分是「－」 */
.dialog-head-icon.is-deduct .icon-plus-stroke { display: none; }

.dialog-note {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 17px;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text-muted);
}
.dialog-note::before {
  content: "";
  width: 4px; height: 4px; flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}
.dialog-note:empty { min-height: 0; margin-top: 0; }
.dialog-note:empty::before { display: none; }

.dialog-foot {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px 17px;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
}
.dialog-foot .modal-actions { margin-top: 0; gap: 10px; }
.dialog-foot .modal-actions button {
  min-height: 40px;
  padding: 0 22px;
  font-weight: 600;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              box-shadow var(--transition-fast), transform var(--transition-fast);
}
.dialog-foot .btn-cancel { background: var(--color-surface); border: 1px solid var(--color-border) !important; }
.dialog-foot .btn-cancel:hover { background: var(--color-surface-muted); border-color: #c9c6bf !important; }
.dialog-foot .btn-confirm { background: var(--color-accent); color: #fff; }
.dialog-foot .btn-confirm:hover:not(:disabled) { background: var(--color-accent-hover); }
.dialog-foot .btn-confirm:disabled { opacity: .62; cursor: progress; transform: none; }
.dialog-foot .modal-result { margin-top: 0; }

/* 退单弹窗：预览请求与「取消」同级，只生成请求不提交 */
.dialog-foot .modal-actions .refund-preview-button {
  background: var(--color-surface);
  border: 1px solid var(--color-border) !important;
  color: var(--color-text-secondary);
}
.dialog-foot .modal-actions .refund-preview-button:hover:not(:disabled) {
  background: var(--color-surface-muted);
  border-color: #c9c6bf !important;
  color: var(--color-text);
}
.dialog-foot .modal-actions .refund-preview-button:disabled {
  opacity: .62;
  cursor: progress;
  transform: none;
}

/* 核销弹窗：卡券类型收窄，把空间让给卡券名 */
.redeem-pair-type { grid-template-columns: 158px minmax(0, 1fr); }
/* 企微绑定：SA 编码比姓名长，列宽不等分 */
.wecom-pair-sa { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }

/* ---------- 其余业务弹窗沿用同一外壳：只调版心宽度 ---------- */
.modal-box.dialog-box.compensation-box { width: min(460px, 94vw); }
.modal-box.dialog-box.level-upgrade-box { width: min(460px, 94vw); }
.modal-box.dialog-box.coupon-box { width: min(460px, 94vw); }
.modal-box.dialog-box.bookmark-category-box,
.modal-box.dialog-box.bookmark-modal-box { width: min(540px, 94vw); }
.modal-box.dialog-box.member-profile-box {
  width: min(660px, 94vw);
  max-height: min(92vh, 880px);
}
.modal-box.dialog-box.refund-modal { width: min(660px, 94vw); }
.modal-box.dialog-box.endpoint-invoke-box { width: min(760px, calc(100vw - 32px)); }

/* ---------- 危险操作确认（解绑等）：信息清单 + 红色确认按钮 ---------- */
.modal-box.dialog-box.confirm-box { width: min(462px, 94vw); }
.dialog-head-icon.is-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.confirm-list {
  display: grid;
  margin: 0;
  padding: 3px 12px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}
.confirm-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--color-border-light);
}
.confirm-row:first-child { border-top: 0; }
.confirm-row dt {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--color-text-muted);
}
.confirm-row dd {
  margin: 0;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--color-text);
  overflow-wrap: anywhere;
}
.confirm-row dd.is-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
/* 解绑不可撤回，正文底部单独给一条风险提示 */
.confirm-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #efd8d6;
  border-radius: var(--radius-md);
  background: var(--color-danger-bg);
  color: #7c3b36;
  font-size: 12.5px;
  line-height: 1.55;
}
.confirm-warning::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px; flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--color-danger);
  color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.dialog-foot .btn-confirm.btn-danger { background: var(--color-danger); }
.dialog-foot .btn-confirm.btn-danger:hover:not(:disabled) { background: #7f1c1f; }

/* 正文里相邻的字段靠 margin 拉开，两列栅格内由 gap 负责，不重复叠加 */
.dialog-section > .modal-field + .modal-field,
.dialog-section > .modal-field + .dialog-pair,
.dialog-section > .dialog-pair + .modal-field { margin-top: 10px; }

/* 退单摘要 / 分区卡片放进滚动正文后，统一交给 dialog-body 的 gap 控制间距 */
.dialog-body .bms-refund-summary { margin-bottom: 0; }
.dialog-body .refund-form-card + .refund-form-card { margin-top: 0; }
.refund-form-card .dialog-section-head { margin-bottom: 10px; }
/* 卡片本身是浅灰底，卡片里的输入框要回到白底才看得清 */
.dialog-box .refund-form-card .modal-field input:not([readonly]):not(:disabled),
.dialog-box .refund-form-card .modal-field select:not(:disabled) {
  background-color: var(--color-surface);
}

/* 分类管理：正文自己滚动，列表不再二次滚动，按钮高度对齐弹窗其它按钮 */
.dialog-box .bookmark-category-list { margin-top: 0; max-height: none; gap: 0; }
.dialog-box .bookmark-category-row:last-child { border-bottom: 0; }
.dialog-box .bookmark-category-form-actions { margin-top: 10px; }
/* 只有在重命名时才会有第二个按钮，空壳时不占位 */
.dialog-box .bookmark-category-form-actions:not(:has(button:not([hidden]))) { display: none; }
.dialog-box .bookmark-category-form-actions button { min-height: 38px; }

/* 弹窗内的多行文本与输入框保持同一套观感 */.dialog-box .modal-field textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 84px;
  padding: 9px 12px;
  resize: vertical;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font: inherit;
  line-height: 1.5;
  outline: none;
}
.dialog-box .modal-field textarea:focus { border-color: var(--color-accent); }
/* 接口调试的 JSON 要等宽，且比备注框高 */
.endpoint-invoke-box .modal-field textarea {
  min-height: 92px;
  font: 12px/1.55 "SF Mono", Consolas, monospace;
}
.endpoint-invoke-box .endpoint-invoke-result { margin: 0; }

@media (max-width: 680px) {
  /* 窄屏统一成底部整宽抽屉，和其余弹窗的移动端表现一致 */
  .modal-box.dialog-box,
  .modal-box.dialog-box.refund-modal,
  .modal-box.dialog-box.member-profile-box,
  .modal-box.dialog-box.endpoint-invoke-box,
  .modal-box.dialog-box.bookmark-modal-box,
  .modal-box.dialog-box.bookmark-category-box,
  .modal-box.dialog-box.coupon-box,
  .modal-box.dialog-box.level-upgrade-box,
  .modal-box.dialog-box.confirm-box,
  .modal-box.dialog-box.compensation-box { width: 100%; max-width: none; }
  .dialog-head { padding: 15px 12px 13px 16px; }
  .dialog-body { padding: 14px 16px 4px; gap: 14px; }
  .dialog-foot { padding: 12px 16px 14px; }
  .dialog-readout { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .dialog-readout .modal-field + .modal-field {
    padding-top: 9px;
    padding-left: 0;
    border-top: 1px solid var(--color-border-light);
    border-left: 0;
  }
  .dialog-pair,
  .redeem-pair-type,
  .wecom-pair-sa { grid-template-columns: minmax(0, 1fr); }
  .dialog-box .modal-field input,
  .dialog-box .modal-field select { min-height: 44px; font-size: 16px; }
  .dialog-lookup-row button { min-height: 44px; }
  .dialog-foot .modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dialog-foot .modal-actions button { width: 100%; min-height: 46px; }
  /* 三个按钮时预览占整行，取消/确认留在下一行 */
  .dialog-foot .modal-actions .refund-preview-button { grid-column: 1 / -1; }
}

/* 会员中心：企微工具按需展开，日常视图优先展示会员身份。 */
.members-overview .member-stat {
  min-height: 54px; flex-direction: row; align-items: center;
}
.members-wecom-tools {
  margin-bottom: 14px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg); background: var(--color-surface);
}
.members-wecom-tools > summary {
  min-height: 44px; padding: 12px 14px; cursor: pointer;
  color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 600;
}
.members-wecom-tools > summary:hover { color: var(--color-text); }
.members-wecom-tools > summary:focus-visible {
  outline: 2px solid var(--color-accent); outline-offset: 2px;
}
.members-wecom-caption { margin-left: 12px; font-weight: 400; }
.members-wecom-content { padding: 0 14px 14px; }
.members-wecom-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.members-wecom-stats .member-stat { min-height: 54px; flex-direction: row; align-items: center; }
.members-wecom-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.members-wecom-actions > button { margin-left: auto; }
[data-panel="members"]:not(.is-wecom-open) .members-table th:nth-child(4),
[data-panel="members"]:not(.is-wecom-open) #members-table-wrap .members-table td:nth-child(4) { display: none; }
[data-panel="members"]:not(.is-wecom-open) .members-table th:nth-child(1) { width: 24%; }
[data-panel="members"]:not(.is-wecom-open) .members-table th:nth-child(2) { width: 17%; }
[data-panel="members"]:not(.is-wecom-open) .members-table th:nth-child(3) { width: 33%; }
[data-panel="members"]:not(.is-wecom-open) .members-table th:nth-child(5) { width: 17%; }
[data-panel="members"]:not(.is-wecom-open) .members-table th:nth-child(6) { width: 9%; }
@media (max-width: 760px) {
  .members-wecom-caption { display: none; }
  .members-wecom-actions > button { width: 100%; margin-left: 0; }
  [data-panel="members"]:not(.is-wecom-open) #members-table-wrap .members-table td:nth-child(2) { grid-column: 1 / -1; }
}

/* ============================================================
   系统管理 · 组织架构
   ============================================================ */
.org-card { min-height: 0; }
.org-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 18px;
}
.org-heading .panel-description { margin-bottom: 0; }
.org-heading-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.org-heading-actions .btn-primary {
  min-height: 40px; padding: 0 18px; border: 0; border-radius: var(--radius-md);
  font-size: var(--text-base); font-weight: 600;
}
.org-heading-actions .btn-secondary { min-height: 40px; padding: 0 14px; }

/* 概览：部门 / 账号 / 已启用 / 未分配部门 */
.org-overview {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.org-stat {
  min-height: 66px; display: flex; flex-direction: column; justify-content: space-between;
  gap: 6px; padding: 11px 14px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}
.org-stat-label { color: var(--color-text-muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.org-stat strong { color: var(--color-text); font-size: 21px; font-weight: 600; line-height: 1; }
.org-stat-warn strong { color: var(--color-warning); }

/* 页面级反馈条 */
.org-status {
  margin: 0 0 16px; padding: 10px 13px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-md);
  background: var(--color-surface-muted); color: var(--color-text-secondary);
  font-size: var(--text-sm); line-height: 1.5;
}
.org-status[hidden] { display: none; }
.org-status-success { border-color: #c7e0d2; background: var(--color-success-bg); color: var(--color-success); }
.org-status-error { border-color: #efd1d1; background: var(--color-danger-bg); color: var(--color-danger); }
.org-status-info { border-color: #e3d4cb; background: var(--color-brand-soft); color: #6f4a37; }

/* 双列：部门树 / 账号列表 */
.organization-layout {
  display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.6fr);
  gap: 16px; align-items: start;
}
.organization-box {
  min-width: 0; padding: 16px 16px 18px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.organization-box h3 { margin: 0; font-size: var(--text-lg); font-weight: 650; letter-spacing: -.1px; }
.org-box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.org-box-add { flex: 0 0 auto; min-height: 34px; padding: 0 12px; white-space: nowrap; }
.org-box-hint { margin: -4px 0 10px; color: var(--color-text-muted); font-size: 11.5px; line-height: 1.5; }
.org-admin-line { margin: 0 0 12px; color: var(--color-text-muted); font-size: var(--text-sm); }

/* ---------- 部门树 ---------- */
.org-tree { min-width: 0; }
.org-tree[aria-busy="true"] { opacity: .6; }
.org-tree-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 1px; }
.org-node-row {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 6px 4px calc(4px + var(--org-depth, 0) * 14px);
  border: 1px solid transparent; border-radius: var(--radius-md);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.org-node-row:hover { background: var(--color-surface-muted); border-color: var(--color-border-light); }
.org-node-row.is-selected { background: var(--color-brand-soft); border-color: #dcc7bb; }
.org-node-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex: 0 0 20px; padding: 0;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--color-text-muted); cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.org-node-toggle svg {
  width: 12px; height: 12px;
  transform: rotate(90deg);
  transition: transform var(--transition-base);
}
.org-node-toggle:hover { background: var(--color-border-light); color: var(--color-text); }
.org-node-toggle[aria-expanded="false"] svg { transform: rotate(0deg); }
.org-node-toggle.is-empty { visibility: hidden; }
.org-node-name {
  flex: 1 1 auto; min-width: 0; padding: 3px 2px;
  border: 0; border-radius: 6px; background: none;
  color: var(--color-text); font: inherit; font-size: 13.5px; font-weight: 600;
  text-align: left; cursor: pointer; overflow-wrap: anywhere;
  transition: color var(--transition-fast);
}
.org-node-name:hover { color: var(--color-brand); }
.org-node-row.is-selected .org-node-name { color: #5f4033; }
.org-node-count {
  flex: 0 0 auto; min-width: 24px; padding: 1px 7px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-full);
  background: var(--color-surface-muted); color: var(--color-text-muted);
  font-size: 11px; font-weight: 600; text-align: center;
}
.org-node-count.is-zero { opacity: .55; }
.org-node-row.is-selected .org-node-count { border-color: #dcc7bb; background: var(--color-surface); color: #6f4a37; }
.org-node-actions {
  display: flex; flex: 0 0 auto; gap: 2px;
  opacity: 0; transition: opacity var(--transition-fast);
}
.org-node-row:hover .org-node-actions,
.org-node-row:focus-within .org-node-actions,
.org-node-row.is-selected .org-node-actions { opacity: 1; }
.org-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
  color: var(--color-text-muted); cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.org-icon-btn svg { width: 14px; height: 14px; }
.org-icon-btn:hover { border-color: var(--color-border); background: var(--color-surface); color: var(--color-text); }
.org-icon-btn.is-danger:hover { border-color: #efd1d1; background: var(--color-danger-bg); color: var(--color-danger); }

/* ---------- 账号列表 ---------- */
.org-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.org-toolbar input[type="search"],
.org-toolbar select {
  min-height: 40px; padding: 0 12px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background-color: var(--color-surface-muted); color: var(--color-text);
  font: inherit; font-size: var(--text-base);
}
.org-toolbar input[type="search"] { flex: 1 1 220px; min-width: 160px; }
.org-toolbar select { flex: 0 0 auto; }
.org-toolbar input[type="search"]:hover,
.org-toolbar select:hover { border-color: #c5c2ba; }
.org-toolbar input[type="search"]:focus,
.org-toolbar select:focus {
  border-color: var(--color-brand); background-color: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(141, 100, 82, .12); outline: none;
}
.org-filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 11px;
  border: 1px solid #dcc7bb; border-radius: var(--radius-full);
  background: var(--color-brand-soft); color: #6f4a37;
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.org-filter-chip::after { content: "×"; font-size: 13px; line-height: 1; opacity: .65; }
.org-filter-chip:hover { background: #e7d8ce; }
.org-filter-chip[hidden] { display: none; }

.organization-accounts { display: grid; gap: 6px; }
.org-account {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), background var(--transition-fast, .18s ease);
}
.org-account:hover { border-color: var(--color-border); background: var(--color-surface-muted); }
.org-account.is-off { background: var(--color-surface-muted); }
.org-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 11px; background: var(--color-brand-soft); color: #6f4a37;
  font-size: 13px; font-weight: 650;
}
.org-avatar.is-off { background: var(--color-border-light); color: var(--color-text-muted); }
.org-account-main { flex: 1 1 auto; min-width: 0; }
.org-account-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.org-account-name strong { font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }
.org-dept-tag {
  padding: 1px 8px; border: 1px solid var(--color-border-light); border-radius: var(--radius-full);
  background: var(--color-surface-muted); color: var(--color-text-secondary);
  font-size: 11px; font-weight: 600; overflow-wrap: anywhere;
}
.org-account-meta { margin-top: 3px; color: var(--color-text-muted); font-size: 12px; overflow-wrap: anywhere; }
.org-pill {
  flex: 0 0 auto; padding: 2px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 650; white-space: nowrap;
}
.org-pill.is-on { background: var(--color-success-bg); color: var(--color-success); }
.org-pill.is-off { background: var(--color-border-light); color: var(--color-text-muted); }
.org-account-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.org-row-btn { min-height: 34px; padding: 0 12px; border-radius: var(--radius-md); }

/* 空态 / 骨架 */
.org-empty {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 26px 16px; text-align: center;
  border: 1px dashed var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}
.org-empty[hidden] { display: none; }
.org-empty strong { font-size: 13.5px; font-weight: 650; }
.org-empty span { max-width: 34em; color: var(--color-text-muted); font-size: 12.5px; line-height: 1.5; }
.org-empty-action { margin-top: 9px; min-height: 36px; padding: 0 14px; }
.org-skeleton { display: grid; gap: 8px; }
.org-skeleton-row {
  height: 56px; border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-surface-muted) 25%, #f6f3ee 37%, var(--color-surface-muted) 63%);
  background-size: 400% 100%;
  animation: members-skeleton-sweep 1.4s ease infinite;
}
.org-skeleton-row.is-tree { height: 32px; }

/* ---------- 弹窗 ---------- */
.modal-box.org-dialog { width: min(520px, 94vw); }
.modal-box.org-dialog.org-dialog-account { width: min(600px, 94vw); }
.org-dialog .modal-field-note { margin-top: 5px; font-size: 11.5px; line-height: 1.5; }
.org-dialog .modal-result { margin-top: 0; }
.org-dialog .modal-field input[readonly] {
  cursor: default;
  color: var(--color-text-secondary);
  background: var(--color-border-light);
}

.org-permission-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.org-permission-count { color: var(--color-text-muted); font-size: 11.5px; font-weight: 600; }
.org-permission-tools { display: inline-flex; gap: 2px; }
.org-link-btn {
  padding: 2px 7px; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--color-brand); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.org-link-btn:hover { background: var(--color-brand-soft); }

.org-permissions {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  margin: 0; padding: 9px;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}
.org-permission {
  display: flex; align-items: center; gap: 7px;
  min-height: 32px; padding: 0 6px; border-radius: var(--radius-sm);
  color: var(--color-text-secondary); font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.org-permission:hover { background: var(--color-surface); color: var(--color-text); }
.org-permission input {
  width: 15px; height: 15px; flex: 0 0 auto; margin: 0;
  accent-color: var(--color-brand); cursor: pointer;
}

/* 启用 / 停用开关 */
.org-switch {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 13px; cursor: pointer;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.org-switch:hover { border-color: var(--color-border); background: var(--color-surface); }
.org-switch input {
  position: absolute; width: 1px; height: 1px;
  margin: 0; opacity: 0; pointer-events: none;
}
.org-switch-track {
  position: relative; flex: 0 0 38px;
  width: 38px; height: 22px; margin-top: 1px;
  border-radius: var(--radius-full); background: #d6d4ce;
  transition: background var(--transition-base);
}
.org-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--color-surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform var(--transition-base);
}
.org-switch input:checked + .org-switch-track { background: var(--color-brand); }
.org-switch input:checked + .org-switch-track::after { transform: translateX(16px); }
.org-switch input:focus-visible + .org-switch-track {
  outline: 2px solid var(--color-brand); outline-offset: 2px;
}
.org-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.org-switch-text strong { font-size: 13px; font-weight: 600; }
.org-switch-text small { color: var(--color-text-muted); font-size: 11.5px; line-height: 1.45; }

@media (hover: none) {
  .org-node-actions { opacity: 1; }
}
@media (max-width: 1100px) {
  .org-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .organization-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .org-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .org-heading-actions { justify-content: stretch; }
  .org-heading-actions .btn-secondary,
  .org-heading-actions .btn-primary { flex: 1 1 auto; }
  .org-account { flex-wrap: wrap; }
  .org-account-actions {
    flex: 1 1 100%; width: 100%; box-sizing: border-box;
    margin-left: 0; padding-left: 46px;
  }
  .org-row-btn { flex: 1 1 0; }
  .org-permissions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .org-skeleton-row { animation: none; }
}

/* ============================================================
   系统管理 · 二级菜单与登录日志
   ============================================================ */
.org-tabs {
  display: flex; gap: 4px; width: fit-content; max-width: 100%;
  margin-bottom: 18px; padding: 4px; overflow-x: auto;
  border: 1px solid var(--color-border-light); border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}
.org-tab {
  min-height: 34px; padding: 0 16px; border: 0; border-radius: var(--radius-md);
  background: none; color: var(--color-text-muted);
  font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.org-tab:hover { color: var(--color-text); background: var(--color-surface); }
.org-tab.is-active {
  color: var(--color-text); background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .07);
}
.org-tab:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 1px; }

.org-view-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.org-view-desc { margin: 0; color: var(--color-text-muted); font-size: 12.5px; line-height: 1.55; }
.org-view-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.org-view-actions .btn-primary {
  min-height: 40px; padding: 0 18px; border: 0; border-radius: var(--radius-md);
  font-size: var(--text-base); font-weight: 600;
}
.org-view-actions .btn-secondary { min-height: 40px; padding: 0 14px; }

/* 登录日志列表 */
.login-log-meta {
  min-height: 16px; margin: 0 0 8px;
  color: var(--color-text-muted); font-size: 12px;
}
.login-log-box {
  overflow: hidden; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg); background: var(--color-surface);
}
.login-log-head,
.login-log-row {
  display: grid; gap: 12px; align-items: center; padding: 10px 14px;
  grid-template-columns: 150px minmax(120px, 1fr) minmax(140px, 1.05fr) minmax(130px, 1fr);
}
.login-log-head {
  padding-top: 9px; padding-bottom: 9px;
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
  color: var(--color-text-muted); font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.login-log-list { max-height: 62vh; overflow-y: auto; }
.login-log-row {
  border-bottom: 1px solid var(--color-border-light);
  font-size: 13px;
  transition: background var(--transition-fast);
}
.login-log-row:last-child { border-bottom: 0; }
.login-log-row:hover { background: var(--color-surface-muted); }
.login-log-time {
  color: var(--color-text-muted); font-size: 12px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.login-log-account { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.login-log-account strong {
  color: var(--color-text); font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.login-log-username {
  color: var(--color-text-muted); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.login-log-outcome { display: flex; align-items: center; gap: 8px; min-width: 0; }
.login-log-badge {
  flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 22px;
  padding: 0 9px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 650;
}
.login-log-success .login-log-badge { background: var(--color-success-bg); color: var(--color-success); }
.login-log-fail .login-log-badge { background: var(--color-danger-bg); color: var(--color-danger); }
.login-log-reason {
  color: var(--color-text-secondary); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.login-log-source { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.login-log-ip {
  color: var(--color-text-secondary); font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.login-log-client {
  color: var(--color-text-muted); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 900px) {
  .login-log-head { display: none; }
  .login-log-row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px 14px; }
  .login-log-row .login-log-time { order: -1; }
}
@media (max-width: 680px) {
  .org-tabs { width: 100%; }
  .org-tab { flex: 1 1 0; text-align: center; }
  .org-view-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .org-view-actions .btn-primary,
  .org-view-actions .btn-secondary { flex: 1 1 auto; }
}

/* ============================================================
   超级管理员 · 自助修改登录密码（入口在顶栏账户菜单里）
   ============================================================ */
.modal-box.password-dialog { width: min(440px, 94vw); }
.password-dialog .modal-result { margin-top: 0; }

/* ============================================================
   输入框清除按钮 · 右侧安全边距
   ✕ 是绝对定位浮在输入框右侧的，文字必须靠内边距让位。
   局部规则（如 .order-form-section .store-sku-row .field input）
   用 padding 简写会把右侧内边距重置回 10px，导致右对齐的金额
   被 ✕ 压住；这里用变量 + !important 收口，避免再被局部简写覆盖。
   ============================================================ */
.input-clear-wrap {
  --clear-gutter: 30px;          /* ✕：right 4px + 宽 20px */
  --clear-gutter-datalist: 48px; /* ▼ + ✕ 并排 */
}
.input-clear-wrap input { padding-right: var(--clear-gutter) !important; }
.input-clear-wrap.has-datalist input { padding-right: var(--clear-gutter-datalist) !important; }
/* 数量步进器只有 −/输入/+ 三个格子，✕ 放不下会盖住数字；
   数量仍可用 −/+ 或键盘退格调整。隐藏后左右不再需要留白，数字居中。 */
.quantity-stepper .input-clear-btn { display: none; }
.quantity-stepper .input-clear-wrap input {
  padding-right: 0 !important;
  padding-left: 0 !important;
}
@media (max-width: 680px) {
  .input-clear-wrap {
    --clear-gutter: 48px;
    --clear-gutter-datalist: 96px;
  }
}
/* 只读字段没有“清空”语义，不显示 ✕ 也不留位 */
.input-clear-wrap:has(> input[readonly]) .input-clear-btn { display: none; }
.input-clear-wrap > input[readonly] { padding-right: 12px !important; }
.dialog-readout .input-clear-wrap > input[readonly] { padding-right: 0 !important; }
/* 书签搜索框右侧还有 “/” 快捷键提示，留宽一点 */
.bookmark-search-field .input-clear-wrap { --clear-gutter: 42px; }

/* ============================================================
   可收起的侧边导航：桌面端收起后只留图标，悬停/聚焦浮出名称。
   窄屏本来就是横向标签栏，因此折叠样式只在 >=1024px 生效。

   动画要点：列宽、内边距、间距、文字宽度与透明度共用一条 --nav-motion
   曲线；文字用 nowrap + overflow:hidden，随容器变宽被「揭示」出来，
   而不是先显示再等宽度跟上（那样会挤成一团，看起来像闪一下）。
   ============================================================ */
.nav-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; min-width: 0;
}
.nav-head .nav-section-label { flex: 1 1 auto; min-width: 0; }
.nav-toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; margin: 0 2px 6px 0;
  border: 1px solid var(--color-border); border-radius: 8px;
  background: transparent; color: var(--color-text-muted); cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast),
              border-color var(--transition-fast);
}
.nav-toggle:hover {
  color: var(--color-text); background: var(--color-surface-muted);
}
.nav-toggle:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.nav-toggle svg {
  display: block; width: 15px; height: 15px;
  transition: transform var(--transition-base);
}

@media (min-width: 1024px) {
  /* bundle 在首帧读回折叠状态，之后才打开过渡，刷新时不会看到滑动 */
  html.nav-ready { --nav-motion: .3s cubic-bezier(.4, 0, .2, 1); }
  html.nav-ready .page-grid { transition: grid-template-columns var(--nav-motion); }
  html.nav-ready .page-nav { transition: padding var(--nav-motion); }
  html.nav-ready .page-nav .nav-item {
    transition: gap var(--nav-motion), background var(--transition-fast),
                color var(--transition-fast);
  }
  html.nav-ready .page-nav .nav-label {
    transition: max-width var(--nav-motion), opacity var(--nav-motion);
  }
  html.nav-ready .nav-head .nav-section-label {
    transition: opacity var(--nav-motion), padding var(--nav-motion);
  }
  html.nav-ready .page-nav .nav-icon { transition: transform var(--nav-motion); }
  html.nav-ready .nav-toggle {
    transition: width var(--nav-motion), height var(--nav-motion),
                margin var(--nav-motion), color var(--transition-fast),
                background var(--transition-fast), border-color var(--transition-fast);
  }
  html.nav-ready .nav-toggle svg { transition: transform var(--nav-motion); }
  /* 分组标签与列宽共用同一条曲线：高度/margin/padding 一起渐变，菜单不会阶梯位移 */
  html.nav-ready .nav-group-label {
    transition: height var(--nav-motion), margin var(--nav-motion),
                padding var(--nav-motion), font-size var(--nav-motion),
                color var(--nav-motion), background-color var(--nav-motion),
                border-top-width var(--nav-motion);
  }

  /* 文字常驻 DOM，靠裁切显隐：展开时逐字揭示，收起时逐字收拢 */
  .page-nav .nav-label,
  .nav-head .nav-section-label { white-space: nowrap; overflow: hidden; }
  .page-nav .nav-label { max-width: 200px; opacity: 1; }

  html.nav-collapsed .page-grid { grid-template-columns: 56px minmax(0, 1fr); }
  html.nav-collapsed .page-nav { padding: 10px 6px; z-index: 30; }
  html.nav-collapsed .nav-head .nav-section-label {
    opacity: 0; padding-left: 0; padding-right: 0;
  }
  html.nav-collapsed .nav-toggle { width: 30px; height: 30px; margin: 0 2px 8px 0; }
  html.nav-collapsed .nav-toggle svg { transform: rotate(180deg); }
  /* 不再固定 42px：菜单项宽度完全跟随容器，图标位置才不会在动画里跳动 */
  html.nav-collapsed .page-nav .nav-item { position: relative; gap: 0; }
  html.nav-collapsed .page-nav .nav-label { max-width: 0; opacity: 0; }
  html.nav-collapsed .page-nav .nav-icon { transform: scale(1); }
  /* 名称不占宽度，只在需要时浮在图标右侧 */
  html.nav-collapsed .page-nav .nav-item::after {
    content: attr(data-nav-title);
    position: absolute; left: calc(100% + 12px); top: 50%;
    transform: translateY(-50%) translateX(-4px);
    padding: 6px 10px; border-radius: 8px;
    background: #202522; color: #fff;
    font-size: 12px; font-weight: 500; line-height: 1.4; white-space: nowrap;
    box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
  }
  html.nav-collapsed .page-nav .nav-item:hover::after,
  html.nav-collapsed .page-nav .nav-item:focus-visible::after {
    opacity: 1; transform: translateY(-50%) translateX(0);
  }
}
@media (max-width: 1023px) {
  .nav-head { display: none; }
}

/* ============================================================
   下拉控件统一
   各容器原先用 background 简写设置底色，会顺带重置背景图；上面已改为
   background-color，这里才能给所有 select 挂同一支常驻箭头。放在文件
   末尾，确保覆盖各容器的 padding / hover / focus 规则。
   ============================================================ */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%236f6a63' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 6 8 9.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
}
select:hover:not(:disabled) { border-color: #c5c2ba; }
select:disabled {
  background-color: var(--color-border-light);
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: .68;
}

/* 自绘下拉：下方空间不足时翻到输入框上方，避免被视口或底部固定操作栏裁切 */
.member-suggest.is-above { top: auto; bottom: calc(100% + 4px); }
.member-combo-menu.is-above { top: auto; bottom: calc(100% + 6px); }

/* 通用 datalist 自绘下拉：挂到 body 用 fixed 定位，避开弹窗的 overflow 裁切。
   left/width/top/bottom 由 _positionDatalistPopup 按输入框视口坐标写入。 */
.datalist-suggest {
  position: fixed;
  right: auto;
  z-index: 1500;
}
.datalist-suggest .member-suggest-badge {
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.datalist-suggest .member-suggest-empty {
  text-align: center;
  font-size: 12px;
  border-top: 1px solid var(--color-border-light);
}
.datalist-suggest .member-suggest-item:first-child + .member-suggest-empty,
.datalist-suggest .member-suggest-empty:first-child { border-top: none; }
.input-clear-wrap.is-suggest-open .input-drop-arrow { color: var(--color-text); }
/* 输入框被禁用时（如未选门店前的 SA），下拉箭头也不该可点 */
.input-clear-wrap:has(> input:disabled) .input-drop-arrow {
  opacity: .4;
  pointer-events: none;
}

/* 桌面/平板的小控件统一给到 32px 的最小点按区；≤680px 已有 44px 规则。
   不叠加 pointer:fine，无头浏览器/触控笔设备同样能命中。
   .section-help 不在此列：它自带 32px 透明点按区 + 18px 伪元素视觉圆圈。 */
@media (min-width: 761px) {
  .env-switch button, .nav-toggle, .choice-chip,
  .bookmark-action, .endpoint-copy-btn, .endpoint-call-btn,
  .field-quick-action, .memo-chip, .org-tab, .action-log-clear,
  .btn-more-actions { min-height: 32px; }
  .nav-toggle, .btn-more-actions { min-width: 32px; }
}

/* 测试工具：4 张卡原本都有 320px 最小高度，内容却只有一个输入框，收紧到内容高度。 */
[data-panel="test-tools"] { min-height: 0; padding: 20px 24px; }
[data-panel="test-tools"] .panel-description {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; margin-bottom: 14px;
}
/* 操作日志：明确条数 + 常驻滚动条，360px 内滚动不再被误认为内容结束。 */
.action-log-list-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 6px; color: var(--color-text-secondary); font-size: var(--text-xs);
}
.action-log-list-head[hidden] { display: none; }
.action-log-scroll-hint { color: var(--color-text-muted); }
.action-log-list { scrollbar-width: thin; scrollbar-color: var(--color-border) transparent; }
.action-log-list::-webkit-scrollbar { width: 6px; }
.action-log-list::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
/* 会员统计卡：选中态只用边框 + 底色 + aria-pressed 表达，不再显示文字角标。 */
