:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #191919;
  --text-sub: #666c75;
  --text-muted: #99a0aa;
  --border: #e9ecf0;
  --brand: #07c160; /* 微信绿 / 翡翠绿 */
  --brand-dark: #06ad56;
  --brand-soft: #e8f8ef;
  --accent: #ff6b2b; /* 急单橙 */
  --accent-soft: #fff2eb;
  --danger: #fa5151;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.app-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

/* 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px 10px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.brand-dot.online {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.2);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #eef1f5;
  padding: 4px;
  border-radius: 10px;
}

.role-btn {
  border: none;
  background: transparent;
  padding: 8px 6px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s ease;
}

.role-btn.active {
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* 视图容器 */
.view {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* 表单 */
.order-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.field label,
.field-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 5px;
}

.hint {
  font-weight: 400;
  color: var(--text-muted);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #fafbfc;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  background: #ffffff;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  border: 1px solid var(--border);
  background: #f8f9fb;
  color: var(--text-sub);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: var(--brand);
  font-weight: 600;
}

/* 图片上传 */
.upload-box {
  border: 1px dashed #cfd5df;
  border-radius: 10px;
  background: #fafbfc;
  padding: 10px;
  text-align: center;
  cursor: pointer;
}

.upload-placeholder {
  color: var(--text-sub);
  font-size: 13px;
  padding: 8px 0;
}

.upload-preview {
  position: relative;
  display: inline-block;
}

.upload-preview img {
  max-height: 120px;
  border-radius: 8px;
  display: block;
}

.remove-img {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* 按钮 */
.btn-primary {
  border: none;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary:active {
  background: var(--brand-dark);
}

.btn-primary:disabled {
  background: #a7dfc0;
  cursor: not-allowed;
}

.btn-accent {
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
}

.btn-outline {
  border: 1px solid var(--brand);
  background: #fff;
  color: var(--brand-dark);
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-sub);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  cursor: pointer;
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}

.btn-lg {
  padding: 12px 16px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

/* 列表区 */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 8px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
}

.section-count {
  font-size: 12px;
  color: var(--text-muted);
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 订单卡片 */
.order-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.order-card.is-matched {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f3fcf7 0%, #ffffff 60%);
}

.order-card.is-ended {
  opacity: 0.72;
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.order-cat {
  font-size: 16px;
  font-weight: 700;
}

.order-buyer {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-open {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-matched {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.status-ended {
  background: #eef1f5;
  color: var(--text-muted);
}

.budget-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f9fb;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.budget-num {
  font-size: 15px;
  font-weight: 700;
  color: #d9480f;
}

.countdown {
  font-size: 12px;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.tag {
  font-size: 11px;
  background: #f1f3f5;
  color: var(--text-sub);
  padding: 2px 7px;
  border-radius: 6px;
}

.order-note {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
}

.order-ref-img {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: zoom-in;
}

.progress-bar {
  font-size: 12px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

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

.order-actions > * {
  flex: 1;
}

/* 报价列表 */
.quotes-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quote-item {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.quote-item.selected {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.quote-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.quote-price {
  font-size: 15px;
  font-weight: 700;
  color: #d9480f;
}

.quote-meta {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.quote-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.quote-img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  cursor: zoom-in;
}

.contact-box {
  margin-top: 8px;
  background: #ffffff;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

/* C端听单雷达卡片 */
.radar-card {
  background: linear-gradient(135deg, #0d2b1d 0%, #154c31 100%);
  color: #ffffff;
}

.radar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.radar-title {
  font-size: 15px;
  font-weight: 700;
}

.radar-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 2px;
}

.finder-profile {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.finder-profile input {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 12px;
  padding: 7px 8px;
}

.finder-profile input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-bar .chip {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.88);
}

.filter-bar .chip.active {
  background: #ffffff;
  color: #0d2b1d;
  border-color: #ffffff;
}

/* Switch 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  transition: 0.2s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--brand);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  z-index: 1;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.btn-close {
  border: none;
  background: #f1f3f5;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.dispatch-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 14px;
}

/* Toast & Lightbox */
.toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(25, 25, 25, 0.9);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 10px;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  background: #fff;
  border-radius: var(--radius);
}
