@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap");
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --success: #10B981;
  --danger: #EF4444;
  --bg: #0F172A;
  --bg-card: #1E293B;
  --bg-input: #334155;
  --border: #475569;
  --text: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --radius: 12px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 24px; }
.login-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  margin-bottom: 16px;
  font-family: inherit;
}
.login-pwd-wrap { position: relative; width: 100%; }
.login-pwd-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 17px; color: var(--text-muted); line-height: 1; }
.login-pwd-toggle:hover { color: var(--primary); }
.login-input:focus { border-color: var(--primary); }
.login-input::placeholder { color: var(--text-muted); }

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-hover); }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { font-size: 24px; }
.header-title { font-size: 18px; font-weight: 700; }

/* Stats */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 20px 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-number { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* Section */
.section {
  padding: 20px 24px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head .section-title {
  margin-bottom: 0;
}
.section-head .btn-small {
  flex-shrink: 0;
}
.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.section-actions .form-select {
  width: auto;
  min-width: 128px;
}
.list-total {
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}
.gateway-hint,
.gateway-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.gateway-result p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
}
.gateway-result-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
}
.gateway-result-error h3 { color: var(--danger); }
.gateway-result-warn {
  background: rgba(248,113,113,.14);
  border-color: #f87171;
}
.gateway-result-warn h3 { color: #f87171; }
.gateway-guide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 14px;
  margin: 0 0 14px;
  padding: 14px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.gateway-guide strong {
  color: var(--text);
  font-weight: 700;
}
.gateway-table-head {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr 0.9fr 1.25fr 0.8fr 1.25fr 1.5fr 1.45fr;
  gap: 10px;
  align-items: center;
  padding: 0 16px 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}
.gateway-row {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr 0.9fr 1.25fr 0.8fr 1.25fr 1.5fr 1.45fr;
  gap: 10px;
  align-items: center;
}
.gateway-row .tag-url small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.gateway-log-panel {
  margin: 16px 0;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.gateway-log-item {
  padding: 12px 0;
  border-top: 1px solid rgba(71, 85, 105, 0.6);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}
.gateway-log-item:first-of-type {
  border-top: 0;
}
.gateway-log-item strong {
  color: var(--text);
}
.gateway-log-time {
  color: var(--text-muted);
  font-size: 12px;
}
.field-help {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Generate form */
.generate-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.form-row {
  margin-bottom: 14px;
}
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-select, .form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.form-select:focus, .form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--text-muted); }

.btn-generate {
  margin-top: 4px;
}

/* Generated result */
.generated-result {
  margin-top: 16px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius);
  padding: 16px;
}
.generated-result h3 {
  font-size: 14px;
  color: var(--success);
  margin-bottom: 12px;
}

.generated-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 8px;
  gap: 8px;
}
.generated-item:last-child { margin-bottom: 0; }

