:root {
  --red: #911b1d;
  --red-soft: #f8e8e8;
  --bg: #F5F5F5;
  --line: #e6e6e6;
  --text: #1a1a1a;
  --muted: #8a8a8a;
  --card: #fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #ececec;
  color: var(--text);
  font: 16px/1.45 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.phone {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
header {
  position: sticky;
  top: 0;
  z-index: 3;
  flex: none;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
header .title { flex: 1; text-align: center; font-size: 16px; }
header .who {
  max-width: 72px;
  color: #666;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
main { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding-bottom: 12px; }
.tabs {
  position: relative;
  flex: none;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 3;
}
.tabs button {
  position: relative;
  flex: 1;
  border: 0;
  background: #fff;
  color: var(--muted);
  padding: 14px 0 16px;
  font-size: 17px;
}
.tabs button.on { color: var(--red); font-weight: 600; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 8px 12px;
  padding: 12px;
}
button.card { display: block; width: calc(100% - 24px); text-align: left; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.name { font-size: 16px; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.arrow { color: #c8c8c8; font-size: 20px; }
.status { color: var(--red); font-size: 13px; }
.metric b { font-size: 26px; font-weight: 600; color: #111; letter-spacing: -0.03em; }
.metric span { font-size: 12px; color: var(--muted); margin-left: 2px; }
.metrics { display: flex; gap: 8px; }
.metrics .metric { flex: 1; }
.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 12px 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: thin;
}
.chip {
  flex: 0 0 auto;
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  touch-action: pan-x;
}
.chip.on { background: var(--red-soft); color: var(--red); border-color: #f0d4d4; }
.chip.lg { padding: 8px 14px; font-size: 16px; }
.year-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px 0; }
.year-bar select { width: auto; min-width: 88px; padding: 8px 10px; font-size: 16px; }
.search { position: relative; margin: 8px 12px; }
.search input { width: 100%; padding-left: 40px; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: #888;
  pointer-events: none;
}
.pair { display: flex; gap: 10px; }
.pair > div { flex: 1; min-width: 0; }
.proxy-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
}
.proxy-bar .chips { flex: 1; min-width: 0; padding: 0; }
.proxy-bar .btn { flex: none; padding: 8px 14px; font-size: 16px; }
.seg { display: flex; margin: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: visible; }
.seg button { position: relative; flex: 1; border: 0; background: #fff; padding: 12px 0; font-size: 16px; color: #666; }
.seg button.on { background: var(--red-soft); color: var(--red); font-weight: 600; }
.count {
  position: absolute;
  top: 2px;
  right: 12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #b42318;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  font-weight: 600;
}
.tabs .count { top: 4px; right: 10px; }
.confirm {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, .35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.confirm-card {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 12px 12px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.swipe { position: relative; margin: 8px 12px; overflow: hidden; border-radius: 8px; }
.swipe > .swipe-del { position: absolute; top: 0; right: 0; bottom: 0; width: 76px; border: 0; background: #b42318; color: #fff; font-size: 16px; }
.swipe > button.card { width: 100%; margin: 0; position: relative; z-index: 1; transition: transform .16s ease; touch-action: pan-y; }
.swipe.open > button.card { transform: translateX(-76px); }
.urge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 12px;
  line-height: 1.4;
  padding: 2px 8px;
  border-radius: 999px;
}
.urge-normal { background: #eee; color: #666; }
.urge-fast { background: #fff1dc; color: #c56a00; }
.urge-urgent { background: #fde8e8; color: #b42318; }
.has-urge .name { padding-right: 78px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  font-size: 16px;
}
textarea { min-height: 72px; resize: vertical; }
label { display: block; margin: 10px 0 4px; color: #666; font-size: 13px; }
.actions { display: flex; gap: 8px; margin: 8px 12px; }
.btn, button.btn {
  border: 1px solid var(--red);
  background: #fff;
  color: var(--red);
  border-radius: 8px;
  padding: 8px 12px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn.solid { background: var(--red); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .35; }
.head-link {
  border: 0;
  background: transparent;
  color: var(--red);
  padding: 0;
  font-size: 14px;
  white-space: nowrap;
}
.shot-box { margin-bottom: 4px; }
.shot-pick { position: relative; }
.shot-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.shot-preview {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}
.shot-box .btn { margin-top: 8px; }
.day-switch { display: flex; align-items: center; gap: 8px; }
.day-switch input { flex: 1; min-width: 0; }
.day-switch .btn { flex: none; padding: 8px 10px; }
.confirm.mid { align-items: center; }
.confirm.mid .confirm-card {
  width: min(280px, calc(100% - 72px));
  border-radius: 12px;
  padding: 18px 16px 16px;
}
.confirm.mid .name { text-align: center; }
.confirm.mid .actions { justify-content: center; margin: 14px 0 0; }
.history-list { max-height: 46vh; overflow: auto; margin: 8px 0; }
.history-list.tall { max-height: 62vh; }
.history-tools { display: flex; gap: 8px; }
.history-tools .btn { flex: 1; }
.history-sheet .actions { justify-content: space-between; margin: 12px 0 0; }
.history-sheet .actions .btn { min-width: 88px; }
button.pick {
  width: 100%;
  text-align: left;
  background: #fff;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 32px 10px 10px;
  font-size: 16px;
  position: relative;
  line-height: 1.4;
}
button.pick::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
}
.pick-row {
  display: block;
  width: 100%;
  text-align: left;
  position: relative;
  border: 1px solid var(--line);
  background: #fff;
  color: inherit;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 8px;
}
.pick-row.on { border-color: var(--red); background: #fff6f6; }
.pick-row .name { display: block; font-weight: 600; padding-right: 72px; }
.pick-row .sub { display: block; color: #888; font-size: 12px; margin-top: 4px; line-height: 1.5; }
label.check-row { display: flex; margin: 0; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; flex: none; margin: 2px 0 0; }
.check-row > span { flex: 1; min-width: 0; }
.pin-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}
.pin-bar.under { top: 36px; }
.pin-bar .card { margin-top: 0; }
.pin-bar .actions { margin-top: 0; margin-bottom: 4px; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(0, 0, 0, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.shot-preview { cursor: zoom-in; }
[hidden] { display: none !important; }
.back {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 8px 12px 6px;
  background: var(--bg);
}
.back button { border: 0; background: transparent; color: var(--red); padding: 0; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }
.banner {
  margin: 8px 12px 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  max-width: min(420px, 86vw);
  z-index: 6;
}
.msg { margin: 8px 12px; max-width: 80%; }
.msg.mine { margin-left: auto; }
.msg > div:last-child, .msg img { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.msg img { display: block; max-width: 100%; padding: 0; }
.suggest button, .checks label { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 8px 0; border-bottom: 1px solid var(--line); }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.wx-qr { width: 220px; height: auto; display: block; margin: 12px auto; background: #fff; }
.cats { display: flex; gap: 12px; margin-top: 6px; }
.cats label { margin: 0; color: var(--text); }
details { margin-top: 8px; }
summary { color: var(--red); cursor: pointer; }
img.product { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.phone.thread {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.phone.thread > header,
.phone.thread > .tabs { flex: none; }
.phone.thread main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0;
}
.phone.thread .banner,
.phone.thread .back { flex: none; }
.thread-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.composer {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 8px 10px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 40px;
  min-height: 40px;
  max-height: 96px;
  resize: none;
  padding: 8px 10px;
  line-height: 20px;
  overflow: hidden;
  scrollbar-width: none;
}
.composer textarea::-webkit-scrollbar { width: 0; height: 0; }
.icon-plus {
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #333;
  font-size: 24px;
  line-height: 1;
  padding: 0;
}
.icon-plus.on { color: var(--red); border-color: var(--red); }
.composer .btn.solid { flex: none; height: 40px; padding: 0 14px; }
.picked { color: var(--muted); font-size: 12px; }
.ops { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.badge { color: var(--red); font-size: 12px; margin-left: 6px; }
