/* ============================================================
   待审核订单工作台 — 设计令牌与样式
   方向：运营控制台。高密度、低噪音、单一蓝色强调。
   ============================================================ */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --line: #e4e8ee;
  --line-strong: #d3d9e2;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #8a94a4;
  --accent: #2563eb;
  --accent-ink: #1d4ed8;
  --accent-soft: #eef4ff;
  --ok: #0f766e;
  --ok-soft: #e6f7f3;
  --warn: #b45309;
  --warn-soft: #fef6e7;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.05);
  --shadow-md: 0 4px 14px rgb(15 23 42 / 0.07);
  --shadow-lg: -18px 0 48px rgb(15 23 42 / 0.16);
  --radius: 10px;
  --radius-sm: 7px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

[data-theme='dark'] {
  --bg: #0a0e14;
  --surface: #111721;
  --surface-2: #151c27;
  --surface-3: #1b2431;
  --line: #222b38;
  --line-strong: #2f3a4b;
  --text: #e7edf5;
  --text-2: #a9b6c7;
  --muted: #6f7f93;
  --accent: #4f8cff;
  --accent-ink: #7aa9ff;
  --accent-soft: #16233b;
  --ok: #34d399;
  --ok-soft: #10261f;
  --warn: #fbbf24;
  --warn-soft: #2a2113;
  --danger: #f87171;
  --danger-soft: #2a1517;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 6px 18px rgb(0 0 0 / 0.45);
  --shadow-lg: -18px 0 48px rgb(0 0 0 / 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

code,
.mono,
.mono-sm {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

code {
  font-size: 0.92em;
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 5px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 顶栏 ---------- */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 58px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(140deg, #3b82f6, #1d4ed8 70%);
  box-shadow: 0 2px 8px rgb(37 99 235 / 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 14px;
  font-weight: 620;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tabs {
  display: flex;
  gap: 4px;
  height: 100%;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  height: 100%;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.15s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--text);
  font-weight: 600;
}

.tab.is-active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* ---------- 页面容器 ---------- */

.main {
  flex: 1;
  padding: 20px 22px 40px;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1560px;
  margin: 0 auto;
}

.page-narrow {
  max-width: 860px;
  padding-bottom: 84px;
}

.page-head {
  margin-bottom: 2px;
}

.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.page-sub {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 13px;
  max-width: 60ch;
}

/* ---------- 筛选区 ---------- */

.filter-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  box-shadow: var(--shadow-sm);
}

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 380px;
}

.filter-row .field {
  flex: 1 1 320px;
  max-width: 460px;
}

.field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.field-note {
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}

.input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input::placeholder {
  color: var(--muted);
}

.input:hover {
  border-color: var(--muted);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.textarea {
  height: auto;
  padding: 9px 11px;
  line-height: 1.5;
  resize: vertical;
}

.field-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.quick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

.quick-label {
  font-size: 12px;
  color: var(--muted);
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.quick-chip:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.quick-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.filter-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.chip {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: bottom;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 550;
}

.input-wrap {
  position: relative;
  display: block;
}

.input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input-wrap .input {
  padding-left: 33px;
  padding-right: 30px;
}

.input-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.input-clear:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.06s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgb(37 99 235 / 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-ink);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
}

.link-btn {
  color: var(--accent);
  font-size: 13px;
  font-weight: 550;
  padding: 0 2px;
}

.link-btn:hover {
  text-decoration: underline;
}

.select {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
}

/* ---------- 表格卡片 ---------- */

.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-title {
  margin: 0;
  font-size: 14px;
  font-weight: 620;
}

.count-pill {
  min-width: 30px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.toolbar-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 315px);
  min-height: 220px;
}

.grid {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.grid tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  background: var(--surface);
  overflow-wrap: anywhere;
}

.grid tbody tr:last-child td {
  border-bottom: none;
}

.row-clickable {
  cursor: pointer;
  transition: background 0.12s ease;
}

.row-clickable:hover td {
  background: var(--accent-soft);
}

.grid th.col-check,
.grid td.col-check {
  position: sticky;
  left: 0;
  z-index: 3;
  padding-left: 10px;
  padding-right: 4px;
  text-align: center;
}

.grid thead th.col-check {
  z-index: 5;
}

.grid th.col-goods,
.grid td.col-goods {
  position: sticky;
  left: 40px;
  z-index: 2;
  box-shadow: 1px 0 0 var(--line);
}

.grid th.col-goods {
  z-index: 4;
}

.row-clickable.is-selected td {
  background: var(--accent-soft);
}

.grid thead th:first-child {
  z-index: 4;
}

.th-nowrap {
  white-space: nowrap;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

/* 单元格内容 */

.goods {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.goods-line {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.thumb {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-3);
  flex: none;
}

.thumb-empty {
  display: block;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
}

.goods-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.goods-name {
  font-weight: 520;
  line-height: 1.4;
  white-space: normal;
}

.goods-spec {
  display: inline-block;
  align-self: flex-start;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 550;
}

.sys-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sys-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sys-name {
  color: var(--text-2);
  line-height: 1.35;
}

.sys-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
}

.tag-flag {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.remark {
  color: var(--warn);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.mono-sm {
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: -0.01em;
}

td.mono-sm {
  white-space: normal;
  overflow-wrap: anywhere;
}

.time-cell {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  white-space: nowrap;
}

.time-sub {
  color: var(--muted);
}

.receiver {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}

.addr {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.buyer-nick {
  white-space: normal;
  overflow-wrap: anywhere;
}

.buyer-msg {
  color: var(--warn);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.shop {
  font-weight: 520;
}

.muted {
  color: var(--muted);
}

.xs {
  font-size: 11.5px;
}

.more {
  font-size: 11.5px;
  color: var(--muted);
}

.trade-no {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 550;
}

.copy-btn {
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid transparent;
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease;
}

.row-clickable:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--line);
}

/* 骨架屏 */

.skeleton-row td {
  padding-top: 14px;
  padding-bottom: 14px;
}

.skeleton {
  display: block;
  height: 11px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* 空状态 / 错误 */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 54px 20px 58px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.empty-title {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.empty-sub {
  margin: 0;
  font-size: 12.5px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  margin: 12px 16px 0;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.banner-error {
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}

.banner strong {
  display: block;
  font-size: 13px;
}

.banner p {
  margin: 3px 0 0;
  color: var(--text-2);
  font-size: 12.5px;
}

.banner-hint {
  color: var(--danger) !important;
}

.banner .btn {
  margin-left: auto;
  flex: none;
}

/* 分页 */

.table-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.footer-meta {
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.pager {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* ---------- 抽屉 ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(8 12 20 / 0.42);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: flex-end;
  animation: fade-in 0.16s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.drawer {
  width: min(560px, 92vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slide-in 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes slide-in {
  from {
    transform: translateX(24px);
    opacity: 0.6;
  }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-eyebrow {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.drawer-title {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
}

.drawer-head .icon-btn {
  margin-left: auto;
}

.drawer-body {
  overflow: auto;
  padding: 16px 18px 28px;
}

.kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 0 0 20px;
}

.kv dt {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.kv dd {
  margin: 2px 0 0;
  font-size: 13px;
  word-break: break-all;
}

.drawer-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.03em;
}

.json {
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-2);
  overflow: auto;
  max-height: 52vh;
}

/* ---------- 配置页 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 620;
}

.card-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
}

.card-badge.is-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.card-badge.is-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.card-head .btn {
  margin-left: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.form-grid .field {
  flex: none;
}

.field-wide {
  margin-top: 12px;
}

.secret-current {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
}

.secret-label {
  font-size: 11.5px;
  color: var(--muted);
  flex: none;
}

.secret-value {
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  padding: 0;
}

.secret-current .btn {
  margin-left: auto;
  flex: none;
}

.action-bar {
  position: sticky;
  bottom: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.action-status {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  font-size: 12.5px;
}

.action-buttons {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.status-ok {
  color: var(--ok);
}

.status-err {
  color: var(--danger);
}

.status-busy {
  color: var(--text-2);
}

.status-meta {
  color: var(--muted);
  font-size: 12px;
}

.spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.footnote {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- 响应式与动效偏好 ---------- */

@media (max-width: 860px) {
  .topbar {
    gap: 14px;
    padding: 0 14px;
  }
  .brand-sub {
    display: none;
  }
  .main {
    padding: 14px 12px 32px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .table-scroll {
    max-height: none;
  }
  .kv {
    grid-template-columns: 1fr;
  }
}

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

/* ============================================================
   行内悬浮操作列
   ============================================================ */

.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  z-index: 6;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.col-resizer::after {
  content: '';
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 4px;
  width: 1px;
  background: transparent;
  transition: background 0.12s ease;
}

.grid thead th:hover .col-resizer::after,
.is-col-resizing .col-resizer::after {
  background: var(--accent);
  width: 2px;
}

body.is-col-resizing {
  cursor: col-resize;
  user-select: none;
}

body.is-col-resizing * {
  cursor: col-resize !important;
}

.col-ops-fixed {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -1px 0 0 var(--line);
}

.grid thead th.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  z-index: 6;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.col-resizer::after {
  content: '';
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 4px;
  width: 1px;
  background: transparent;
  transition: background 0.12s ease;
}

.grid thead th:hover .col-resizer::after,
.is-col-resizing .col-resizer::after {
  background: var(--accent);
  width: 2px;
}

body.is-col-resizing {
  cursor: col-resize;
  user-select: none;
}

body.is-col-resizing * {
  cursor: col-resize !important;
}

.col-ops-fixed {
  z-index: 4;
  background: var(--surface-2);
}

.row-clickable:hover td.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  z-index: 6;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.col-resizer::after {
  content: '';
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 4px;
  width: 1px;
  background: transparent;
  transition: background 0.12s ease;
}

.grid thead th:hover .col-resizer::after,
.is-col-resizing .col-resizer::after {
  background: var(--accent);
  width: 2px;
}

body.is-col-resizing {
  cursor: col-resize;
  user-select: none;
}

body.is-col-resizing * {
  cursor: col-resize !important;
}

.col-ops-fixed {
  background: var(--accent-soft);
}

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0.7;
  transition: opacity 0.14s ease;
}

.row-clickable:hover .row-actions,
.row-actions:focus-within {
  opacity: 1;
}

.act-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text-2);
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.act-btn:hover {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--accent);
}

.act-btn-exchange:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

@media (hover: none) {
  .row-actions {
    opacity: 1;
  }
}

/* 分页 */

.pager-num {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.pager-num:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.pager-num.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.pager-gap {
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
}

.pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.pager-input {
  width: 44px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pager-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* 轻提示 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.18s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* ============================================================
   换货抽屉
   ============================================================ */

.ex-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
  background: rgb(8 12 20 / 0.45);
  backdrop-filter: blur(2px);
  animation: fade-in 0.16s ease;
}

.ex-modal {
  display: flex;
  flex-direction: column;
  width: min(1240px, 96vw);
  height: min(88vh, 900px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.ex-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.ex-eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.ex-title {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.ex-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-2);
}

.ex-head .icon-btn {
  margin-left: auto;
  font-size: 20px;
}

.ex-banner {
  margin: 12px 20px 0;
}

.ex-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 0;
  min-height: 0;
}

.ex-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 18px;
  overflow: auto;
  min-height: 0;
}

.ex-pane-right {
  border-left: 1px solid var(--line);
  background: var(--surface-2);
}

.ex-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.ex-pane-right .ex-meta {
  background: var(--surface);
}

.ex-meta dt {
  font-size: 11px;
  color: var(--muted);
}

.ex-meta dd {
  margin: 2px 0 0;
  font-size: 12.5px;
  word-break: break-all;
}

.ex-row-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.ex-row-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 620;
}

.ex-chip {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-2);
}

.ex-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ex-table th {
  padding: 7px 10px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.ex-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.ex-table tbody tr:last-child td {
  border-bottom: none;
}

.ex-table tbody tr.is-active {
  background: var(--accent-soft);
}

.ex-table tbody tr.is-disabled td {
  color: var(--muted);
}

.ex-pane-right .ex-table td {
  background: var(--surface);
}

.ex-col-radio {
  width: 30px;
}

.ex-col-num {
  width: 92px;
  text-align: center;
}

.ex-col-ops {
  width: 78px;
  text-align: right;
  white-space: nowrap;
}

.ex-table td.ex-col-ops {
  white-space: nowrap;
}

.ex-col-stock {
  width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ex-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ex-item-name {
  font-weight: 520;
  line-height: 1.35;
}

.ex-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ex-num {
  width: 56px;
  height: 26px;
  padding: 0 4px;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.ex-num-static {
  font-variant-numeric: tabular-nums;
}

.ex-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface);
}

.ex-stepper button {
  width: 22px;
  height: 26px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1;
}

.ex-stepper button:hover {
  background: var(--surface-3);
  color: var(--text);
}

.ex-stepper input {
  width: 38px;
  height: 26px;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.ex-stepper input:focus {
  outline: none;
}

.ex-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 0;
  color: var(--muted);
  font-size: 12.5px;
}

.ex-mode {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ex-mode-label {
  margin-right: 4px;
  font-size: 12.5px;
  color: var(--text-2);
}

.ex-radio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}

.ex-radio input {
  accent-color: var(--accent);
  margin: 0;
}

.ex-radio.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 550;
}

.ex-radio.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ex-search {
  display: flex;
  gap: 8px;
}

.ex-search .input {
  flex: 1;
}

.ex-search-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
}

.ex-results {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.ex-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.ex-foot-info {
  font-size: 12.5px;
}

.ex-confirm-backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(8 12 20 / 0.42);
  z-index: 5;
  animation: fade-in 0.14s ease;
}

.ex-confirm {
  width: min(460px, 90%);
  padding: 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.ex-confirm h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.ex-confirm-lead {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
}

.ex-confirm-list {
  margin: 0 0 16px;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-2);
}

.ex-confirm-list li {
  margin: 2px 0;
}

.ex-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 980px) {
  .ex-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .ex-pane-right {
    border-left: none;
    border-top: 1px solid var(--line);
  }
}

/* 自动续期 */

.renew-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  margin: 0 0 6px;
}

.renew-grid dt {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.renew-grid dd {
  margin: 3px 0 0;
  font-size: 13.5px;
  font-weight: 550;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.renew-grid dd.is-danger {
  color: var(--danger);
}

.renew-sub {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
}

.renew-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  color: var(--danger);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* ---------- 备注筛选 ---------- */

.remark-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.seg-label {
  padding: 0 6px 0 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.seg-item {
  height: 30px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  transition: background 0.14s ease, color 0.14s ease;
}

.seg-item:hover {
  color: var(--text);
}

.seg-item.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  box-shadow: var(--shadow-sm);
}

.field-inline {
  flex: 0 1 250px;
  min-width: 180px;
}

.flag-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 196px;
}

.flag-anchor {
  position: relative;
}

.flag-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
}

.flag-trigger:hover {
  border-color: var(--muted);
}

.flag-trigger.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.flag-dots {
  display: inline-flex;
  gap: 2px;
}

.flag-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.flag-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 312px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.flag-mode {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.flag-mode .seg-item {
  height: 26px;
  padding: 0 10px;
}

.flag-clear {
  margin-left: auto;
  font-size: 12px;
}

.flag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}

.flag-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  text-align: left;
}

.flag-option:hover {
  background: var(--surface-3);
}

.flag-option.is-checked {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 550;
}

.applied-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

/* ---------- 规格关键词配置 ---------- */

.kw-card {
  position: relative;
}

.kw-index {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.kw-remove {
  margin-left: auto;
}

.kw-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  min-height: 24px;
}

.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12.5px;
}

.kw-chip b {
  font-weight: 620;
}

.kw-error {
  color: var(--danger);
  font-size: 12px;
}

.kw-add {
  height: 44px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.kw-add:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* 一键换货提示条 */

.ex-plan {
  margin: 12px 20px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  font-size: 12.5px;
  color: var(--text-2);
}

.ex-plan.is-warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 30%, transparent);
  color: var(--warn);
}

.ex-plan-line {
  margin: 0;
  line-height: 1.6;
}

.ex-plan-warn {
  color: var(--warn);
  font-weight: 550;
}

.ex-plan-miss {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 6px 0 0;
  padding-left: 16px;
  color: var(--warn);
}

.ex-plan-name {
  margin-right: 6px;
  font-weight: 550;
}

.act-btn-oneshot:hover {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-soft);
}

/* ---------- 登录页 ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
    var(--bg);
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(400px, 100%);
  padding: 26px 26px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.login-title {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.login-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.login-submit {
  height: 40px;
  margin-top: 4px;
}

.login-error {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-size: 12.5px;
}

.login-foot {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.spinner-lg {
  width: 22px;
  height: 22px;
  border-width: 3px;
}

/* ---------- 用户菜单 ---------- */

.user-menu {
  position: relative;
}

.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px 0 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
}

.user-trigger:hover,
.user-trigger[aria-expanded='true'] {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--text);
}

.avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(140deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 550;
}

.user-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.user-pop-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 9px 9px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.user-item {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
  color: var(--text-2);
}

.user-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.user-item.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- 弹窗 / 账号管理 ---------- */

.mini-modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, 90vw);
  margin: auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.drawer-backdrop {
  align-items: center;
  justify-content: center;
}

.mini-modal h4 {
  margin: 0 0 2px;
  font-size: 15px;
}

.mini-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.user-form .field {
  flex: none;
}

.user-table td {
  vertical-align: middle;
}

.tag-self {
  margin-left: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tag-on {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag-off {
  background: var(--surface-3);
  color: var(--muted);
}

.select-sm {
  height: 28px;
  padding: 0 6px;
  font-size: 12px;
}

.user-table .link-btn + .link-btn {
  margin-left: 10px;
}

@media (max-width: 900px) {
  .user-form {
    grid-template-columns: 1fr;
  }
}

/* 登录卡片里的字段不要被全局 .field 的 flex 撑开 */
.login-card .field {
  flex: none;
}

/* 平台订单号列 */
.platform-no {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--text-2);
}


/* ---------- 批量操作 / 选快递 ---------- */

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.bulk-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.ship-modal {
  width: min(440px, 92vw);
}

.ship-hint {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--text-2);
}