.gen-info { flex: 1; min-width: 0; }
.gen-id { font-size: 13px; font-weight: 600; color: var(--primary); }
.gen-url {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-copy {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-copy:hover { border-color: var(--primary); color: var(--text); }
.btn-copy.copied { background: var(--success); color: white; border-color: var(--success); }

/* 已锁状态：链接已绑设备，禁止复制（防止一码多卡） */
.btn-locked {
  display: inline-block;
  padding: 6px 14px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #aaa);
  font-size: 12px;
  white-space: nowrap;
  cursor: not-allowed;
  user-select: none;
}

/* 删除按钮（仅 generated 状态显示） */
.btn-delete {
  padding: 6px 10px;
  border: 1px solid #e88;
  border-radius: 6px;
  background: transparent;
  color: #e88;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  margin-left: 6px;
}
.btn-delete:hover { background: #e88; color: white; }

/* 状态徽章 device_bound 颜色（新增） */
.status-badge.status-active {
  background: rgba(100, 180, 250, 0.15);
  color: #6cf;
  border: 1px solid rgba(100, 180, 250, 0.3);
}

/* 卡片元信息 */
.tag-song {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.tag-meta {
  font-size: 11px;
  color: var(--text-muted, #888);
  margin-top: 2px;
}

/* ===== 数据分析 Dashboard ===== */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.analytics-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.analytics-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}
.empty-state-mini {
  font-size: 12px;
  color: var(--text-muted, #888);
  padding: 18px 0;
  text-align: center;
}

/* 漏斗 */
.funnel-row {
  display: grid;
  grid-template-columns: 90px 1fr 56px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}
.funnel-label { color: var(--text-secondary); }
.funnel-track {
  height: 22px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
}
.funnel-bar {
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  border-radius: 4px;
  min-width: 22px;
}
.funnel-conv {
  text-align: right;
  color: var(--text);
  font-size: 11px;
}
.funnel-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

/* 地理 */
.geo-row {
  display: grid;
  grid-template-columns: 40px 1fr 30px;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.geo-country { color: var(--text); font-weight: 600; }
.geo-bar {
  height: 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
}
.geo-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #6cf, #8c5);
  border-radius: 3px;
}
.geo-count { text-align: right; color: var(--text-secondary); }

/* 时间序列 legend */
.timeline-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}
.timeline-legend span { display: flex; align-items: center; gap: 5px; }
.timeline-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.filter-bar .form-select { width: auto; min-width: 120px; }

/* Tag table */
.tag-table { overflow-x: auto; }

.tag-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.tag-id { font-weight: 600; font-size: 13px; color: var(--primary); min-width: 100px; }
.tag-project {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--bg-input);
  border-radius: 4px;
  color: var(--text-secondary);
}
.tag-url {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.tag-status.st-done { background: rgba(16, 185, 129, .15); color: #10B981; }
.tag-status.st-mid { background: rgba(59, 130, 246, .15); color: #3B82F6; }
.tag-status.st-empty { background: rgba(148, 163, 184, .15); color: #94A3B8; }
.tag-status.st-unknown { background: rgba(148,163,184,.14); color: #94a3b8; }
.tag-status.st-danger { background: rgba(239, 68, 68, .15); color: #EF4444; }
.tag-status.st-error { background: rgba(239, 68, 68, .15); color: #EF4444; }
.tag-status.unused { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.tag-status.used { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.tag-actions { display: flex; gap: 6px; }
.product-row .tag-actions {
  flex-wrap: wrap;
  align-items: center;
}
.product-price-input {
  width: 110px;
  min-width: 110px;
  padding: 5px 8px;
  font-size: 12px;
}
.product-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}
.product-active-toggle input { width: auto; }
.btn-small {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.btn-small:hover { border-color: var(--primary); color: var(--text); }
.btn-small.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-small.selected, .mbti-type-btn.selected { background: var(--primary); color: white; border-color: var(--primary); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--success);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
  transition: transform 0.3s;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Tab navigation */
.tab-bar {
  display: flex;
  gap: 0;
  padding: 0 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

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

/* Module subtabs */
.subtab-switch {
  display: flex;
  gap: 8px;
  padding: 0 24px 12px;
}
.subtab-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.subtab-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}
.subtab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.module-subpane {
  display: none;
}
.module-subpane.active {
  display: block;
}

/* Non-clickable stat cards */
.stats-display .stat-card {
  cursor: default;
  user-select: none;
  border-color: rgba(71,85,105,0.4);
  opacity: 0.9;
}
.stats-display .stat-card:hover {
  transform: none;
  box-shadow: none;
}

/* Collapsible toggle */
.collapse-toggle {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.2s;
}
.collapse-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.collapse-toggle.open {
  border-style: solid;
  border-color: var(--primary);
  color: var(--primary);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
}
.collapse-panel {
  display: none;
  border: 1px solid var(--primary);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px;
  background: rgba(99,102,241,0.03);
}
.collapse-panel.open { display: block; }

/* Modal */
.modal-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%; max-width: 440px;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* Gateway data table overrides */
.tag-table .gateway-table-head,
.tag-table .tag-row.gateway-row {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr 0.9fr 1.25fr 0.8fr 1.25fr 1.5fr 1.45fr;
  gap: 10px;
  align-items: center;
  min-width: 980px;
}
.tag-table .gateway-table-head {
  padding: 0 16px 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}
.tag-table .tag-row.gateway-row {
  padding: 12px 16px;
  flex-wrap: nowrap;
}
.tag-table .gateway-row .tag-id {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-table .gateway-row .tag-url small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-table .gateway-row .tag-actions {
  flex-wrap: wrap;
}

/* LoveGift */
.lovegift-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 280px;
}
.lovegift-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.lovegift-photo {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
}
.lovegift-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lovegift-photo.is-print {
  border-color: #10B981;
}
.lovegift-photo span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(16, 185, 129, .9);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

/* Desktop user administration */
.users-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.users-toolbar input { max-width: 320px; }
.users-table { width: 100%; border-collapse: collapse; margin: 16px 0; text-align: left; }
.users-table th, .users-table td { padding: 12px; border-bottom: 1px solid var(--border, #e5e7eb); }
.users-table th { color: var(--text-secondary); font-size: 13px; }
.quota-editor { display: flex; align-items: center; gap: 8px; }
.quota-editor input { width: 110px; }
.quota-message { font-size: 12px; }
.shipment-countdown { display: inline-block; padding: 4px 8px; background: #e8f3ee; color: #246347; border-radius: 4px; font-size: 12px; cursor: default; }
.shipment-soon { background: rgba(248,113,113,.14); color: #f87171; }
.shipment-late { background: #fee2e2; color: #b91c1c; }

/* Nocturne tokens shared by the styled admin modules. */
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) {
  --color-accent-800: rgba(145,132,217,.18);
  --color-neutral-300: #8b899a;
  --color-text: #e7e6ee;
  --color-success: #4ade80;
  --radius: 10px;
  --primary: #9184d9;
  --primary-hover: #9184d9;
  --bg: #0e0f16;
  --bg-card: #141520;
  --bg-input: #12131c;
  --text: #e7e6ee;
  --text-secondary: #8b899a;
  --text-muted: #5c5a68;
  --border: rgba(255,255,255,.12);
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: calc(100vh - 114px);
}
/* Order workbench: first two cards above the remaining three on phones. */
#lovegiftStatsBar.lovegift-order-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
#lovegiftStatsBar .lovegift-order-card.card { position: relative; min-width: 0; padding: 20px 10px; height: 150px; min-height: 150px; border: 2px solid var(--border); color: var(--text); cursor: pointer; text-align: center; }
#lovegiftStatsBar .lovegift-order-card.is-selected { border-color: var(--primary); background: var(--primary-light, rgba(99,102,241,.12)); }
#lovegiftStatsBar .lovegift-order-card.is-dimmed { opacity: .65; }
.lovegift-card-check { display: none; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: white; }
.lovegift-order-card.is-selected .lovegift-card-check { display: block; }
.lovegift-order-card .lovegift-muted { font-size: 10px; }
.lovegift-todo { display: inline-block; font-size: 11px; border-radius: 12px; padding: 4px 6px; background: rgba(99,102,241,.1); color: var(--primary); }
.lovegift-todo[hidden] { display: none; }
.lovegift-todo-today { color: #60a5fa; }
.lovegift-todo-pending_stock { color: #fb923c; background: rgba(251,146,60,.18); }
.lovegift-todo-shipped { color: var(--color-success); background: rgba(74,222,128,.1); }
.lovegift-card-filter-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; padding: 12px; background: rgba(99,102,241,.1); border-radius: 10px; }
.lovegift-card-filter-bar[hidden] { display: none; }
@media (max-width: 600px) {
  #lovegiftStatsBar.lovegift-order-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  #lovegiftStatsBar .lovegift-order-card.card { grid-column: span 2; padding: 18px 4px 10px; }
  #lovegiftStatsBar .lovegift-order-card:nth-child(-n+2) { grid-column: span 3; }
  .lovegift-card-filter-bar { font-size: 12px; }
}

#lovegiftOpsPane button, #lovegiftOpsPane input, #lovegiftOpsPane select { font-family: inherit; }
#lovegiftOpsPane .section { background: var(--bg); }
#lovegiftOpsPane .section-title { color: #e26aa0; margin: 0; }
.lovegift-heading, .lovegift-view-switch, .lovegift-customer { display: flex; align-items: center; gap: 10px; }
#lovegiftOpsPane .filter-bar { flex-wrap: wrap; }
#lovegiftSearch { flex: 1; min-width: 240px; }
#lovegiftOpsPane .form-select { width: auto; max-width: 240px; }
#lovegiftOrderTable { overflow-x: auto; }
#lovegiftOrderTable .table { min-width: 980px; }
#lovegiftOrderTable .lovegift-row {
  grid-template-columns: 1.25fr 1.2fr 1.5fr .9fr 1fr 1fr;
  min-width: 980px;
}
#lovegiftOrderTable .lovegift-row { cursor: pointer; background: transparent; color: #e7e6ee; }
#lovegiftOrderTable .lovegift-row > * { min-width: 0; overflow-wrap: anywhere; }
:is(#lovegiftOpsPane, #lovegiftDrawer) small { display: block; margin-top: 5px; color: #8b899a; font-size: 11px; }
#lovegiftOpsPane .tag-id { color: #e7e6ee; }
.lovegift-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lovegift-order-number { white-space: nowrap; }
.lovegift-test-label {
  display: inline;
  font-size: 12.5px;
  margin-left: 6px;
  color: #A78BFA;
  vertical-align: baseline;
  line-height: 0;
}
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .tag-status, #tabLovegift .shipment-countdown {
  display: inline-flex; width: fit-content; border: 0; border-radius: 999px; padding: 4px 8px;
  color: #94a3b8; background: rgba(148,163,184,.14); font-size: 11px; white-space: nowrap;
}
.lovegift-gateway { display: flex; align-items: center; gap: 5px; color: #5c5a68; overflow-wrap: anywhere; }
.lovegift-gateway svg { flex-shrink: 0; }
:is(#lovegiftOpsPane, #lovegiftDrawer) .is-bound, :is(#lovegiftOpsPane, #lovegiftDrawer) .is-bound a { color: #4ade80; }
.lovegift-drawer-layer { position: fixed; inset: 0; z-index: 1000; visibility: hidden; pointer-events: none; transition: visibility .22s; }
.lovegift-drawer-layer.is-open { visibility: visible; pointer-events: auto; }
.lovegift-backdrop { position: absolute; inset: 0; background: rgba(14,15,22,.7); opacity: 0; transition: opacity .22s; }
.lovegift-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 500px; max-width: 100vw; background: #141520; border-left: 1px solid var(--border); display: flex; flex-direction: column; height: 100dvh; max-height: 100dvh; overflow: hidden; transform: translateX(100%); transition: transform .22s ease; padding: 0; }
.is-open .lovegift-backdrop { opacity: 1; }
.is-open .lovegift-drawer { transform: translateX(0); }
.lovegift-drawer-heading { flex: 0 0 auto; padding: 18px 20px 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.lovegift-drawer-heading > div { min-width: 0; overflow-wrap: anywhere; }
.lovegift-drawer-heading h2 { font-size: 18px; }
.lovegift-drawer-heading button { font-size: 22px; padding: 0 9px; }
.lovegift-panel-tabs { flex: 0 0 auto; padding: 0 20px; display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin: 0; }
.lovegift-panel-tabs button { border: 0; border-bottom: 2px solid transparent; padding: 10px 2px; background: transparent; color: #8b899a; cursor: pointer; }
.lovegift-panel-tabs [aria-selected="true"] { color: #9184d9; border-color: #9184d9; }
#lovegiftDrawerContent h3 { font-size: 13px; margin: 22px 0 10px; }
.lovegift-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.lovegift-preview > * { width: 100%; height: 145px; object-fit: contain; background: #12131c; border: 1px solid var(--border); border-radius: 8px; }
.lovegift-preview > span { display: grid; place-items: center; color: #5c5a68; font-size: 12px; }
.lovegift-video-path { display: flex; align-items: flex-start; gap: 8px; padding: 12px; background: #12131c; border: 1px solid var(--border); border-radius: 8px; }
.lovegift-video-path code { flex: 1; min-width: 0; font-family: monospace; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.lovegift-video-path button { flex: none; white-space: normal; max-width: 120px; }
#lovegiftOpsPane .is-copied { color: #4ade80; background: rgba(56,189,133,.14); }
.lovegift-kv { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 16px; margin: 24px 0; font-size: 13px; }
.lovegift-kv dt, .lovegift-muted { color: #8b899a; }
.lovegift-kv dd { margin: 0; overflow-wrap: anywhere; }
.lovegift-drawer-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 16px 20px 24px; }
.lovegift-drawer-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 10px; background: #141520; border-top: 1px solid var(--border); padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); }
.lovegift-drawer-actions[hidden] { display: none; }
.lovegift-drawer-actions > span { flex-basis: 100%; font-size: 12px; color: var(--text-muted); }
.lovegift-drawer-actions > button { min-height: 42px; }
.lovegift-order-group { padding: 14px 0; border-bottom: 1px solid var(--border); }
.lovegift-order-group summary { cursor: pointer; font-weight: 600; }
.lovegift-backfill-todo, .lovegift-missing { color: #fbbf24; background: rgba(245,158,11,.12); border-radius: 6px; padding: 6px; }
.lovegift-backfill-todo { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; }
.lovegift-sort-heading { color: inherit; font: inherit; background: transparent; border: 0; cursor: pointer; }
#lovegiftPagination { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.lovegift-toolbar { justify-content: flex-end; }
.lovegift-detail-link { white-space: nowrap; color: var(--primary); }
.lovegift-drawer-actions > button { flex: 1; padding: 10px; }
#lovegiftOpsPane .btn-primary { background: #5b52e0; color: #e7e6ee; }
#lovegiftOpsPane button:disabled { opacity: .5; cursor: not-allowed; }
#lovegiftOpsPane :focus-visible { outline: 2px solid #9184d9; outline-offset: 2px; }
.lovegift-user-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
#lovegiftDrawerContent .lovegift-user-heading h3 { margin: 0 0 6px; font-size: 16px; }
.lovegift-user-heading p, .lovegift-muted { font-size: 12px; }
.lovegift-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(145,132,217,.18); color: #9184d9; }
#lovegiftDrawerContent .quota-editor { flex-wrap: wrap; }
.lovegift-other-orders { display: grid; gap: 8px; margin-top: 12px; }
.lovegift-other-orders button { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; text-align: left; }
.lovegift-other-orders button > span:first-child { min-width: 0; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) {
  .lovegift-drawer-layer, .lovegift-backdrop, .lovegift-drawer { transition: none; }
}
@media (max-width: 600px) {
  #lovegiftOpsPane .section-head { flex-wrap: wrap; gap: 14px; }
  .lovegift-drawer { padding: 0; }
}

/* Shared Nocturne components for LoveGift and batches A / B. */
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :is(button, input, select) { font-family: inherit; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-heading .lovegift-icon { color: var(--primary); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .section-title { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.lovegift-icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.tab-btn[data-tab="lovegift"] .lovegift-icon { color: #9184d9; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .segmented-control { display: inline-flex; width: fit-content; gap: 0; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .subtab-switch { margin: 24px 24px 14px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .segment { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; min-height: 36px; border: 0; border-radius: 0; background: transparent; color: var(--color-neutral-300); font-size: 13px; font-weight: 400; cursor: pointer; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .segment + .segment { border-left: 1px solid var(--border); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .segment:hover { color: var(--text); background: rgba(255,255,255,.03); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .segment.active { background: var(--color-accent-800); color: var(--color-text); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .segment.active .lovegift-icon { stroke-width: 2; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-search { position: relative; flex: 1; min-width: min(260px, 100%); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-search > .lovegift-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .form-input, :is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .form-select { height: 38px; background-color: var(--bg-input); border: 1px solid var(--border); color: var(--text); border-radius: 8px; font-size: 13px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-search .form-input { width: 100%; min-width: 0; max-width: none; padding-left: 38px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .form-input::placeholder { color: var(--text-muted); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-toolbar .form-select { width: auto; max-width: 100%; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-batch-field { display: flex; flex: 1; align-items: center; gap: 12px; min-width: min(300px, 100%); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-batch-field label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :is(.btn-primary, .btn-secondary, .btn-icon) { display: inline-flex; flex: none; width: auto; min-height: 38px; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; cursor: pointer; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .btn-primary { background: #5b52e0; color: var(--text); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .btn-secondary { background: rgba(255,255,255,.03); border-color: var(--border); color: var(--text); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .btn-icon { width: 38px; padding: 8px; background: transparent; color: var(--text-secondary); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :is(.btn-secondary, .btn-icon):hover { background: var(--color-accent-800); color: var(--text); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .btn-secondary.is-copied { color: var(--color-success); background: rgba(56,189,133,.14); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .btn-primary:hover { filter: brightness(1.1); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) button:disabled { opacity: .5; cursor: not-allowed; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-customer .btn-icon { width: 26px; min-height: 26px; padding: 4px; color: var(--primary); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) #usersTable { overflow-x: auto; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) #usersTable .lovegift-row { cursor: pointer; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table { width: 100%; margin: 0; border: 0; border-collapse: collapse; text-align: left; font-size: 13px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table :is(th, td) { padding: 14px 16px; border: 0; vertical-align: middle; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table th { background: #161722; color: var(--text-secondary); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table tbody tr { border: 0; border-bottom: 1px solid rgba(255,255,255,.06); background: transparent; color: var(--text); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table tbody tr:hover { background: rgba(145,132,217,.06); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .primary-cell { display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .primary-cell :is(small, .primary-secondary) { margin: 0; color: var(--text-secondary); font-size: 11.5px; font-weight: 400; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .quota-editor { flex-wrap: wrap; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .primary-secondary .form-input { width: 82px; color: var(--text-secondary); font-size: 12px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :is(.st-neutral, .tag-status.st-empty) { color: #94a3b8; background: rgba(148,163,184,.14); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .tag-status.st-done { color: var(--color-success); background: rgba(56,189,133,.14); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .tag-status.st-mid { color: var(--primary); background: var(--color-accent-800); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .tag-status.st-error { color: #f87171; background: rgba(248,113,113,.12); }
/* Order-only Nocturne status colors, shared by list and drawer.
 * 行动色排他（Exclusive Action Orange）：全后台只有「待备货」可用橙色；
 * 不需要平台立刻动手的状态（尤其「待支付」「已下单」）禁止用橙色。
 * 色相单义（Semantic Singularity）：同一责任类型只用一个色，不得新增相近色。
 * 噪声预算（Noise Budget）：同屏暖色（红/橙）面积预期 <15%；常态列表 90% 为冷色/灰。
 */
#tabLovegift .tag-status.st-pending { color: #94a3b8; background: rgba(148,163,184,.14); }
#tabLovegift .tag-status.st-producing { color: #fb923c; background: rgba(251,146,60,.18); }
#tabLovegift .tag-status.st-bound { color: #5eead4; background: rgba(94,234,212,.14); }
#tabLovegift .tag-status.st-shipped { color: #93c5fd; background: rgba(147,197,253,.14); }
#tabLovegift .tag-status.st-completed { color: #86efac; background: rgba(134,239,172,.14); }
#tabLovegift .tag-status.st-exception { color: #f87171; background: rgba(248,113,113,.14); }
#tabLovegift .tag-status.st-unpaid { color: #94a3b8; background: rgba(148,163,184,.14); }
#tabLovegift .tag-status.st-paid { color: #94a3b8; background: rgba(148,163,184,.14); }
#tabLovegift .tag-status.st-user-progress { color: #c4b5fd; background: rgba(196,181,253,.14); }
#tabLovegift .tag-status.st-slate { color: #94a3b8; background: rgba(148,163,184,.14); }
#tabLovegift .tag-status.st-refunded { color: #64748b; background: rgba(100,116,139,.14); }
#tabLovegift .tag-status.st-generating { color: #a5b4fc; background: rgba(165,180,252,.14); }
#tabLovegift .tag-status.st-ready { color: #67e8f9; background: rgba(103,232,249,.14); }
#tabLovegift .tag-status.st-failed { color: #fda4af; background: rgba(253,164,175,.14); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .shipment-countdown { color: #5eead4; background: rgba(94,234,212,.12); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .shipment-countdown.shipment-soon { color: #f87171; background: rgba(248,113,113,.14); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .shipment-countdown.shipment-late { color: #f87171; background: rgba(248,113,113,.12); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .empty-value { color: var(--text-muted); font-size: 12px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .empty-value::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E") center / contain no-repeat; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); opacity: 1; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-reconciliation { margin: 0 24px 24px; padding: 20px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :is(.stat-card, .analytics-card) { text-align: center; padding: 20px 16px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :is(.stat-number, .analytics-value) { font-size: 28px; font-weight: 600; line-height: 1.2; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :is(.stat-label, .analytics-label) { color: var(--text-secondary); font-size: 12px; margin-top: 8px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .number-neutral { color: var(--text-muted); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .number-accent { color: var(--primary); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .number-success { color: var(--color-success); }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) #usersTotal { color: var(--text-secondary); font-size: 12px; }
:is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) #lovegiftShipCheckResult { padding: 0; }
@media (max-width: 640px) {
  :is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-toolbar { gap: 8px; }
  :is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-toolbar .form-select { flex: 1; min-width: 0; }
  :is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-batch-field { flex-wrap: wrap; }
  :is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .lovegift-reconciliation { margin-inline: 16px; padding: 16px; }
  :is(#tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .users-table { min-width: 680px; }
}

/* Batches A / B: shared list and card layouts. */
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .section { margin: 20px 24px; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table { min-width: 720px; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table th { text-transform: lowercase; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table :is(th, td):first-child { padding-left: 0; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .table :is(th, td):last-child { padding-right: 0; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .tag-url { white-space: normal; overflow-wrap: anywhere; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .tag-actions { align-items: center; flex-wrap: wrap; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .primary-cell .tag-id { color: var(--text); }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .analytics-card { text-align: left; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) :is(h3, .stat-label, .funnel-label) .lovegift-icon { margin-right: 4px; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .btn-secondary.danger { color: #f87171; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .btn-secondary.copied { color: var(--color-success); }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .btn-primary .lovegift-icon,
#tabMelody .segment.active .lovegift-icon { stroke-width: 16; }
.tab-btn:is([data-tab="gift"], [data-tab="melody"], [data-tab="orders"]).active .lovegift-icon { stroke-width: 16; }
@media (max-width: 640px) {
  :is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .section { margin-inline: 16px; }
}

:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .muted-value { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .tag-status { align-items: center; gap: 4px; font-weight: 400; }
:is(#tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) > :first-child:has(.form-select) { margin-inline: 24px; flex-wrap: wrap; }

/* Batch B uses the same Nocturne components and preserves module layouts. */
:is(#tabXiaoyu, #tabCharm) .segment.active .lovegift-icon { stroke-width: 16; }
.tab-btn:is([data-tab="xiaoyu"], [data-tab="mbti"], [data-tab="kada"], [data-tab="charm"]).active .lovegift-icon { stroke-width: 16; }
:is(#tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .generated-result.card { padding: 16px; }
:is(#tabXiaoyu, #tabKada, #tabCharm) .section-title .list-total { font-size: 12px; font-weight: 400; }
#gatewayDeviceTable .table { min-width: 1120px; }
#mbtiStaticGrid .card > div { flex-wrap: wrap; gap: 8px; }
#tabCharm .gateway-result-error { border-color: var(--danger); }
#tabCharm .gateway-result-warn { border-color: #f87171; }

:is(#tabXiaoyu, #tabKada, #tabCharm) .section-title { flex-wrap: wrap; }
#tabCharm #gatewayShipCheckResult { padding: 20px 0 0; }

/* Shared admin dialogs; deliberately scoped outside the global button rules. */
body.admin-dialog-open { overflow: hidden; }
.admin-dialog-backdrop, .admin-shipment-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(4px);
}
.admin-dialog, .admin-shipment-dialog {
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 16px 48px color-mix(in srgb, var(--bg) 60%, transparent);
}
.admin-dialog-title { margin: 0 0 16px; font-size: 20px; font-weight: 700; line-height: 1.5; }
.admin-dialog-body { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.8; white-space: pre-line; overflow-wrap: anywhere; }
.admin-dialog-actions, .admin-shipment-dialog .modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.admin-dialog-button, .admin-shipment-dialog .modal-actions button {
  flex: 0 0 auto;
  width: auto;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
}
.admin-dialog-button--secondary, .admin-shipment-dialog .btn-secondary { background: var(--bg-input); color: var(--text-secondary); }
.admin-dialog-button--primary, .admin-shipment-dialog .btn-primary { background: var(--primary); color: var(--text); }
.admin-dialog-button--primary:hover, .admin-shipment-dialog .btn-primary:hover { background: var(--primary-hover); }
.admin-dialog-button:hover, .admin-shipment-dialog .modal-actions button:hover { border-color: var(--text-secondary); }
.admin-dialog-button:focus-visible, .admin-shipment-dialog :is(button, input, select):focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.admin-shipment-dialog > p { line-height: 1.7; color: var(--text-secondary); }
.admin-shipment-dialog .form-row { margin-top: 18px; }
.admin-shipment-dialog label { display: block; margin-bottom: 8px; color: var(--text-secondary); font-size: 14px; }
.admin-shipment-dialog :is(input, select) { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); color: var(--text); font: inherit; color-scheme: dark; }
.admin-shipment-dialog #lovegiftShipmentError:empty { display: none; }
.admin-shipment-dialog #lovegiftShipmentError:not(:empty) { margin-top: 16px; }
.admin-shipment-dialog button:disabled { opacity: .6; cursor: wait; }
@media (max-width: 480px) {
  .admin-dialog, .admin-shipment-dialog { padding: 20px; }
  .admin-dialog-actions, .admin-shipment-dialog .modal-actions { gap: 8px; }
  .admin-dialog-button, .admin-shipment-dialog .modal-actions button { padding-inline: 12px; }
}

/* Shared reusable declarations; existing literal colors remain at their original sites. */
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-checkbox-label { display:flex; align-items:center; gap:8px; cursor:pointer; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-discount-label { color: var(--danger); font-size: 12px; margin-left: 4px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-fluid-svg { width:100%; height:auto; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-product-label { font-size:12px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-scope-label { font-size:13px; color:var(--text-secondary); }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-scope-row { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .form-select.admin-scope-select { width:auto; min-width:160px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-secondary-caption { font-size:12px; color:var(--text-secondary); }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-section-intro { font-size:13px; color:var(--text-secondary); margin-bottom:20px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-stat-compact { font-size:18px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-sync-label { font-size:11px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-test-label { font-size:11px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-width-100 { width: 100px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-width-80 { width: 80px; }
:is(body, #tabLovegift, #tabGift, #tabMelody, #tabOrders, #tabXiaoyu, #tabMbti, #tabKada, #tabCharm) .admin-width-auto { width:auto; }
.admin-dialog-input { display: block; width: 100%; min-height: 42px; margin-top: 18px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); color: var(--text); font: inherit; }
.admin-dialog-input:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

/* User experience summary: reuse stat typography and colors. */
#usersExperienceStats { margin: 16px 0; min-width: 0; }
.users-experience-cards { display: flex; flex-wrap: wrap; gap: 12px; }
.users-experience-cards .stat-card { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
/* User overview: read-only rows, matching mobile cards and shared drawer. */
#usersPagination { display:flex; justify-content:flex-end; margin:10px 0; }
#usersSortNotice { text-align:right; margin:8px 0; }
#usersSort { width:195px; flex:none; }
#lovegiftUsersPane .lovegift-search { flex:0 1 240px; }
#usersDataScope { width:165px; }
#lovegiftUsersPane .users-toolbar { justify-content:flex-end; flex-wrap:wrap; }
#usersExperienceStats .users-experience-cards { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
#usersExperienceStats .stat-card { height:74px; padding:8px 12px; margin:0; display:flex; flex-direction:column; justify-content:center; }
#usersExperienceStats .stat-number { font-size:20px; line-height:1.1; }
#usersExperienceStats .stat-label { font-size:11px; }
#usersExperienceStats .stat-card p { font-size:10px; margin:2px 0 0; line-height:1.2; }
.user-identity { display:flex; align-items:center; gap:8px; min-width:0; }
.user-identity > div { min-width:0; }
.user-identity strong, .user-identity small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.user-identity small { color:var(--text-muted); margin-top:3px; }
.user-identity .lovegift-avatar { width:32px; height:32px; flex:none; }
.user-stage { display:inline-flex; border-radius:999px; padding:4px 8px; font-size:11px; white-space:nowrap; }
.user-stage-buyer { color:#34d399; background:rgba(16,185,129,.15); }
.user-stage-trial { color:#a5b4fc; background:rgba(99,102,241,.15); }
.user-stage-newbie { color:#94a3b8; background:rgba(148,163,184,.15); }
.user-stage-depleted { color:#fbbf24; background:rgba(245,158,11,.15); }
.user-quota.is-empty { color:#fbbf24; }
.user-buyer { color:#34d399; }
.user-mobile-cards { display:none; }
#lovegiftDrawerContent .quota-editor input { width:90px; flex:0 0 90px; }
.user-order-link { display:flex; flex-direction:column; align-items:flex-start; gap:6px; width:100%; text-align:left; white-space:normal; }
.user-detail-group { flex:none; }
#lovegiftDrawerActions.user-drawer-actions { display:grid; grid-template-columns:1fr 1fr; }
#lovegiftDrawerTitle .user-identity { font-size:16px; }
#lovegiftDrawerTitle .user-identity small { font-size:12px; font-weight:normal; }
@media (max-width:600px) {
  #usersTable .users-table { display:none; }
  #usersExperienceStats .users-experience-cards { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #lovegiftUsersPane .users-toolbar { display:grid; grid-template-columns:minmax(0,1fr) 165px; gap:8px; }
  #lovegiftUsersPane .users-toolbar > button { grid-column:2; justify-self:end; }
  #lovegiftUsersPane .lovegift-search { flex:1; min-width:0; width:auto; }
  #lovegiftUsersPane .lovegift-search input { width:100%; min-width:0; }
  #usersSort { width:165px; font-size:11px; padding:8px 4px; }
  .user-mobile-cards { display:flex; flex-direction:column; gap:10px; }
  .user-mobile-card { height:168px; flex:none; display:flex; flex-direction:column; justify-content:space-between; padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--bg-card); cursor:pointer; overflow:hidden; }
  .user-card-top, .user-card-bottom { display:flex; align-items:center; justify-content:space-between; gap:6px; }
  .user-card-top .user-identity { flex:1; font-size:12px; }
  .user-card-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; font-size:11px; padding:8px 0; border-block:1px solid var(--border); }
  .user-card-grid > div { white-space:nowrap; }
  .user-card-bottom { font-size:10px; color:var(--text-muted); white-space:nowrap; }
}


/* Data tab supplementary experience metrics. */
#lovegiftExperienceFunnel .experience-funnel-metrics { margin-top: 16px; }
#lovegiftExperienceFunnel .stats-bar { display: flex; flex-wrap: wrap; }
#lovegiftExperienceFunnel .stats-bar .stat-card { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }

/* 内容生产：仅限定本块的布局与间距，沿用现有视觉。 */
#lovegiftContentStats .section-title { margin-top: 20px; }
#lovegiftContentStats > .section-title:first-child { margin-top: 0; }
#lovegiftContentStats .analytics-grid { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
#lovegiftContentStats .funnel-row { grid-template-columns: minmax(0, 90px) minmax(0, 1fr) 64px; }
#lovegiftContentStats .funnel-label { overflow-wrap: anywhere; }
#lovegiftContentStats .tag-table table { min-width: 520px; }
#lovegiftContentStats .tag-table td:first-child { max-width: 240px; white-space: normal; overflow-wrap: anywhere; }

/* Order analytics: existing components and palette, layout only. */
#lovegiftOrderFunnel .section-title { margin-top: 24px; }
#lovegiftOrderFunnel > .section-title:first-child { margin-top: 0; }
#lovegiftOrderFunnel .funnel-row { grid-template-columns: minmax(0, 100px) minmax(0, 1fr) minmax(100px, auto); }
#lovegiftOrderFunnel .funnel-bar { min-width: 0; padding-left: 0; }
#lovegiftOrderFunnel .funnel-label, #lovegiftOrderFunnel .funnel-conv { overflow-wrap: anywhere; }
#lovegiftOrderFunnel .stats-display { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
@media (max-width: 640px) {
  #lovegiftOrderFunnel .stats-display { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Global notification health; hidden occupies no space. */
#sysAlertBar[hidden] { display: none; }
.sys-alert { display: flex; align-items: center; gap: 16px; padding: 12px 24px; }
.sys-alert.error { background: #fee2e2; color: #991b1b; }
.sys-alert.warn { background: rgba(248,113,113,.14); color: #f87171; }
.sys-alert.dry-run { background: #f3f4f6; color: #4b5563; }
.sys-alert button { flex-shrink: 0; cursor: pointer; }

/* Product options stay collapsed behind a local dialog. */
.product-options-dialog { width: min(800px, 94vw); max-height: 90dvh; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-card); color: var(--text); overflow: auto; }
.product-options-dialog::backdrop { background: rgba(0,0,0,.6); }
.product-options-dialog fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.product-option-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.product-option-toolbar :is(h2, strong) { margin-right: auto; }
.product-options-dialog > fieldset > .product-option-toolbar { position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
#productOptionsGroups { max-height: 58dvh; overflow-y: auto; display: grid; gap: 12px; }
.product-option-card { height: 280px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.product-option-heading, .product-option-value { display: flex; align-items: center; gap: 12px; }
.product-option-heading > label:first-child, .product-option-value > label { flex: 1; min-width: 0; }
.product-option-values { overflow-y: auto; flex: 1; min-height: 0; }
.product-option-value { min-height: 78px; }
.product-option-image { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.product-option-image img { object-fit: contain; border-radius: 4px; border: 1px solid #ddd; }
.product-options-dialog label { font-size: 13px; }
.product-options-dialog input[type="checkbox"] { width: auto; }
#productOptionsError { color: var(--danger, #ef4444); min-height: 24px; }
.product-options-dialog button:disabled { opacity: .5; cursor: not-allowed; }
.product-options-entry { margin-left: auto; order: 1; flex-shrink: 0; }
#productTable .product-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; height: auto; overflow: visible; cursor: pointer; margin-top: 12px; }
#productTable .product-row > * { min-width: 0; overflow-wrap: anywhere; }
#productTable .product-row:hover, #productTable .product-row:focus-visible { background: rgba(145,132,217,.08); outline: 1px solid var(--primary); }
.product-overview-image { font-size: 12px; color: var(--text-muted); }
.product-overview-image img { object-fit: contain; border-radius: 8px; }
.product-overview-name { display: flex; flex-direction: column; gap: 8px; }
.product-info-label { font-size: 12px; color: var(--text-muted); }
.product-overview-price, .product-overview-promo { grid-column: 1 / -1; }
.product-overview-price { display: flex; gap: 12px; align-items: center; }
.product-overview-promo { color: var(--text-muted); font-size: 13px; }
#productTable .product-row > div:nth-last-child(-n+2) { grid-column: span 3; font-size: 13px; }
.product-status-switch { align-self: start; border: 1px solid var(--border); min-height: 44px; }
.product-status-switch::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.product-status-switch[aria-checked="true"] { border-color: #4ade80; color: #4ade80; }
@media (min-width: 1100px) {
  #productTable .product-row { grid-template-columns: 54px minmax(140px, 1.2fr) 120px minmax(180px, 1.5fr) 120px 120px 85px; }
  #productTable .product-status-switch { grid-column: 7; grid-row: 1; }
  #productTable .product-overview-price { grid-column: 3; grid-row: 1; flex-direction: column; align-items: flex-start; }
  #productTable .product-overview-promo { grid-column: 4; grid-row: 1; }
  #productTable .product-row > div:nth-last-child(2) { grid-column: 5; grid-row: 1; }
  #productTable .product-row > div:last-child { grid-column: 6; grid-row: 1; }
}
/* The shared drawer shell is retained. Only its middle region scrolls. */
#productDrawer { display: flex; flex-direction: column; height: 100dvh; max-height: 100dvh; overflow: hidden; padding: 0; }
#productDrawer .lovegift-drawer-heading { flex: 0 0 auto; padding: 18px; border-bottom: 1px solid var(--border); }
#productDrawer .product-drawer-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 0 18px; }
#productDrawer .lovegift-drawer-actions { flex: 0 0 auto; margin: 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: #141520; align-items: center; flex-direction: row; flex-wrap: wrap; }
#productDrawer .lovegift-drawer-actions > button { flex: 1; width: auto; min-height: 44px; }
#productDrawer .lovegift-drawer-actions > span { flex-basis: 100%; font-size: 12px; overflow-wrap: anywhere; }
#productDrawer .lovegift-drawer-actions > span:empty { display: none; }
#productDrawer .product-field-group { padding: 20px 0; border-bottom: 1px solid var(--border); }
#productDrawer :is(h3, summary) { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
#productDrawer summary { cursor: pointer; padding: 8px 0; }
#productDrawer p { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
#productDrawer .form-row { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 16px; }
#productDrawer .form-input { width: 100%; max-width: 100%; min-width: 0; }
#productDrawer input[type="checkbox"] { width: auto; }
#productDrawer .product-unit { display: flex; align-items: center; gap: 6px; max-width: 100%; }
#productDrawer .product-unit span { white-space: nowrap; font-size: 12px; color: var(--text-muted); }
#productDrawer .product-size-price input { width: 110px; }
#productDrawer .product-size-limit input { width: 120px; }
#productDrawer .product-size-sort input { width: 80px; }
#productDrawer .product-option-toolbar { flex-wrap: wrap; margin-bottom: 16px; }
#productDrawerMetadata { overflow-wrap: anywhere; }
#productPromoDiscountEcho { color: #4ade80; margin-bottom: 12px; }
@media (max-width: 640px) { #productDrawer { width: 100vw; border-left: 0; } }
@media (max-width: 600px) {
  .product-options-dialog { padding: 12px; }
  .product-option-toolbar { flex-wrap: wrap; }
  .product-option-card { height: 320px; }
}
.alias-pool-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid rgba(148,163,184,.2); border-radius: 8px; color: #94a3b8; }
.alias-pool-summary small { flex-basis: 100%; }
.alias-pool-message { padding: 3px 8px; border-radius: 4px; }
/* Action orange: the platform must expand the vocabulary immediately. */
.alias-pool-message.is-action { color: #fb923c; background: rgba(251,146,60,.18); }
.alias-pool-message.is-critical,
.alias-pool-message.is-exhausted { color: #f87171; background: rgba(248,113,113,.14); }

/* Gateway audit columns: keep identity and actions readable within horizontal scrolling. */
#gatewayDeviceTable { overflow-x: auto; }
#gatewayDeviceTable .table { min-width: 1540px; }
#gatewayDeviceTable th:first-child, #gatewayDeviceTable td:first-child { min-width: 210px; }
#gatewayDeviceTable th:last-child, #gatewayDeviceTable td:last-child { min-width: 240px; }
#gatewayDeviceTable .gateway-audit-time { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Independent compact timestamp columns; existing table containers scroll horizontally. */
.list-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.product-time-columns { display: flex; gap: 24px; width: 100%; }
.product-time-columns .list-time { display: flex; flex-direction: column; gap: 4px; }

/* ===== 记忆礼盒 → 商品：收敛输入框宽度 + 平台设置卡紧凑化 =====
   ★ 作用域限定在 #lovegiftProductsPane / #platformVoiceSettings，避免影响后台其它页面 */
#lovegiftProductsPane .form-row { margin-bottom: 10px; }
#lovegiftProductsPane .form-row label { margin-bottom: 4px; }
#lovegiftProductsPane .form-input { max-width: 240px; }

#platformVoiceSettings p { color: var(--text-muted); font-size: 13px; line-height: 1.6; margin: 4px 0 12px; max-width: 560px; }
#platformVoiceSettings .platform-voice-label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
#platformVoiceSettings .platform-voice-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#platformVoiceSettings .platform-voice-row .form-input { max-width: 110px; text-align: right; }
#platformVoiceSettings .platform-voice-row .btn-primary { margin: 0; }
#platformVoiceSettings #platformVoiceMessage { font-size: 13px; color: var(--text-muted); }

/* CARDTODO: 订单卡片待办徽章 */
.lovegift-order-card { position: relative; text-align: left; cursor: pointer; }
.lovegift-order-card .lovegift-card-check { position: absolute; top: 8px; right: 8px; font-size: 12px; opacity: 0; transition: opacity .15s; }
.lovegift-order-card[aria-pressed="true"] { border: 2px solid var(--primary); background: var(--bg-card-hover, var(--bg-card)); }
.lovegift-order-card[aria-pressed="true"] .lovegift-card-check { opacity: 1; }
.lovegift-order-card[aria-pressed="false"] { border: 1px solid var(--border); }
.lovegift-todo { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 1.6; white-space: nowrap; }
.lovegift-todo[hidden] { display: none; }
.lovegift-todo-today { color: #60a5fa; background: rgba(96,165,250,.14); }
.lovegift-todo-pending_stock { color: #fb923c; background: rgba(251,146,60,.16); }
.lovegift-todo-pending_nfc { color: #c084fc; background: rgba(192,132,252,.16); }
.lovegift-todo-pending_ship { color: #f87171; background: rgba(248,113,113,.16); }
.lovegift-todo-shipped { color: #4ade80; background: rgba(74,222,128,.14); }

/* DASHBOARDUI */
.dashboard { min-width: 0; padding: 16px 24px; font-size: 14px; line-height: 1.6; }
.dashboard-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: 16px; }
#lovegiftDataPane .admin-scope-row { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; min-width: 0; }
#lovegiftDataPane .admin-scope-label { color: #cbd5e1; font-size: 14px; line-height: 20px; white-space: nowrap; }
#tabLovegift .dashboard-range,
#tabLovegift .form-select.admin-scope-select { color-scheme: dark; color: #f1f5f9; background-color: #273449; border: 1px solid #64748b; border-radius: 8px; height: 44px; padding: 0 12px; font-size: 14px; line-height: normal; width: auto; min-width: 140px; max-width: 100%; }
#tabLovegift .dashboard-range:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; }
.dashboard-block { min-width: 0; height: 960px; overflow: auto; padding: 24px; margin-bottom: 20px; scrollbar-gutter: stable; }
.dashboard-block h3 { font-size: 16px; line-height: 1.5; margin: 24px 0 12px; }
#lovegiftDataPane .section-title { font-size: 20px; line-height: 1.5; margin-bottom: 12px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.dashboard-card,
.dashboard-metric { display: flex; flex-direction: column; gap: 12px; height: 224px; min-width: 0; padding: 18px; overflow: auto; border: 1px solid #475569; border-radius: 12px; background: #1e293b; color: #cbd5e1; font-size: 14px; line-height: 1.5; }
.dashboard-metric strong { display: block; color: #f1f5f9; font-size: 28px; line-height: 1.3; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dashboard-note,
#lovegiftDataPane .lovegift-muted { color: #b6c2d2; font-size: 14px; line-height: 1.75; margin: 12px 0; overflow-wrap: anywhere; }
.dashboard-metric .dashboard-note { margin: 0; font-size: 14px; }
.dashboard-pipeline { display: flex; gap: 28px; list-style: none; overflow-x: auto; padding: 8px 0 16px; margin: 16px 0; counter-reset: dashboard-step; }
.dashboard-pipeline > li { flex: 1 0 168px; min-width: 0; position: relative; counter-increment: dashboard-step; }
.dashboard-pipeline > li::before { content: counter(dashboard-step, decimal-leading-zero); display: block; color: #a5b4fc; font-weight: 600; margin-bottom: 8px; }
.dashboard-pipeline > li:not(:last-child)::after { content: '→'; position: absolute; right: -23px; top: 130px; color: #a5b4fc; font-size: 20px; }
.dashboard-stack { display: flex; width: 100%; height: 16px; overflow: hidden; border-radius: 8px; margin: 16px 0 10px; background: #334155; }
.dashboard-segment { display: block; height: 100%; flex: none; }
.dashboard-color-0 { background: #818cf8; }
.dashboard-color-1 { background: #34d399; }
.dashboard-color-2 { background: #fbbf24; }
.dashboard-legend { display: flex; flex-wrap: wrap; gap: 10px 20px; color: #cbd5e1; font-size: 14px; }
.dashboard-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.dashboard-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.dashboard-pills { display: flex; flex-wrap: wrap; gap: 10px; max-height: 240px; overflow: auto; }
.dashboard-pill { display: inline-flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border: 1px solid #475569; border-radius: 12px; font-size: 14px; }
.dashboard-details { margin-top: 20px; }
.dashboard-details summary { cursor: pointer; min-height: 44px; padding: 10px 0; }
.dashboard-user-list { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow: auto; }
#lovegiftDataPane .btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; min-height: 44px; padding: 10px 14px; color: #f1f5f9; background: #273449; border: 1px solid #64748b; }
.btn-icon svg { display: block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
#dashboardRefresh.is-refreshing svg { animation: dashboard-spin 1s linear infinite; }
@keyframes dashboard-spin { to { transform: rotate(360deg); } }
@media (max-width: 799px) {
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-block { padding: 16px; height: 1120px; }
}
@media (max-width: 480px) {
  .dashboard { padding: 12px; }
  .dashboard-toolbar { gap: 10px; }
  #lovegiftDataPane .admin-scope-row { width: 100%; justify-content: flex-end; }
  #tabLovegift .form-select.dashboard-range { width: 180px; min-width: 0; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dashboard-metric { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  #dashboardRefresh.is-refreshing svg { animation: none; }
}

/* Keep hidden authoritative after all component display rules. */
[hidden] { display: none !important; }

.lovegift-time-sort { display: block; margin-top: 6px; font-size: 11px; }

#lovegiftStatsBar .lovegift-todo { max-width: 100%; white-space: normal; line-height: 1.3; }
@media (max-width: 600px) {
  #lovegiftOpsPane .lovegift-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
  #lovegiftOpsPane .lovegift-toolbar .lovegift-search,
  #lovegiftOpsPane .lovegift-toolbar .admin-secondary-caption,
  #lovegiftOpsPane #lovegiftSort { grid-column: 1 / -1; }
  #lovegiftOpsPane .lovegift-toolbar .form-select { width: 100%; max-width: none; min-width: 0; }
  #lovegiftOpsPane .lovegift-search, #lovegiftSearch { min-width: 0; width: 100%; }
  .lovegift-card-filter-bar { align-items: flex-start; font-size: 12px; }
  .lovegift-card-filter-bar > button { flex-shrink: 0; }
}

/* TESTACCT */
.testacct-card { margin-bottom: 16px; min-width: 0; }
.testacct-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.testacct-heading .section-title { margin: 0; }
.testacct-heading button, .testacct-item button { flex-shrink: 0; min-height: 40px; }
.testacct-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 12px 0; }
.testacct-form[hidden] { display: none; }
.testacct-form label { grid-column: 1 / -1; }
.testacct-form input { min-width: 0; width: 100%; box-sizing: border-box; }
.testacct-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 8px; }
.testacct-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px; min-height: 94px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; }
.testacct-item > div { min-width: 0; overflow-wrap: anywhere; line-height: 1.7; }
.testacct-identity { color: var(--text-secondary); font-size: 12px; }
@media (max-width: 480px) { .testacct-card { padding: 14px; } .testacct-form { grid-template-columns: minmax(0, 1fr); } .testacct-form button { justify-self: end; } }
#lovegiftStatsBar .lovegift-order-card.card { height: auto; }
#lovegiftStatsBar.lovegift-order-cards { grid-auto-rows: 1fr; }
.testacct-todo-notice { margin: -4px 0 16px; font-size: 12px; line-height: 1.5; white-space: nowrap; color: var(--text-secondary); }
.testacct-todo-link { padding: 0; border: 0; background: none; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
@media (max-width: 480px) { .testacct-todo-notice { font-size: 11px; letter-spacing: -.2px; } }
/* TESTACCT */

/* PLATFORMSETTINGS */
.platform-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  padding: 20px 24px;
}
.platform-settings-grid > .section {
  min-width: 0;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.platform-settings-grid > .section h3 { font-size: 16px; margin: 0 0 8px; }
.platform-settings-grid > .section p { color: var(--text-muted); font-size: 13px; line-height: 1.6; margin: 4px 0 12px; }
.platform-settings-grid > .section label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.platform-settings-grid .platform-voice-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.platform-settings-grid .platform-voice-row .form-input { min-width: 0; }
.platform-settings-grid .platform-voice-row .btn-primary { margin: 0; }
@media (max-width: 760px) {
  .platform-settings-grid { grid-template-columns: 1fr; padding: 16px; }
}
/* /PLATFORMSETTINGS */
