/* 艾梦智能客服 — 科技蓝工作台 */
:root {
  --ink: #0f172a;
  --ink-soft: #1e293b;
  --steel: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-deep: #1e3a8a;
  --primary-light: #eff6ff;
  --primary-gradient: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.18);
  --accent: #1e3a8a;
  --accent-soft: #dbeafe;
  --success: #059669;     --success-light: #ecfdf5;
  --warning: #d97706;     --warning-light: #fffbeb;   --warning-text: #92400e;
  --danger: #dc2626;      --danger-light: #fef2f2;    --danger-text: #991b1b;
  --info: #0284c7;        --info-light: #e0f2fe;
  --bg-page: #f8fafc;
  --bg-white: #ffffff;
  --bg-message-area: #f1f5f9;
  --sidebar-bg: #ffffff;
  --sidebar-hover: #f8fafc;
  --sidebar-active: #eff6ff;
  --sidebar-text: #0f172a;
  --sidebar-muted: #64748b;
  --sidebar-border: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --hairline: #cbd5e1;
  --input-bg: #ffffff;
  --input-focus-bg: #ffffff;
  --control-hover: #f1f5f9;
  --header-mark-ring: #bfdbfe;
  --scroll-thumb: #cbd5e1;
  --scroll-thumb-hover: #94a3b8;
  --table-head: #f8fafc;
  --row-hover: #f8fafc;
  --badge-ignored-bg: #f1f5f9;
  --badge-ignored-fg: #64748b;
  --outline-border: #bfdbfe;
  --bubble-in-avatar: #94a3b8;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 32px rgba(15, 23, 42, 0.10);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.14);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-full: 9999px;
  --transition-fast: 0.12s ease;
  --transition: 0.18s ease;
  --transition-slow: 0.28s ease;
  --header-h: 52px;
  --sidebar-w: 320px;
  --inspector-w: 300px;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", sans-serif;
  --font-ui: "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e2e8f0;
  --ink-soft: #cbd5e1;
  --steel: #94a3b8;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-deep: #bfdbfe;
  --primary-light: #1e3a5f;
  --primary-gradient: #2563eb;
  --primary-glow: rgba(96, 165, 250, 0.22);
  --accent: #93c5fd;
  --accent-soft: #1e3a5f;
  --success: #34d399;     --success-light: #064e3b;
  --warning: #fbbf24;     --warning-light: #422006;   --warning-text: #fde68a;
  --danger: #f87171;      --danger-light: #450a0a;    --danger-text: #fecaca;
  --info: #38bdf8;        --info-light: #0c4a6e;
  --bg-page: #0f172a;
  --bg-white: #1e293b;
  --bg-message-area: #0b1220;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #1e3a5f;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --sidebar-border: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --border-light: #1e293b;
  --hairline: #475569;
  --input-bg: #0f172a;
  --input-focus-bg: #1e293b;
  --control-hover: #334155;
  --header-mark-ring: #1e3a8a;
  --scroll-thumb: #475569;
  --scroll-thumb-hover: #64748b;
  --table-head: #1e293b;
  --row-hover: #334155;
  --badge-ignored-bg: #334155;
  --badge-ignored-fg: #94a3b8;
  --outline-border: #1e3a8a;
  --bubble-in-avatar: #64748b;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 22px 48px rgba(0, 0, 0, 0.42);
  --shadow-xl: 0 32px 64px rgba(0, 0, 0, 0.5);
}

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-ui);
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 550; cursor: pointer; font-family: inherit;
  transition: background var(--transition), box-shadow var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap; letter-spacing: 0;
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.42; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: none;
}
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--control-hover); color: var(--text-primary); border-color: var(--border); }

