/* MUJI 暖白极简风 - 私域收单平台 */
:root {
  --bg-main: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-section: #F5F0E8;
  --bg-soft: #F0EBE0;
  --text-main: #3D3833;
  --text-sub: #8B8278;
  --line: #E8E0D3;
  --primary: #3D3833;
  --status-pending: #C9A86A;
  --status-paid: #8B9D6B;
  --status-shipped: #7B8FA1;
  --danger: #B85C5C;
  --success: #8B9D6B;
  --radius-card: 8px;
  --radius-btn: 6px;
  --gap: 16px;
  --gap-lg: 24px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-main);
  padding: 0;
  position: relative;
}

/* 顶部条 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-main);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
}

.topbar .actions {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: var(--text-sub);
}

.topbar .actions a {
  color: var(--text-sub);
  text-decoration: none;
}

.topbar .actions a:hover { color: var(--text-main); }

/* 页面容器 */
.page {
  padding: 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 4px 0;
  line-height: 1.4;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-sub);
  margin: 0 0 24px 0;
}

.section-title {
  font-size: 14px;
  color: var(--text-sub);
  margin: 0 0 12px 0;
  letter-spacing: 0.02em;
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-row + .card-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* 表单 */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.input, .textarea, .select {
  display: block;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 8px 0;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  border-radius: 0;
  transition: border-color 150ms ease-out;
  -webkit-appearance: none;
  appearance: none;
}

.input:focus, .textarea:focus, .select:focus {
  border-bottom-color: var(--text-main);
}

.textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.6;
}

/* 输入框带边框变体（用于配置区域） */
.input-boxed {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 10px 12px;
}

.input-boxed:focus {
  border-color: var(--text-main);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  padding: 12px 20px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 150ms ease-out, opacity 150ms ease-out, background 150ms ease-out;
  width: 100%;
  line-height: 1.4;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-secondary {
  background: var(--bg-soft);
  color: var(--text-main);
}

.btn-ghost {
  background: transparent;
  color: var(--text-sub);
  padding: 8px 12px;
  width: auto;
}

.btn-ghost:hover {
  color: var(--text-main);
}

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
  border: none;
}

.btn-success {
  background: var(--success);
  color: #FFFFFF;
  border: none;
}

.btn-muted {
  background: var(--bg-section);
  color: var(--text-sub);
  border: 1px solid var(--line);
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn {
  flex: 1;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  width: auto;
}

/* 徽章 */
.badge {
  display: inline-block;
  font-size: 12px;
  color: #FFFFFF;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.5;
}

.badge-pending { background: var(--status-pending); }
.badge-paid    { background: var(--status-paid); }
.badge-shipped { background: var(--status-shipped); }

/* 步骤进度 */
.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.step-bar {
  flex: 1;
  height: 2px;
  background: var(--line);
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}

.step-bar-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  background: var(--text-main);
  transition: width 200ms ease-out;
}

.step-label {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-sub);
}

.empty .icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty .text {
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: var(--text-main);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  transition: opacity 150ms ease-out;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

/* 商品列表项 */
.product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 150ms ease-out;
}

.product-item:last-child {
  border-bottom: none;
}

.product-item .name {
  font-size: 14px;
  color: var(--text-main);
}

.product-item .price {
  font-size: 14px;
  color: var(--text-main);
}

.product-item.selected {
  background: var(--bg-soft);
  margin: 0 -16px;
  padding: 12px 16px;
}

.product-item .check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  margin-right: 12px;
}

.product-item.selected .check {
  background: var(--text-main);
  border-color: var(--text-main);
  color: #FFF;
}

/* 订单卡片 */
.order-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
}

.order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.order-note {
  font-size: 13px;
  color: var(--text-sub);
  letter-spacing: 0.04em;
}

.order-meta {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 4px;
  line-height: 1.7;
}

.order-meta .row {
  display: flex;
  gap: 8px;
}

.order-meta .row .k {
  width: 60px;
  flex-shrink: 0;
  color: var(--text-sub);
}

.order-meta .row .v {
  flex: 1;
  color: var(--text-main);
  word-break: break-all;
}

.order-items {
  padding: 6px 0 8px 0;
  font-size: 13px;
  color: var(--text-main);
}

.order-items .it {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

/* 筛选条 */
.filter-bar {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.filter-tab {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-sub);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease-out;
}

.filter-tab.active {
  background: var(--text-main);
  color: #FFF;
  border-color: var(--text-main);
}

/* 收款码图片 */
.qr-img {
  display: block;
  width: 240px;
  height: 240px;
  max-width: 80%;
  margin: 12px auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  object-fit: contain;
  background: #FFF;
}

.qr-canvas {
  display: block;
  margin: 12px auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #FFF;
  padding: 8px;
}

/* 备注号大字 */
.note-code {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--text-main);
  background: var(--bg-soft);
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  margin: 8px 0;
}

/* 底部导航 */
.tabbar {
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--bg-main);
  position: sticky;
  bottom: 0;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 12px;
  color: var(--text-sub);
  cursor: pointer;
  transition: color 150ms ease-out;
  text-decoration: none;
  display: block;
}

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

.tab .icon {
  display: block;
  font-size: 20px;
  margin-bottom: 2px;
}

/* 工具样式 */
.text-sub { color: var(--text-sub); }
.text-main { color: var(--text-main); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.flex-row { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.tip {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-btn);
  margin: 12px 0;
}

.tip strong {
  font-weight: 500;
  color: var(--text-main);
}

/* 链接 */
a.link {
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

/* 收款上传 */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 150ms ease-out;
}

.upload-area:hover {
  border-color: var(--text-main);
}

.upload-area .icon {
  font-size: 28px;
  margin-bottom: 8px;
}

/* 配置面板 */
.config-banner {
  background: var(--bg-soft);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.config-banner .label { color: var(--text-sub); }
