/* 订单助手 · 手机端样式 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f2f3f5;
  color: #1f2329;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-box {
  padding: 60px 24px 24px;
  text-align: center;
}
.login-title { font-size: 24px; font-weight: 700; }
.login-sub { color: #8a9099; margin: 8px 0 28px; font-size: 14px; }
.pwd-input {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  border: 1px solid #d7d9dd;
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.pwd-input:focus { border-color: #1a73e8; }
.btn-login {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #1a73e8;
  border: none;
  border-radius: 10px;
}
.btn-login:active { background: #1557b0; }
.btn-login:disabled { background: #9ab6e0; }
.login-tip { margin-top: 14px; color: #e54545; font-size: 13px; min-height: 18px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: #1a73e8;
  color: #fff;
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.refresh-badge { font-size: 11px; opacity: .85; }
.icon-btn {
  border: none;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
}

/* ---------- 提醒条 ---------- */
.notify-bar {
  margin: 10px 12px 0;
  padding: 10px 12px;
  background: #fff4e5;
  color: #a35b00;
  border: 1px solid #ffd591;
  border-radius: 10px;
  font-size: 13px;
  animation: shake 1s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ---------- Tabs ---------- */
.tabs {
  position: sticky;
  top: 44px;
  z-index: 15;
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e8e9ec;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
  color: #646a73;
  border-bottom: 2px solid transparent;
}
.tab.active { color: #1a73e8; font-weight: 700; border-bottom-color: #1a73e8; }
.tab-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 9px;
  background: #f0f1f3;
  color: #646a73;
  font-size: 11px;
  line-height: 18px;
}
.tab.active .tab-count { background: #1a73e8; color: #fff; }

/* ---------- 列表 ---------- */
.list { padding: 12px; }
.empty { text-align: center; color: #8a9099; padding: 60px 0; font-size: 14px; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  border-left: 4px solid #d0d3d9;
}
.card.status-0 { border-left-color: #ff9f0a; }
.card.status-1, .card.status-4 { border-left-color: #1a73e8; }
.card.status-2 { border-left-color: #34c759; }
.card.status-3 { border-left-color: #8a9099; opacity: .85; }

.chead { display: flex; align-items: center; justify-content: space-between; }
.cno { font-weight: 700; font-size: 15px; letter-spacing: .3px; }
.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f0f1f3;
  color: #646a73;
}
.badge.s0 { background: #fff2e0; color: #b46a00; }
.badge.s1, .badge.s4 { background: #e8f0fe; color: #1557b0; }
.badge.s2 { background: #e6f7ec; color: #1a7f37; }
.badge.s3 { background: #f0f1f3; color: #646a73; }

.cuser { margin-top: 8px; font-size: 14px; color: #41464b; }
.cuid { color: #a6abb3; font-size: 12px; margin-left: 4px; }

.ptag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: 1px;
}
.ptag.wechat { background: #e6f7ec; color: #1a7f37; }
.ptag.alipay { background: #e6f1ff; color: #1677ff; }
.ptag.alipay-mock { background: #f0f1f3; color: #646a73; }

.citems { margin-top: 10px; background: #fafbfc; border-radius: 8px; padding: 8px 10px; }
.oi { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding: 3px 0; }
.oi-thumb { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; flex-shrink: 0; border: 1px solid #e6e8eb; background: #f5f6f7; }
.oi-name { flex: 1; word-break: break-all; }
.oi-spec { color: #8a9099; font-size: 12px; }
.oi-cnt { color: #646a73; flex-shrink: 0; font-size: 13px; white-space: nowrap; }
.oi-cnt .oi-price { color: #e54545; font-weight: 600; }
.oi-cnt .oi-sub { color: #8a9099; }

.ctotal { margin-top: 10px; font-size: 15px; text-align: right; }
.ctotal b { color: #e54545; font-size: 19px; }

.orow { display: flex; margin-top: 6px; font-size: 13px; line-height: 1.5; }
.olabel { width: 40px; color: #8a9099; flex-shrink: 0; }
.oval { flex: 1; color: #41464b; word-break: break-all; }

.ctime { margin-top: 10px; font-size: 12px; color: #a6abb3; }

.cacts { display: flex; gap: 10px; margin-top: 12px; }
.abtn {
  flex: 1;
  padding: 11px 0;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  color: #fff;
}
.abtn.ok { background: #34c759; }
.abtn.no { background: #fff; color: #e54545; border: 1px solid #ffccc7; }
.abtn.pay { background: #1a73e8; }
.abtn.ghost { background: #f2f3f5; color: #646a73; border: 1px solid #e0e2e6; }
.abtn:active { opacity: .75; }

/* ---------- 后台留言 ---------- */
.mnote { margin-top: 12px; border-top: 1px dashed #e8eaed; padding-top: 10px; }
.mnote-title { font-size: 13px; font-weight: 600; color: #646a73; margin-bottom: 6px; }
.mnote-hint { font-size: 11px; font-weight: 400; color: #fa8c16; }
.mnote-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e0e2e6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  background: #fafbfc;
}
.mnote-input:focus { outline: none; border-color: #1a73e8; background: #fff; }
.mnote-preview { margin-top: 6px; }
.mnote-preview:empty { display: none; }
.mnote-imglink img { max-width: 96px; max-height: 96px; border-radius: 6px; border: 1px solid #e8eaed; display: block; }
.mnote-acts { display: flex; gap: 8px; margin-top: 8px; }
.mnote-acts .abtn { flex: 1; padding: 9px 0; font-size: 14px; }
.mnote-acts .abtn[disabled] { opacity: .55; }

.foot-space { height: calc(20px + env(safe-area-inset-bottom)); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, .8);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 99;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 客服消息页（chat.html） ---------- */
.conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #f0f1f3;
  background: #fff;
  cursor: pointer;
}
.conv-item:active { background: #f7f8fa; }
.conv-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #e6f1ff; color: #1677ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; flex-shrink: 0;
}
.conv-main { flex: 1; min-width: 0; }
.conv-line1 { display: flex; align-items: center; gap: 6px; }
.conv-nick { font-size: 15px; font-weight: 600; color: #1f2329; }
.conv-unread {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #e54545; color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; flex-shrink: 0;
}
.conv-last {
  font-size: 13px; color: #8a9099; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.has-unread .conv-last { color: #1f2329; }
.conv-time { font-size: 11px; color: #b0b6bf; flex-shrink: 0; align-self: flex-start; margin-top: 2px; }

.chat-peer { font-size: 16px; font-weight: 600; color: #1f2329; margin-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.msg-row { display: flex; flex-direction: column; align-items: flex-start; max-width: 80%; }
.msg-row.mine { align-self: flex-end; align-items: flex-end; }
.msg-bubble {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-all;
  background: #fff;
  border: 1px solid #e8eaed;
  color: #1f2329;
}
.msg-row.mine .msg-bubble { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.msg-time { font-size: 10px; color: #b0b6bf; margin-top: 3px; }

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e8eaed;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  border: 1px solid #e0e2e6;
  border-radius: 18px;
  padding: 9px 14px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  max-height: 96px;
  background: #f7f8fa;
}
.chat-input:focus { outline: none; border-color: #1a73e8; background: #fff; }
.chat-send {
  flex-shrink: 0;
  border: none;
  border-radius: 18px;
  padding: 9px 18px;
  background: #e54545;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.chat-send:active { opacity: .8; }
.chat-send[disabled] { opacity: .55; }

/* 发送图片按钮 + 图片消息 */
.chat-img-btn {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 18px;
  border: 1px solid #e0e2e6;
  background: #f7f8fa;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.chat-img-btn:active { background: #eceef1; }
.msg-img { display: block; max-width: 180px; max-height: 240px; border-radius: 8px; }
.msg-bubble.img { padding: 4px; background: #fff; }

#chatView {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
}