.btn-outline {
  background: transparent; color: var(--primary-deep);
  border: 1px solid var(--outline-border);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #237554; }

.btn-muted { background: var(--control-hover); color: var(--text-secondary); }
.btn-muted:hover { background: var(--border); }

.btn-danger {
  background: transparent; color: var(--danger);
  border: 1px solid #fecaca;
}
.btn-danger:hover { background: var(--danger-light); }

.btn-danger-sm {
  background: transparent; color: var(--danger);
  border: 1px solid #e4c8c2; font-size: 11.5px; padding: 4px 10px;
}
.btn-danger-sm:hover { background: var(--danger-light); }

.btn-ai {
  background: var(--primary-light); color: var(--primary-deep);
  border: 1px solid var(--outline-border);
}
.btn-ai:hover { background: #dbeafe; }

.btn-warning {
  background: var(--warning-light); color: var(--warning-text);
  border: 1px solid #fde68a;
}
.btn-warning:hover { background: #fef3c7; }

.btn-xs { font-size: 12px; min-height: 32px; padding: 4px 10px; border-radius: var(--radius-xs); }
.btn-sm { font-size: 12px; padding: 6px 12px; }

/* ═══════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════ */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="search"],
select,
textarea {
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  outline: none; background: var(--input-bg); transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
input[type="text"],
input[type="password"],
input[type="date"],
input[type="search"],
select:not([multiple]):not([size]) {
  min-height: 36px;
}
select:not([multiple]):not([size]) {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1.41 1.09L6 5.67l4.59-4.58L12 2.5 6 8.5 0 2.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
  padding-right: 28px;
  cursor: pointer;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); background: var(--input-focus-bg);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* 自定义下拉：替代系统原生 option 列表，避免 Windows 蓝条「贴上去」 */
.aimeng-select {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  align-items: stretch;
  max-width: 100%;
  box-sizing: border-box;
}
.aimeng-select > select {
  position: absolute !important;
  left: 0; top: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  appearance: none;
}
.aimeng-select-btn {
  position: relative;
  display: flex; align-items: center;
  width: 100%; min-width: 0; min-height: 36px;
  padding: 0 28px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.aimeng-select-btn:hover { border-color: var(--primary); }
.aimeng-select.open .aimeng-select-btn,
.aimeng-select-btn:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--input-focus-bg);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.aimeng-select-btn:disabled,
.aimeng-select.is-disabled .aimeng-select-btn {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}
.aimeng-select-label {
  min-width: 0; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aimeng-select-btn::after {
  content: '';
  position: absolute;
  right: 11px; top: 50%;
  width: 6px; height: 6px;
  margin-top: -5px;
  border-right: 1.6px solid var(--text-muted);
  border-bottom: 1.6px solid var(--text-muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.aimeng-select.open .aimeng-select-btn::after {
  margin-top: -1px;
  transform: rotate(225deg);
}
.aimeng-select-panel {
  display: none;
  position: fixed;
  z-index: 60000;
  min-width: 128px;
  max-width: min(360px, calc(100vw - 16px));
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  box-sizing: border-box;
}
.aimeng-select-panel.open { display: block; }
.aimeng-select-option,
.aimeng-select-group {
  display: block; width: 100%;
  text-align: left; border: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit; font-size: 13px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  box-sizing: border-box;
}
.aimeng-select-group {
  cursor: default;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  padding: 8px 10px 4px;
}
.aimeng-select-option:hover,
.aimeng-select-option:focus,
.aimeng-select-option.focus { background: var(--control-hover); outline: none; }
.aimeng-select-option.active {
  background: var(--primary-light);
  color: var(--primary-deep);
  font-weight: 650;
}
.aimeng-select-option:disabled,
.aimeng-select-option.is-disabled {
  opacity: 0.45; cursor: default; pointer-events: none;
}
html[data-theme="dark"] .aimeng-select-option.active {
  background: var(--sidebar-active);
  color: var(--primary-deep);
}
.pwd-field { position: relative; display: flex; align-items: center; }
.pwd-field input { width: 100%; padding-right: 52px; box-sizing: border-box; }
.pwd-toggle {
  position: absolute; right: 4px; height: 26px; padding: 0 8px;
  border: none; background: transparent; color: var(--primary);
  font-size: 12px; cursor: pointer; font-family: inherit; font-weight: 600;
}
.pwd-toggle:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════
   SHARED HEADER / NAV
   ═══════════════════════════════════════════ */
.header {
  height: var(--header-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  position: relative;
  z-index: 100;
}
.header-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header-icon {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700; line-height: 1;
  box-shadow: inset 0 0 0 1px var(--header-mark-ring);
}
.header h1 {
  font-size: 18px; font-weight: 650; color: var(--text-primary);
  letter-spacing: 0; white-space: nowrap;
  font-family: var(--font-ui);
}
.header-tools {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.header-more-btn,
.header-tool-label,
.header-more-links { display: none; }
.header-tail {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sku-notice { position: relative; flex: 0 0 auto; }
.sku-notice-btn {
  height: 36px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-white); color: var(--text-primary);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px;
}
.sku-notice-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #b42318; color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.sku-notice-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
  width: min(360px, 80vw); max-height: 360px; overflow: auto;
  background: var(--bg-white); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); padding: 8px;
}
.sku-notice-title { font-size: 13px; font-weight: 650; margin: 4px 6px 8px; }
.sku-notice-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1.45;
}
.sku-notice-item:hover { background: var(--primary-light); }
.sku-notice-item.is-read { color: var(--text-muted); }
.sku-notice-empty { margin: 8px; font-size: 13px; color: var(--text-muted); }
@media (max-width: 768px) {
  .sku-notice-pop {
    position: fixed;
    top: calc(var(--header-h) + 8px);
    right: 12px;
    left: 12px;
    width: auto;
  }
}
.header .store-select {
  height: 36px; width: 160px; max-width: 160px; flex: 0 0 160px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; padding: 0 8px;
  background: var(--bg-white); color: var(--text-primary);
}
.header-nav { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.nav-link {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-white); color: var(--sidebar-text);
  font-size: 13px; font-weight: 500; letter-spacing: 0;
  text-decoration: none; white-space: nowrap;
}
.nav-link:hover { border-color: var(--primary); color: var(--primary-deep); }
.nav-link.active {
  color: var(--primary-deep);
  font-weight: 500;
  border-color: var(--primary);
  background: var(--primary-light);
}

.header .btn-ghost {
  background: var(--bg-white); color: var(--text-secondary);
  border-color: var(--border);
}
.header .btn-ghost:hover {
  background: var(--bg-page); color: var(--text-primary); border-color: var(--border);
}
.header .btn-outline {
  background: transparent; color: var(--primary-deep);
  border-color: var(--outline-border);
}
.header .btn-outline:hover { background: var(--primary-light); }
.header .btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: none; font-weight: 650;
}
.header .btn-primary:hover { background: var(--primary-hover); color: #fff; }

.header-user {
  color: var(--text-muted);
  font-size: 11.5px; letter-spacing: 0.06em; white-space: nowrap;
}

.account-menu { position: relative; flex-shrink: 0; }
.account-menu-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-white); color: var(--text-secondary);
  font-size: 12px; font-weight: 550; letter-spacing: 0;
  cursor: pointer; font-family: inherit;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.account-menu-btn:hover,
.account-menu.open .account-menu-btn {
  color: var(--text-primary); background: var(--bg-page);
}
.account-menu.open .account-menu-btn { border-color: var(--outline-border); }
.account-menu-caret {
  width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55; transition: transform var(--transition-fast);
}
.account-menu.open .account-menu-caret { transform: rotate(-180deg); }
.account-menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 80;
  width: 220px; padding: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.account-menu-name {
  padding: 6px 10px 8px;
  font-size: 12px; font-weight: 650; color: var(--text-primary);
  letter-spacing: 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 6px;
}
.account-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 8px 10px; border-radius: var(--radius-xs);
  font-size: 13px; color: var(--text-primary); font-family: inherit;
  transition: background var(--transition-fast);
}
.account-menu-item:hover { background: var(--bg-page); }
.account-menu-theme {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px 8px;
}
.account-menu-theme > span {
  font-size: 13px; color: var(--text-primary);
}
.account-menu-sep { height: 1px; background: var(--border-light); margin: 4px 6px 6px; }

.header .stat-chip {
  background: var(--bg-page);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.header .stat-all { background: var(--bg-page); color: var(--text-secondary); }
.header .stat-new { background: var(--danger-light); color: var(--danger-text); }
.header .stat-draft { background: var(--warning-light); color: var(--warning-text); }
.header .stat-sent { background: var(--primary-light); color: var(--primary-deep); }
.header .stat-done { background: var(--success-light); color: #047857; }
html[data-theme="dark"] .header .stat-done { color: var(--success); }

/* ═══════════════════════════════════════════
   STATE BADGES
   ═══════════════════════════════════════════ */
.state-badge {
  display: inline-block; padding: 2px 8px; border-radius: 2px;
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.06em;
}
.sb-new       { background: var(--danger-light);  color: var(--danger-text); }
.sb-draft     { background: var(--warning-light); color: var(--warning-text); }
.sb-review    { background: var(--warning-light); color: var(--warning-text); }
.sb-sent      { background: var(--success-light); color: #047857; }
.sb-resolved  { background: var(--info-light);    color: #21506e; }
.sb-ignored   { background: var(--badge-ignored-bg); color: var(--badge-ignored-fg); }

/* ═══════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════ */
.toast-box, .toast-stack {
  position: fixed; top: calc(var(--header-h) + 8px); right: 16px; z-index: 99999;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.toast-msg, .toast-item {
  padding: 10px 16px; border-radius: var(--radius-sm); color: #fff;
  font-size: 13px; font-weight: 500; line-height: 1.4;
  box-shadow: var(--shadow-lg); max-width: 400px; pointer-events: none;
  animation: toastIn 0.25s ease-out;
}
.btn[hidden], button[hidden] { display: none !important; }
.toast-ok  { background: #0f172a; }
.toast-err { background: #991b1b; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastVanish {
  to { opacity: 0; transform: translateX(16px); }
}

.spin-ring {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--primary-glow); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
.header .spin-ring {
  border-color: var(--primary-glow); border-top-color: var(--primary);
}
.btn-primary .spin-ring {
  border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff;
}
.ring-spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(12, 14, 18, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-white); border-radius: 4px;
  padding: 36px 32px 28px;
  max-width: 420px; width: 90%;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: modalIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  text-align: center;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-icon {
  width: 48px; height: 48px; border-radius: 2px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.modal-icon.warn  { background: var(--warning-light); }
.modal-icon.danger { background: var(--danger-light); }

.modal-title {
  font-size: 18px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 8px;
  font-family: var(--font-ui); letter-spacing: 0;
}
.modal-body {
  font-size: 14px; line-height: 1.7;
  color: var(--text-secondary); white-space: pre-line;
  max-width: 320px; margin: 0 auto;
}
.modal-actions {
  margin-top: 24px; display: flex; justify-content: center; gap: 12px;
}
.modal-actions button {
  padding: 9px 24px; font-size: 13px; font-weight: 550;
  border-radius: var(--radius-sm); cursor: pointer; font-family: inherit;
  transition: all 0.18s ease; border: none; letter-spacing: 0.06em;
}
.modal-actions button:active { transform: scale(0.98); }

.modal-btn-cancel { background: var(--control-hover); color: var(--text-primary); }
.modal-btn-cancel:hover { background: var(--border); }

.modal-btn-primary {
  background: var(--primary); color: #fff;
}
.modal-btn-primary:hover { background: var(--primary-hover); }

.modal-btn-danger {
  background: var(--danger); color: #fff;
}
.modal-btn-danger:hover { background: #9a4c40; }

.theme-switch {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-white);
}
.theme-switch button {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 11px; letter-spacing: 0.08em; padding: 5px 10px; cursor: pointer;
  font-family: inherit; font-weight: 550;
}
.theme-switch button + button { border-left: 1px solid var(--border); }
.theme-switch button:hover { color: var(--text-primary); background: var(--bg-page); }
.theme-switch button.active { color: var(--primary-deep); background: var(--primary-light); }

.order-row-click,
.listing-card-click {
  cursor: pointer;
  border-radius: var(--radius-sm);
  position: relative;
}
.order-row-click { padding: 2px 0; margin: 0; }
.order-row-click:hover,
.listing-card-click:hover { background: var(--primary-light); }
.order-row-hint {
  float: right; font-size: 11px; color: var(--primary); font-weight: 550;
  margin-left: 8px;
}
.order-title-clip {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; max-width: 100%;
}
.order-title-clip a {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.order-dest {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; color: var(--text-muted);
}
.od-track-inline { font-size: 12px; }
.od-track-inline .od-track-link { margin-top: 0; margin-left: 4px; }
.listing-card {
  display: flex; gap: 8px; align-items: center;
  margin-top: 4px; padding: 4px 6px; border: 1px solid var(--border);
  background: var(--bg-white);
}
.listing-card-compact .listing-thumb { width: 36px; height: 36px; }
.listing-thumb {
  width: 44px; height: 44px; object-fit: cover; border-radius: 4px;
  background: var(--bg-page); flex-shrink: 0;
}
.order-item-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.order-item-row + .order-item-row { margin-top: 6px; }
.order-item-thumb {
  width: 40px; height: 40px; object-fit: cover; border-radius: 4px;
  background: var(--bg-page); flex: 0 0 auto; cursor: zoom-in;
  border: 1px solid var(--border);
}
.od-item-line { display: flex; gap: 10px; align-items: flex-start; }
.od-item-line .order-item-thumb { width: 56px; height: 56px; }
.od-item-body { min-width: 0; flex: 1; }
.listing-card-body { min-width: 0; flex: 1; }
.listing-card-kicker {
  font-size: 11px; color: var(--text-muted); margin-bottom: 2px;
}
.listing-card-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  line-height: 1.35;
}
.listing-card-compact .listing-card-title {
  font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.listing-card-meta, .listing-card-hint {
  font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4;
}
.order-detail-float {
  position: fixed; z-index: 200; display: none;
  top: 60px; right: 16px; left: auto;
  width: min(760px, calc(100vw - 24px));
}
.order-detail-float.show { display: block; }
.order-detail-box {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-height: min(86vh, calc(100vh - 72px));
  overflow: auto;
  text-align: left;
  box-shadow: var(--shadow-xl);
}
.order-detail-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 64px 8px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-white); z-index: 1;
  cursor: grab; user-select: none;
}
.order-detail-float.dragging .order-detail-head { cursor: grabbing; }
.order-detail-title {
  font-size: 13px; font-weight: 650; color: var(--text-primary);
  font-family: var(--font-ui); letter-spacing: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.order-detail-invoice {
  flex-shrink: 0; border: 1px solid var(--primary); background: var(--bg-white);
  color: var(--primary); border-radius: var(--radius-sm); padding: 2px 8px; cursor: pointer;
  font-family: inherit; font-size: 12px; line-height: 1.4;
}
.order-detail-invoice:hover { background: var(--primary-light); }
.order-detail-invoice[hidden] { display: none; }
.vat-pick-mask {
  position: fixed; inset: 0; z-index: 400; background: rgba(15, 23, 42, 0.35);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.vat-pick {
  width: min(360px, 100%); background: var(--bg-white); border-radius: var(--radius);
  padding: 16px 16px 12px; box-shadow: var(--shadow-xl);
}
.vat-pick-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.vat-pick p { margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }
.vat-pick-actions { display: flex; flex-direction: column; gap: 8px; }
.vat-pick-actions button, .vat-pick-cancel {
  font: inherit; cursor: pointer; border-radius: var(--radius-sm); padding: 8px 10px;
}
.vat-pick-actions button {
  border: 1px solid var(--primary); background: var(--bg-white); color: var(--primary); font-weight: 650;
}
.vat-pick-actions button:hover { background: var(--primary-light); }
.vat-pick-cancel {
  margin-top: 8px; width: 100%; border: 0; background: transparent; color: var(--text-secondary);
}
.order-detail-close {
  position: absolute; top: 7px; right: 8px; z-index: 5;
  border: 1px solid var(--border); background: var(--bg-white); color: var(--text-primary);
  border-radius: var(--radius-sm); padding: 2px 8px; cursor: pointer;
  font-family: inherit; font-size: 12px; line-height: 1.4;
  box-shadow: var(--shadow-xs);
}
.order-detail-close:hover { background: var(--control-hover); color: var(--text-primary); }
.order-detail-body { padding: 2px 0 10px; font-size: 13px; background: var(--bg-white); }
.od-sheet { display: flex; flex-direction: column; gap: 2px; }
.od-sec { margin: 8px 14px 0; }
.od-sec-h {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--primary-deep);
  letter-spacing: 0.04em; padding: 0; border: none; margin: 0 0 6px;
}
.od-sec-h::before {
  content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--primary); flex-shrink: 0;
}
.od-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px;
}
.od-fact {
  display: grid; grid-template-columns: 68px 1fr; gap: 8px;
  min-width: 0; font-size: 13px; line-height: 1.5; align-items: start;
}
.od-fact-wide { grid-column: 1 / -1; }
.od-fact > span { color: var(--text-muted); }
.od-fact > div { color: var(--text-primary); min-width: 0; word-break: break-word; }
.od-addr {
  margin: 0; padding: 7px 10px;
  background: var(--primary-light); border: none;
  border-radius: var(--radius-sm); line-height: 1.4;
}
.od-addr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.od-addr-k { font-size: 12px; color: var(--text-muted); }
.od-addr-name { font-size: 14px; font-weight: 650; color: var(--text-primary); min-width: 0; }
.od-addr-lines { white-space: pre-line; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.od-addr-open {
  margin-top: 10px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-white); color: var(--primary);
  font: inherit; font-size: 13px; cursor: pointer;
}
.od-addr-open:hover { border-color: var(--primary); background: var(--primary-light); }
.od-note-box { margin-top: 10px; }
.od-note-text {
  display: block; width: 100%; box-sizing: border-box; min-height: 72px;
  margin: 0 0 8px; padding: 8px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-size: 13px; line-height: 1.45; resize: vertical;
  background: var(--bg-white); color: inherit;
}
.od-note-box .od-copy { margin-left: 0; height: 28px; padding: 0 10px; font-size: 12px; }
.od-refund { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.od-refund label { font-size: 12px; color: var(--text-secondary); }
.od-refund input {
  display: block; width: 100%; max-width: 220px; height: 32px; margin-top: 4px;
  box-sizing: border-box;
}
.od-refund-list { font-size: 12px; line-height: 1.5; }
.od-addr-pop { width: min(440px, 100%); }
.od-addr-pop-body {
  white-space: pre-line; font-size: 14px; line-height: 1.6;
  color: var(--text-primary); margin: 0 0 12px;
}
.od-addr-pop-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.od-addr-pop-actions .vat-pick-cancel { width: auto; margin: 0; }
.od-flow {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0;
}
.od-flow-step { position: relative; min-width: 0; padding: 14px 8px 0 0; }
.od-flow-step i {
  position: absolute; left: 0; top: 0; z-index: 1;
  width: 8px; height: 8px; border-radius: 50%;
  background: #cbd5e1; box-shadow: 0 0 0 3px var(--bg-white);
}
.od-flow-step::before {
  content: ""; position: absolute; top: 3px; left: 8px; right: 0; height: 2px;
  background: #e2e8f0;
}
.od-flow-step:last-child::before { display: none; }
.od-flow-step.on i { background: var(--primary); }
.od-flow-step.on:has(+ .od-flow-step.on)::before { background: var(--primary); }
.od-flow-step b { display: block; font-size: 13px; font-weight: 650; color: var(--text-primary); line-height: 1.3; }
.od-flow-step span { display: block; margin-top: 1px; font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.od-flow-step em {
  display: inline-block; margin-top: 3px; padding: 0 6px;
  border-radius: 999px; background: #ecfdf5; color: #047857;
  font-size: 11px; font-style: normal; font-weight: 600; line-height: 1.6;
}
.od-block { margin: 8px 14px 0; }
.od-row {
  display: grid; grid-template-columns: 84px 1fr; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--border-light);
  font-size: 13px; line-height: 1.4; align-items: start;
}
.od-row:last-child { border-bottom: none; }
.od-row > span { color: var(--text-muted); }
.od-row > div { color: var(--text-primary); min-width: 0; word-break: break-word; }
.od-item { display: flex; gap: 10px; align-items: flex-start; padding: 2px 0 0; }
.od-item + .od-item { margin-top: 8px; border-top: none; }
.od-item .order-item-thumb { width: 52px; height: 52px; border-radius: 6px; }
.od-item-title { font-size: 14px; font-weight: 650; line-height: 1.35; margin-bottom: 4px; color: var(--text-primary); }
.od-item-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.od-meta-i {
  display: flex; gap: 6px; min-width: 0;
  font-size: 12px; line-height: 1.4; align-items: baseline;
}
.od-meta-i > span { color: var(--text-muted); flex-shrink: 0; }
.od-meta-i > div { color: var(--text-primary); min-width: 0; word-break: break-word; }
.od-ship {
  margin-top: 8px; padding: 8px 10px;
  background: var(--primary-light); border-radius: var(--radius-sm);
}
.od-ship + .od-ship { margin-top: 6px; }
.od-ship-row {
  display: grid; grid-template-columns: 52px 1fr; gap: 4px 8px;
  align-items: center; padding: 2px 0;
}
.od-ship-row > span { font-size: 12px; color: var(--primary-deep); }
.od-carrier-name { font-size: 15px; font-weight: 700; color: var(--primary-deep); line-height: 1.3; }
.od-track-num { font-size: 15px; font-weight: 700; letter-spacing: 0.01em; color: var(--text-primary); }
.od-block .od-sec-h { margin-bottom: 4px; }
.od-block .od-h { margin: 12px 0 4px; }
.od-h {
  font-size: 11px; font-weight: 650; color: var(--text-muted);
  margin: 8px 0 4px; letter-spacing: 0.04em;
}
.od-section { display: grid; gap: 3px; }
.od-timeline { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.od-tl {
  flex: 1; min-width: 90px; padding: 6px 8px; border-radius: 6px;
  border: 1px dashed var(--border); color: var(--text-muted); font-size: 11px;
}
.od-tl b { display: block; font-size: 12px; margin-bottom: 2px; }
.od-tl.on { border-style: solid; border-color: #86efac; background: #f0fdf4; color: #166534; }
.od-meta {
  grid-template-columns: 1fr 1fr;
  gap: 3px 10px;
}
.od-kv {
  display: grid; grid-template-columns: 72px 1fr; gap: 6px;
  font-size: 12px; line-height: 1.35; align-items: start;
}
.od-kv.od-span { grid-column: 1 / -1; }
.od-kv > span { color: var(--text-muted); }
.od-kv > div { color: var(--text-primary); min-width: 0; word-break: break-word; }
.od-line { padding: 4px 0; border-bottom: 1px solid var(--border-light); }
.od-line:last-child { border-bottom: none; }
.od-line-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.od-address { white-space: pre-line; font-size: 12px; line-height: 1.45; color: var(--text-primary); }
.od-track { font-size: 13px; line-height: 1.5; }
.od-carrier { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.order-row > .od-track { margin-top: 4px; }
.od-track-link {
  display: inline-block; margin: 0;
  padding: 0 7px; border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: var(--radius-sm); background: var(--bg-white);
  font-size: 11px; font-weight: 600; color: var(--primary);
  text-decoration: none; line-height: 1.7; flex-shrink: 0;
}
.od-track-link:hover { color: var(--primary-hover); border-color: var(--primary); text-decoration: none; }
.ob-mini { display: grid; gap: 7px; }
.ob-line {
  display: grid; grid-template-columns: 72px 1fr; gap: 8px;
  font-size: 12px; line-height: 1.5; align-items: start;
}
.ob-line > span { color: var(--text-muted); }
.ob-line > div { color: var(--text-primary); min-width: 0; }
.ob-fb { font-weight: 700; }
.ob-fb-pos { color: #0f7a3a; }
.ob-fb-mid { color: #a15c07; }
.ob-fb-neg { color: #c2410c; }
.ob-fb-none { color: var(--text-muted); font-weight: 600; }
.ob-track { display: inline; }
.ob-muted { color: var(--text-muted); }
.ob-actions { margin-top: 2px; }
.od-copy {
  border: 1px solid var(--border); background: var(--bg-white); color: var(--primary);
  border-radius: 3px; padding: 0 6px; font-size: 11px; cursor: pointer;
  font-family: inherit; margin-left: 4px;
}
.od-as-line {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.od-as-line > span { min-width: 0; word-break: break-word; }
.od-as-open {
  flex-shrink: 0; height: 28px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-white); color: var(--primary);
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.od-as-open:hover { border-color: var(--primary); background: var(--primary-light); }
.od-as-quote {
  margin: 6px 0 2px; padding: 10px 12px;
  background: var(--bg-page); border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.6; color: var(--text-primary); white-space: pre-wrap;
}
.od-as-event {
  padding: 8px 0; border-bottom: 1px solid var(--border-light);
  font-size: 14px; line-height: 1.5; color: var(--text-primary); word-break: break-word;
}
.od-as-event:last-child { border-bottom: none; }
.od-as-foot {
  margin: 12px 14px 0; font-size: 12px; color: var(--text-muted); line-height: 1.45;
}
.od-note { font-size: 11px; color: var(--text-muted); line-height: 1.4; margin: 0 0 6px; }
.od-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.od-photo {
  width: 64px; height: 64px; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-page);
}
.fitment-banner {
  margin-top: 4px; padding: 4px 8px; border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.35; border: 1px solid var(--border);
}
.fitment-banner.fit-yes { background: var(--success-light); color: #047857; border-color: #a7f3d0; }
.fitment-banner.fit-no { background: var(--danger-light); color: var(--danger-text); }
.fitment-banner.fit-wait { background: var(--warning-light); color: var(--warning-text); }
.od-fit-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.od-fit-form input {
  width: 110px; height: 30px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 8px; font-size: 12px;
  font-family: inherit; background: var(--input-bg); color: var(--text-primary);
}

html[data-theme="dark"] .od-flow-step i { background: #475569; box-shadow: 0 0 0 3px var(--bg-white); }
html[data-theme="dark"] .od-flow-step::before { background: #334155; }
html[data-theme="dark"] .od-flow-step.on:has(+ .od-flow-step.on)::before { background: var(--primary); }
html[data-theme="dark"] .od-flow-step.on em { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
@media (max-width: 720px) {
  .order-detail-float { top: 8px; right: 8px; width: calc(100vw - 16px); }
  .od-facts, .od-item-meta { grid-template-columns: 1fr; }
  .od-flow-step b { font-size: 12px; }
  .od-sec { margin-left: 12px; margin-right: 12px; }
}

.copy-dbl { cursor: copy; border-radius: 2px; }
.copy-dbl:hover { background: var(--primary-light); }
html[data-theme="dark"] .copy-dbl:hover { background: var(--sidebar-hover); }

@media (max-width: 768px) {
  .header { padding: 0 12px; gap: 8px; }
  .header .header-nav { display: none; }
  .header .stats-row { display: none; }
  .header-more-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 14px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-white); color: var(--text-primary);
    font-size: 14px; font-weight: 650; font-family: inherit; cursor: pointer;
  }
  .header-tools {
    display: none;
    position: absolute; right: 12px; top: calc(100% + 8px); z-index: 120;
    width: min(320px, calc(100vw - 24px));
    flex-direction: column; align-items: stretch; gap: 8px;
    padding: 12px;
    background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
  }
  .header-tools.is-open { display: flex; }
  .header-tool-label {
    display: block; font-size: 13px; font-weight: 650; color: var(--text-secondary);
  }
  .header-tools .header-more-links { display: flex; flex-direction: column; gap: 8px; }
  .header-tools .nav-link,
  .header-tools .account-menu-btn,
  .header-tools .presence-switch button,
  .header-more-btn,
  .btn,
  input[type="text"],
  input[type="password"],
  input[type="date"],
  input[type="search"],
  select:not([multiple]):not([size]),
  .aimeng-select-btn {
    min-height: 44px;
  }
  .header-tools .nav-link { width: 100%; }
  .header-tools .presence-switch { width: 100%; }
  .header-tools .presence-switch button { flex: 1; font-size: 14px; }
  .header .header-tools .store-select {
    width: 100%; max-width: none; flex: 1 1 auto; height: 44px;
  }
  .header-tools .account-menu { width: 100%; }
  .header-tools .account-menu-btn { width: 100%; justify-content: space-between; }
  .header-tools .account-menu-pop {
    position: static; width: 100%; margin-top: 6px; box-shadow: none;
  }
  .header-tools .account-menu-item { min-height: 44px; }
}

.staff-send-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 12.5px; color: var(--steel); }
.staff-send-bar select { height: 28px; }
.staff-translate-preview {
  margin: 6px 0 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-page); color: var(--text-primary); font-size: 13px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.staff-translate-preview .k { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 2px; }
.staff-translate-preview.wait, .staff-translate-preview.bad { color: var(--text-muted); }

.field-guide {
  cursor: help;
  border-bottom: 1px dotted rgba(100, 116, 139, .85);
}
.field-guide-tip {
  position: fixed;
  z-index: 5000;
  max-width: 280px;
  padding: 8px 10px;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .22);
  pointer-events: none;
}
.field-guide-tip[hidden] { display: none; }
.field-guide-tip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-top-color: #1f2937;
  top: 100%;
}
.field-guide-tip.is-below .field-guide-tip-arrow {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #1f2937;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