.ship-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 46vh;
  overflow: auto;
  margin-bottom: 8px;
}

.ship-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

.ship-option:hover {
  background: var(--surface-2);
}

.ship-option.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 550;
}

.ship-option input {
  accent-color: var(--accent);
}

.tag-default {
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.audit-errors {
  margin: 0 0 10px;
  padding-left: 18px;
  max-height: 32vh;
  overflow: auto;
  font-size: 12.5px;
  color: var(--danger);
}

/* 换货并审单：步骤结果 */
.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.pipeline-steps li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
  transform: translateY(-2px);
}

.step-ok .step-dot {
  background: var(--ok);
}

.step-err .step-dot {
  background: var(--danger);
}

.step-run .step-dot {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.step-label {
  font-weight: 550;
  white-space: nowrap;
}

.step-detail {
  color: var(--muted);
  font-size: 12.5px;
}

.ex-confirm-note {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
}

/* ---------- 服务端渲染补充 ---------- */
.flash { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--line); }
.flash-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.flash-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.flash-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.filter-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-form .field { flex: 0 1 240px; min-width: 170px; }
.link-quiet { color: var(--accent); }
.modal-mask { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 3vh 3vw; background: rgb(8 12 20 / .45); backdrop-filter: blur(2px); }
.modal-box { width: min(720px, 96vw); max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md); padding: 20px; }
.modal-box h3 { margin: 0 0 12px; font-size: 16px; }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.steps { margin: 0 0 12px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }

/* ---------- 换货页（内嵌弹窗版式） ---------- */
.page-modal {
  width: min(1240px, 96vw);
  height: auto;
  max-height: none;
  margin: 0 auto;
}
.page-modal .ex-body {
  min-height: 460px;
}
.page-modal .ex-pane {
  max-height: 62vh;
}
.ex-stepper form {
  display: flex;
  margin: 0;
}
.ex-stepper-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.page-modal .ex-scroll {
  flex: none;
  max-height: 26vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.page-modal .ex-scroll .ex-table {
  border: none;
}

/* ---------- 换货弹窗（iframe） ---------- */
.ex-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
  background: rgb(8 12 20 / 0.45);
  backdrop-filter: blur(2px);
}
.ex-overlay[hidden] {
  display: none;
}
.ex-modal-frame {
  width: min(1240px, 96vw);
  height: min(88vh, 900px);
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.ex-modal-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.embed-body {
  padding: 0;
  background: var(--surface);
}
.embed-body .page {
  padding: 0;
  margin: 0;
  max-width: none;
  gap: 0;
}
.ex-modal.is-embed {
  width: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  height: 100%;
}

.page-size-form {
  display: inline-flex;
  margin: 0;
}

.sys-count {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* 角色权限 */
.perm-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
}
.perm-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}
.perm-item input {
  accent-color: var(--accent);
}

