/* ============================================================
   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;

  --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-plus {
  border: 1.5px solid currentColor;
  border-radius: 3px;
}
.nav-icon-plus::before,
.nav-icon-plus::after {
  content: '';
  position: absolute;
  background: currentColor;
  border-radius: 1px;
}
.nav-icon-plus::before { width: 2px;  height: 10px; }
.nav-icon-plus::after  { width: 10px; height: 2px;  }

.nav-icon-clock {
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.nav-icon-clock::before {
  content: '';
  position: absolute;
  width: 2px; height: 5px;
  background: currentColor;
  border-radius: 1px;
  top: 2px; left: 5px;
}
.nav-icon-clock::after {
  content: '';
  position: absolute;
  width: 4px; height: 2px;
  background: currentColor;
  border-radius: 1px;
  top: 5px; left: 5px;
}

.nav-icon-person::before {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  top: 0; left: 3px;
}
.nav-icon-person::after {
  content: '';
  position: absolute;
  width: 14px; height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 7px 7px 0 0;
  border-bottom: none;
  top: 10px; left: 0;
}

.nav-icon-people::before {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  top: 0; left: 0;
}
.nav-icon-people::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  bottom: 0; right: 0;
}

.nav-icon-orders {
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.nav-icon-orders::before {
  content: '';
  position: absolute;
  width: 8px; height: 2px;
  background: currentColor;
  border-radius: 1px;
  top: 4px; left: 3px;
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}

.nav-icon-api {
  width: 19px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -1.5px;
}

.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: 9px;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-fast), 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-datalist:hover .input-drop-arrow,
.input-clear-wrap.has-datalist:focus-within .input-drop-arrow {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.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;
}

.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: 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: 9px;
  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: #ea580c;
  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: 10px;
  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: 10px;
  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: 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-muted); }
.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; }
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  font-size: 13px;
  font-weight: normal;
  color: var(--color-primary);
  cursor: help;
  position: relative;
  vertical-align: middle;
  user-select: none;
}
.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  background: rgba(30, 30, 40, 0.95);
  color: #fff;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
}
.info-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: rgba(30, 30, 40, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
}
.info-tip:hover::after,
.info-tip:hover::before,
.info-tip:focus::after,
.info-tip:focus::before { opacity: 1; }
.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: 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 input[readonly] { background: var(--color-border-light); color: var(--color-text-muted); }
.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); }
.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); border-radius: var(--radius-md);
  background: var(--color-bg); cursor: pointer;
}
.jd-refund-sku-option:has(input:checked) {
  border-color: var(--color-brand); background: var(--color-brand-soft);
}
.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); }
.import-actions { display: flex; align-items:center; gap: 4px; }
.btn-import { 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; }
/* ============================================================
   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 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.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);
}

/* Register mode tabs (微商城 / 天猫 MM / 京东 MM) */
.reg-mode-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.reg-mode-tab {
  padding: 8px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast);
}
.reg-mode-tab:hover { background: var(--color-border-light); }
.reg-mode-tab.reg-mode-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

