/* ===== 全局 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #fa2c19;
  --red-light: #fff1f0;
  --green: #18b955;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #bbb;
  --bg-page: #f6f6f6;
  --bg-card: #fff;
  --border: #f0f0f0;
  --sidebar-w: 92px;
  --topbar-h: 98px;
  --radius-md: 10px;
  --shadow-card: 0 1px 4px rgba(0,0,0,.06);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Topbar ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: #fff;
  padding: 12px 14px 10px;
  box-shadow: 0 1px 0 #eee;
}

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

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-city {
  font-size: 13px;
  color: var(--text-secondary);
  background: #f6f6f6;
  padding: 3px 9px;
  border-radius: 20px;
}

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

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 22px;
  padding: 0 10px;
  gap: 6px;
  height: 38px;
  min-width: 0;
}

.search-icon { width: 15px; height: 15px; color: #bbb; flex-shrink: 0; }

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.search-input::placeholder { color: #c0c0c0; }

.clear-btn {
  border: none;
  background: #ccc;
  color: #fff;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 18px;
  text-align: center;
}

.search-btn {
  height: 38px;
  padding: 0 16px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 19px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Main ===== */
.main-wrap {
  display: flex;
  position: fixed;
  top: var(--topbar-h);
  bottom: 0; left: 0; right: 0;
}

/* ===== Brand Sidebar ===== */
.brand-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #efefef;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.brand-sidebar::-webkit-scrollbar { display: none; }

.sidebar-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
}

.brand-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 10px 6px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-secondary);
  text-align: center;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
  word-break: break-all;
  transition: all .15s;
}

.brand-item.active {
  background: #fff;
  color: var(--red);
  font-weight: 600;
  border-left-color: var(--red);
}

/* ===== Model Panel ===== */
.model-panel {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--bg-page);
  min-width: 0;
}

.model-panel::-webkit-scrollbar { display: none; }

.model-list { padding: 8px 8px 16px; }

.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.8;
  text-align: center;
}

.panel-empty-icon { font-size: 40px; }

.model-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 13px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  box-shadow: var(--shadow-card);
  gap: 8px;
  transition: transform .1s;
}

.model-card:active { transform: scale(.99); }

.model-thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: contain;
  background: #f7f7f7;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.js-preview-img {
  cursor: zoom-in;
}

.model-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}

.model-info { flex: 1; min-width: 0; }

.model-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-alias {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-price-wrap { flex-shrink: 0; text-align: right; }

.model-price-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
  line-height: 1.2;
}

.model-price-lbl { font-size: 12px; color: var(--text-muted); display: block; }
.model-arrow { flex-shrink: 0; color: #ddd; font-size: 16px; }

/* ===== Drawer Mask ===== */
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.drawer-mask.hidden { display: none; }

/* ===== Price Drawer ===== */
.price-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 201;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding-bottom: max(env(safe-area-inset-bottom), 16px);
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.22,1,.36,1);
}

.price-drawer::-webkit-scrollbar { display: none; }
.price-drawer.open { transform: translateY(0); }
.price-drawer.hidden { display: none; }

.drawer-handle-wrap {
  padding: 10px 0 4px;
  display: flex;
  justify-content: center;
}

.drawer-handle {
  width: 36px; height: 4px;
  background: #e5e5e5;
  border-radius: 2px;
}

.drawer-model-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 6px 16px 14px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

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

.drawer-model-image {
  width: 86px;
  height: 86px;
  border-radius: 10px;
  object-fit: contain;
  background: #f7f7f7;
  border: 1px solid var(--border);
  flex-shrink: 0;
  cursor: zoom-in;
}

.drawer-brand { font-size: 13px; color: var(--text-muted); margin-bottom: 3px; }

.drawer-model-name { font-size: 18px; font-weight: 700; color: var(--text-primary); }

.drawer-close {
  width: 30px; height: 30px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.drawer-close svg { width: 14px; height: 14px; color: #888; }

.step-title {
  font-size: 14px;
  color: var(--text-muted);
  padding: 14px 16px 8px;
}

/* Tier cards */
.tier-list {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tier-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: #fafafa;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}

.tier-card.active { border-color: var(--red); background: var(--red-light); }

.tier-badge {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.tier-badge-ok   { background: #e6f7ff; color: #1890ff; }
.tier-badge-bad  { background: #fff7e6; color: #fa8c16; }
.tier-badge-scrap{ background: #f6f6f6; color: #888; }

.tier-body { flex: 1; min-width: 0; }
.tier-name { font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.tier-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.tier-price-wrap { text-align: right; flex-shrink: 0; }
.tier-price { display: block; font-size: 22px; font-weight: 800; color: var(--red); line-height: 1.2; }
.tier-price-label { font-size: 12px; color: var(--text-muted); }

/* Notice */
.drawer-notice-bar {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 12px 12px 14px;
  padding: 9px 11px;
  background: #fffbe6;
  border-radius: 6px;
  font-size: 12px;
  color: #8a6d00;
  line-height: 1.6;
}

.drawer-notice-bar svg { flex-shrink: 0; margin-top: 1px; color: #faad14; }

/* Service method buttons */
.service-btns {
  display: flex;
  gap: 10px;
  padding: 0 12px 16px;
}

.service-btn {
  flex: 1;
  height: 50px;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity .2s, transform .1s;
  border: 2px solid transparent;
}

.service-btn:active { transform: scale(.98); }

.service-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}

.service-btn-door {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.service-btn-express {
  background: #fff;
  color: var(--green);
  border-color: var(--green);
}

/* 已选档位提示 */
.selected-tier-bar {
  margin: 10px 12px 0;
  padding: 10px 14px;
  background: var(--red-light);
  border-left: 3px solid var(--red);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: var(--red);
  font-weight: 500;
}

/* Express info */
.express-info-card {
  margin: 12px 12px 6px;
  background: #f0faf4;
  border: 1.5px solid #b7ebc9;
  border-radius: var(--radius-md);
  padding: 14px;
}

.express-info-title {
  font-size: 14px;
  font-weight: 700;
  color: #0d7a35;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.express-info-row {
  display: flex;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

.express-info-row span:first-child {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 48px;
}

.express-notes {
  margin: 8px 12px 6px;
  padding: 10px 12px;
  background: #fffbe6;
  border-radius: 6px;
  font-size: 13px;
  color: #7a5f00;
  line-height: 1.7;
}

/* Form */
.form-field { padding: 0 12px; margin-bottom: 10px; }

.field-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.field-input {
  display: block;
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-size: 16px;
  color: var(--text-primary);
  font-family: inherit;
  background: #fafafa;
  outline: none;
  transition: border-color .15s;
}

.field-input:focus { border-color: var(--red); background: #fff; }
.field-textarea { height: auto; padding: 10px 12px; resize: none; line-height: 1.5; }

.submit-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 14px 12px 8px;
  height: 50px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 25px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

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

.back-btn {
  display: block;
  width: 100%;
  height: 38px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 4px;
}

.submit-msg {
  font-size: 14px;
  text-align: center;
  padding: 6px 16px 12px;
  line-height: 1.7;
}

.image-preview-mask {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.82);
  padding: 28px;
}

.image-preview-img {
  max-width: 100%;
  max-height: 84vh;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  padding: 10px;
}

.image-preview-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 30px;
  line-height: 38px;
}

.hidden { display: none !important; }