.kw-delete {
  margin: 6px 0 0;
  text-align: right;
}

/* 登录验证码 */
.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.captcha-row .input {
  flex: 1;
}
.captcha-img {
  width: 132px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  background: var(--surface);
}

.ex-mode-hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* 只做选快递+审单时的警示按钮 */
.btn-warn {
  background: #f59e0b;
  color: #fff;
  box-shadow: 0 1px 2px rgb(245 158 11 / 0.35);
}
.btn-warn:hover:not(:disabled) {
  background: #d97706;
}

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 90;
  max-width: min(640px, 90vw);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-md);
  background: #111827;
  color: #fff;
}
.toast-ok { background: #14532d; }
.toast-error { background: #7f1d1d; }
.toast-warn { background: #78350f; }
.toast[hidden] { display: none; }

.results-loading { opacity: 0.55; pointer-events: none; transition: opacity .15s; }

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  white-space: nowrap;
}

/* 行内文字按钮 */
.act-btn-text {
  width: auto;
  padding: 0 8px;
  height: 26px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  white-space: nowrap;
}
.act-btn-text:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 订单日志弹窗 */
.log-modal {
  width: min(900px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.log-head h3 {
  margin: 0;
  font-size: 15px;
}
.log-body {
  padding: 12px 18px 18px;
  overflow: auto;
}
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.log-table th,
.log-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.log-table th {
  color: var(--muted);
  font-weight: 600;
}
.log-msg {
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.kw-preview-label {
  font-size: 11px;
  color: var(--muted);
  margin-right: 4px;
}
.kw-chip-base {
  background: var(--warn-soft);
  color: var(--warn);
}

/* 接口配置页：自动续期状态卡片 */
.renew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.renew-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.renew-item .k {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.renew-item .v {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}
.renew-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--muted);
  vertical-align: middle;
}
.renew-dot.ok { background: var(--ok); }
.renew-dot.warn { background: var(--warn); }
.renew-dot.bad { background: var(--danger); }
.renew-hint {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}
.renew-hint.ok { background: var(--ok-soft); color: var(--ok); }
.renew-hint.warn { background: var(--warn-soft); color: var(--warn); }
.renew-hint.bad { background: var(--danger-soft); color: var(--danger); }
.renew-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