/* 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); }

@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 {
  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: grid; place-items: center; flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.26); border-radius: 12px;
  background: rgba(255,255,255,.08); color: #fff;
  font-family: Georgia, "Times New Roman", serif; font-size: 19px; letter-spacing: -1px;
}
.env-bar-title { font-size: 15px; font-weight: 650; letter-spacing: .5px; }
.env-bar-subtitle { margin-top: 2px; color: rgba(255,255,255,.56); font-size: 11px; letter-spacing: .2px; }
.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;
}
.user-session {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  flex: 0 0 auto;
  padding: 3px 3px 3px 10px; border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-full); background: rgba(255,255,255,.055);
}
.user-session[hidden] { display: none; }
.user-session-name {
  max-width: 110px; overflow: hidden; color: rgba(255,255,255,.74);
  font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap;
}
.user-session-logout {
  min-height: 30px; padding: 5px 10px; border: 0;
  border-radius: var(--radius-full); background: rgba(255,255,255,.12);
  color: #fff; font: inherit; font-size: 10px; font-weight: 650; cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast);
}
.user-session-logout:hover { background: rgba(255,255,255,.2); }
.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: 10px; 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; }
.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;
}
.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: 10px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
}
.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); }
.nav-footer {
  margin: 12px 8px 0; padding-top: 12px; border-top: 1px solid var(--color-border-light);
  color: var(--color-text-muted); font-size: 11px; line-height: 1.6;
}
.site-footer {
  padding: 12px 16px 4px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-align: center;
}
.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-footer a:hover { color: var(--color-text-secondary); }
.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: 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);
}
.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: 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: 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; }
.jd-sku-toggle {
  display: inline-flex; align-items: center; gap: 7px; min-width: 78px;
  padding: 4px 10px 4px 5px; border: 1px solid #a9d2ba;
  border-radius: var(--radius-full); background: var(--color-success-bg);
  color: var(--color-success); font-size: 11px; font-weight: 650;
}
.jd-sku-toggle::before {
  width: 18px; height: 18px; border-radius: 50%; background: var(--color-success);
  box-shadow: 0 1px 3px rgba(35, 97, 64, .24); content: "";
}
.jd-sku-toggle[aria-checked="false"] {
  border-color: var(--color-border); background: var(--color-surface);
  color: var(--color-text-muted);
}
.jd-sku-toggle[aria-checked="false"]::before {
  background: #b8b9b5; box-shadow: none;
}
.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; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.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 { align-items: center; margin: 0 0 14px; background: #f1eee8; }
.shop-filter-copy { display: flex; flex: 1 1 220px; flex-direction: column; gap: 2px; }
.shop-filter-copy strong { font-size: 12px; }
.shop-filter-copy span { color: var(--color-text-muted); font-size: 10px; }
.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: 10px; }
.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); }
.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: 10px; }
.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: 10px; font-weight: 650; white-space: nowrap;
}
.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: 10px;
  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; }
.eoss-option, .xid-toggle-option { align-items: flex-start; white-space: normal; }
.eoss-option > span:last-child, .xid-toggle-option > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.eoss-option strong, .xid-toggle-option strong { color: var(--color-text-secondary); font-size: 12px; }
.eoss-option small, .xid-toggle-option small { max-width: 390px; color: var(--color-text-muted); font-size: 10px; font-weight: 400; }
.xid-toggle-option { grid-column: 1 / -1; }
.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; }
.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(4, 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);
}
.order-mode-tabs { grid-template-columns: repeat(4, 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 small { color: var(--color-text-muted); font-size: 10px; font-weight: 400; }
.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);
}
.reg-mode-tab.reg-mode-active small { color: #765747; }
.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;
}
.wechat-register-intro {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 14px; padding: 14px 16px;
  border: 1px solid #e5d8d1; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #fcf8f5 0%, var(--color-surface) 72%);
}
.wechat-register-intro-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wechat-register-intro-copy strong { font-size: 13px; font-weight: 650; }
.wechat-register-intro-copy span { color: var(--color-text-muted); font-size: 11px; }
.wechat-channel-badge {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
  min-height: 30px; padding: 5px 10px; border: 1px solid #d8c5bb;
  border-radius: var(--radius-full); background: var(--color-surface);
  color: #684637; font-size: 11px; font-weight: 650;
}
.wechat-channel-badge::before {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-brand); content: "";
  box-shadow: 0 0 0 3px var(--color-brand-soft);
}
.wechat-register-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 270px;
  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: 10px; 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: 10px; font-weight: 750; letter-spacing: .4px;
}
.field-hint {
  margin-top: 4px; color: var(--color-text-muted); font-size: 10px; line-height: 1.45;
}
.wechat-register-review {
  position: sticky; top: 18px; overflow: hidden;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-sm);
}
.wechat-review-header {
  display: flex; align-items: center; gap: 10px; padding: 15px;
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
}
.wechat-review-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 12px; background: var(--color-brand-soft); color: #684637;
  font-size: 13px; font-weight: 750;
}
.wechat-review-title { display: flex; flex-direction: column; min-width: 0; }
.wechat-review-title strong {
  color: var(--color-text); font-size: 13px; line-height: 1.45;
  overflow-wrap: anywhere;
}
.wechat-review-title span { color: var(--color-text-muted); font-size: 10px; }
.wechat-review-list { display: grid; margin: 0; padding: 7px 15px; }
.wechat-review-row {
  display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 10px;
  margin: 0; padding: 9px 0; border-bottom: 1px solid var(--color-border-light);
}
.wechat-review-row:last-child { border-bottom: 0; }
.wechat-review-row dt { color: var(--color-text-muted); font-size: 10px; }
.wechat-review-row dd {
  min-width: 0; margin: 0; color: var(--color-text-secondary);
  font-size: 11px; font-weight: 600; text-align: right; overflow-wrap: anywhere;
}
.wechat-review-note {
  display: flex; gap: 8px; margin: 0 15px 15px; padding: 10px 11px;
  border-radius: var(--radius-md); background: var(--color-brand-soft);
  color: #765f54; font-size: 10px; line-height: 1.55;
}
.wechat-review-note::before { content: "i"; font-weight: 750; }
.register-form-section .field input,
.register-form-section .field select { background: var(--color-surface); }
#reg-gender {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 32px;
}
#reg-gender:hover,
#reg-gender:focus {
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}
.privacy-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}
.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: 10px; line-height: 1.45; }
.register-info-callout {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 14px 16px;
  border-left: 3px solid var(--color-brand); border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--color-brand-soft);
}
.register-info-callout strong { font-size: 13px; }
.register-info-callout span { color: #765f54; font-size: 11px; line-height: 1.6; }
.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-actions { margin-top: 14px; }
.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(4, minmax(0, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.member-stat {
  min-height: 76px; display: flex; flex-direction: column; justify-content: space-between;
  padding: 13px 15px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg); background: var(--color-surface-muted);
}
.member-stat-label { color: var(--color-text-muted); font-size: 11px; font-weight: 600; }
.member-stat strong { color: var(--color-text); font-size: 23px; font-weight: 650; line-height: 1; }
.members-toolbar { align-items: center; margin-bottom: 14px; }
.members-summary { padding: 0 2px; }
#members-table-wrap .members-table { min-width: 1040px; }
#orders-table-wrap .orders-table { min-width: 1120px; }
#members-table-wrap .members-table th:last-child,
#members-table-wrap .members-table td:last-child,
#orders-table-wrap .orders-table th:last-child,
#orders-table-wrap .orders-table td:last-child {
  position: sticky; right: 0; z-index: 1;
  background: var(--color-surface);
  box-shadow: -8px 0 14px rgba(31,37,33,.035);
}
#members-table-wrap .members-table th:last-child,
#orders-table-wrap .orders-table th:last-child { z-index: 2; background: #f1eee8; }
.member-badge-bms { background: #edf4ef; color: #37634a; }
.member-badge-bms-pending { background: var(--color-warning-bg); color: var(--color-warning); }
.btn-more-actions {
  padding: 4px 10px; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-surface);
  color: var(--color-text-secondary); font-size: 12px;
}
.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; 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;
}
.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: 10px; 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: 10px; 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 span { font-size: 13px; font-weight: 600; }
.member-action-option small { color: var(--color-text-muted); font-size: 10px; font-weight: 400; }
.member-action-option:disabled { cursor: not-allowed; opacity: .42; background: transparent; }
.member-action-danger span { color: var(--color-danger); }
#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; text-transform: uppercase;
}
.members-table td { height: 48px; padding: 10px 12px; }
.members-table tbody tr { transition: background var(--transition-fast); }
.members-table tbody tr:hover { background: #faf7f3; }
.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, .nav-footer { 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; }
  .wechat-register-review { position: static; }
  .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; display: block; }
  #members-table-wrap .members-table thead { display: none; }
  #members-table-wrap .members-table tbody { display: grid; gap: 10px; }
  #members-table-wrap .members-table tr {
    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: 10px; font-weight: 650; letter-spacing: .25px;
  }
  #members-table-wrap .members-table td:nth-child(2),
  #members-table-wrap .members-table td:nth-child(5),
  #members-table-wrap .members-table td:nth-child(6),
  #members-table-wrap .members-table td:last-child { grid-column: 1 / -1; }
  #members-table-wrap .members-table td:last-child {
    position: static; background: #faf8f4; box-shadow: none; border-bottom: 0;
  }
  .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-subtitle { display: none; }
  .env-bar-actions { gap: 5px; }
  .user-session { padding-left: 3px; }
  .user-session-name { display: none; }
  .user-session-logout { min-width: 44px; min-height: 44px; padding: 7px 9px; }
  .env-switch button { min-width: 40px; padding: 4px 7px; }
  .status-bar { max-width: 48%; overflow: hidden; padding: 4px 5px; }
  .status-items { overflow: hidden; }
  .status-item { gap: 4px; padding: 2px 6px; font-size: 10px; }
  .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; }
  .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; }
  .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; }
  .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 select,
  .members-toolbar button { flex: 1 1 100%; width: 100%; }
  .register-random-btn { width: 100%; justify-content: center; }
  .reg-mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wechat-register-intro { align-items: flex-start; flex-direction: column; }
  .wechat-register-review { order: 2; }
  .privacy-options { grid-template-columns: 1fr; }
  .privacy-heading { flex-direction: column; }
  .privacy-heading button { width: 100%; }
  .register-success { align-items: stretch; flex-direction: column; }
  .register-success button { width: 100%; }
  .register-actions { flex-direction: column; align-items: stretch; }
  .order-shop-filter { align-items: stretch; }
  .shop-filter-copy { flex-basis: 100%; }
  .order-review-grid { grid-template-columns: 1fr 1fr; }
  .order-review-heading { align-items: flex-start; }
}
@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; }
}

/* ============================================================
   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: 10px; 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: 10px; 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: var(--color-surface);
  color: var(--color-text); font: inherit; font-size: 12px;
}
.endpoint-toolbar input { width: 100%; }
.endpoint-toolbar select { min-width: 128px; }
.endpoint-section + .endpoint-section { margin-top: 22px; }
.endpoint-section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 2px 8px; color: #6f5a50;
  font-size: 11px; font-weight: 750; letter-spacing: .55px;
}
.endpoint-section-title span:last-child {
  color: var(--color-text-muted); font-size: 10px; font-weight: 600;
}
.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: 10px;
  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: 10px;
}
.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: 10px; 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: 10px; 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-brand); border-radius: 8px;
  background: var(--color-brand); color: #fff; cursor: pointer; font-size: 11px;
}
.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) {
  .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)); }
  .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));
  }
}

@media (max-width: 680px) {
  #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); 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;
  }
  #orders-table-wrap .orders-table td:nth-child(1),
  #orders-table-wrap .orders-table td:nth-child(3),
  #orders-table-wrap .orders-table td:nth-child(4),
  #orders-table-wrap .orders-table td:nth-child(5),
  #orders-table-wrap .orders-table td:last-child { grid-column: 1 / -1; }
  #orders-table-wrap .orders-table td:last-child {
    position: static; background: #faf8f4; box-shadow: none; border-bottom: 0;
  }
  #orders-table-wrap .orders-table button { min-height: 44px; }
}
.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: 10px;
  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;
  }
}
