/* ═══ Design Tokens：4 档字号 + 3 档间距 ═══ */
:root {
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-body: 14px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --radius-card: 12px;
  --color-muted-border: #e5e7eb;
  --color-muted-text: #6b7280;
  --color-accent: #1677ff;
  --color-accent-soft: #e6f4ff;
  --color-success: #059669;
  --color-success-soft: #ecfdf5;
  --color-scene-replace: #fa8c16;
  --color-scene-supplement: #52c41a;
  --touch-min: 44px;
}

/* ═══ 反馈：Toast / 空态 / 加载 ═══ */
.yh-toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: var(--fs-sm);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 32px);
}

.yh-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.yh-toast .yh-icon {
  color: #86efac;
}

.empty-state {
  text-align: center;
  padding: var(--sp-lg) var(--sp-md);
  color: var(--color-muted-text);
  font-size: var(--fs-sm);
}

.empty-state__icon {
  font-size: 32px;
  margin-bottom: var(--sp-sm);
  opacity: 0.5;
}

.loading-skeleton {
  padding: var(--sp-md);
}

.loading-skeleton__bar {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: yh-shimmer 1.2s infinite;
  margin-bottom: var(--sp-sm);
}

.loading-skeleton__bar--wide { width: 85%; }
.loading-skeleton__bar--mid { width: 60%; }
.loading-skeleton__bar--short { width: 40%; }

@keyframes yh-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 详情页容器 */
#detail-body {
  padding: 0 var(--sp-md) var(--sp-lg);
}

#detail-body .detail-section,
#detail-body .hero {
  margin-top: var(--sp-sm);
}

.opportunity-card,
.oc {
  background: #fff;
  border-radius: var(--radius-card);
  padding: var(--sp-md);
  margin-bottom: var(--sp-sm);
  border: 1px solid var(--color-muted-border);
  cursor: pointer;
}

.opportunity-card__header,
.oh {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-sm);
  margin-bottom: 6px;
}

.opportunity-card__title,
.ot {
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.35;
  flex: 1;
}

.opportunity-card__amount,
.oa {
  font-size: var(--fs-sm);
  color: var(--color-accent);
  font-weight: 600;
  white-space: nowrap;
}

.opportunity-card__meta,
.om {
  font-size: var(--fs-xs);
  color: var(--color-muted-text);
  margin-bottom: var(--sp-sm);
}

.opportunity-card__tags,
.otags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.opp-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}

.opp-tag--accent {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.opp-tag--replace {
  background: #fff7e6;
  color: #d46b08;
  border: 1px solid #ffd591;
}

.opp-tag--supplement {
  background: #f6ffed;
  color: #389e0d;
  border: 1px solid #b7eb8f;
}

.opp-tag--muted {
  background: #fff;
  color: var(--color-muted-text);
  border: 1px solid var(--color-muted-border);
}

/* ═══ 门店分组列表 ═══ */
.store-group {
  background: #fff;
  border-radius: var(--radius-card);
  margin-bottom: var(--sp-md);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.store-group__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: var(--sp-md) var(--sp-md) var(--sp-sm);
  border-bottom: 1px solid transparent;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.store-group.is-expanded .store-group__header {
  border-bottom-color: var(--color-muted-border);
}

.store-group__header:active {
  background: #f5f7fa;
}

.store-group__header-main {
  flex: 1;
  min-width: 0;
}

.store-group__header-side {
  flex-shrink: 0;
  padding-top: 2px;
}

.store-group__header-side .pb {
  margin: 0;
}

.store-group__title-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}

.store-group__chevron {
  flex-shrink: 0;
  width: 14px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-muted-text);
  margin-top: 2px;
}

.store-group__title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}

.store-group__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--sp-sm);
  font-size: var(--fs-xs);
  color: var(--color-muted-text);
}

.store-group__top-sku {
  flex: 1 1 100%;
  color: #4b5563;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-group.is-collapsed .store-group__body {
  display: none;
}

.store-group__body {
  padding: var(--sp-xs) 0;
}

.store-opp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  align-items: start;
}

.store-opp-row:last-child {
  border-bottom: none;
}

.store-opp-row__main {
  grid-column: 1;
  min-width: 0;
}

.store-opp-row__title {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 4px;
}

.store-opp-row__reason {
  margin-bottom: 0;
}

.store-opp-row__reason-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
  padding-left: 8px;
  border-left: 3px solid var(--color-scene-replace);
  line-height: 1.3;
}

.store-opp-row__reason-label.is-supplement {
  border-left-color: var(--color-scene-supplement);
}

.store-opp-row__reason-label.is-replace {
  border-left-color: var(--color-scene-replace);
}

.store-opp-row__reason-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--fs-body);
  color: #374151;
  line-height: 1.5;
}

.store-opp-row__reason-text.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.store-opp-row__reason-wrap {
  padding-left: 11px;
  cursor: pointer;
}

.store-opp-row__reason-toggle {
  display: inline-block;
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--color-accent);
  font-weight: 500;
}

.store-opp-row__subline {
  font-size: var(--fs-xs);
  color: var(--color-muted-text);
  padding-left: 11px;
  line-height: 1.4;
  margin-top: 4px;
}

.store-opp-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.store-opp-row__side {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  align-self: start;
}

.store-opp-row__meta {
  font-size: var(--fs-xs);
  color: var(--color-muted-text);
  margin-top: 2px;
}

.store-opp-row__scene {
  font-size: 10px;
  color: #b0b8c4;
  margin-top: 2px;
  line-height: 1.3;
}

.store-opp-row__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.store-opp-row__btn {
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
}

.store-opp-row__btn--primary {
  background: var(--color-accent);
  color: #fff;
}

/* ═══ BattleCard（作战卡） ═══ */
.battle-card,
.cd {
  background: #fff;
  border-radius: var(--radius-card);
  margin-bottom: var(--sp-sm);
  border: 1px solid var(--color-muted-border);
  overflow: hidden;
}

.battle-card__head,
.cdh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md);
  cursor: pointer;
  user-select: none;
  gap: var(--sp-sm);
}

.battle-card__title,
.cdt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-md);
  font-weight: 600;
}

.battle-card__chevron,
.cdc {
  color: var(--color-muted-text);
  font-size: var(--fs-xs);
  transition: transform 0.2s;
}

.battle-card.is-collapsed .battle-card__chevron,
.cd.collapsed .cdc {
  transform: rotate(-90deg);
}

.battle-card__body,
.cdb {
  padding: 0 var(--sp-md) var(--sp-md);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.battle-card.is-collapsed .battle-card__body,
.cd.collapsed .cdb {
  display: none;
}

/* ═══ ScriptKeyPoints（开口三句） ═══ */
.script-keypoints,
.sk-box {
  background: #f9fafb;
  border-radius: 8px;
  padding: var(--sp-md);
  margin-bottom: var(--sp-sm);
}

.script-keypoints__label,
.sk-label {
  font-size: var(--fs-xs);
  color: var(--color-muted-text);
  margin-bottom: var(--sp-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

.script-keypoints__item,
.sk-item {
  display: flex;
  gap: var(--sp-sm);
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.script-keypoints__num,
.sk-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══ 列表排序 ═══ */
.list-sort-bar {
  display: flex;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  overflow-x: auto;
}

.list-sort-bar__btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-muted-border);
  background: #fff;
  font-size: var(--fs-xs);
  color: var(--color-muted-text);
  cursor: pointer;
}

.list-sort-bar__btn.is-active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 600;
}

/* ═══ 详情证据块 ═══ */
.detail-section,
.sec {
  background: #fff;
  border-radius: var(--radius-card);
  padding: var(--sp-md);
  margin-bottom: var(--sp-sm);
  border: 1px solid var(--color-muted-border);
}

.detail-section__title,
.sec-t {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-section__row,
.sec-r {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  padding: 4px 0;
  border-bottom: 1px solid #f3f4f6;
}

.detail-section__row:last-child,
.sec-r:last-child { border-bottom: none; }

.detail-section__label { color: var(--color-muted-text); }

/* ═══ 回写页 ═══ */
.writeback-form {
  padding: var(--sp-md);
}

.writeback-form__group {
  margin-bottom: var(--sp-lg);
}

.writeback-form__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 6px;
}

.writeback-form__input,
.writeback-form__select,
.writeback-form__textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--color-muted-border);
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-family: inherit;
}

.writeback-form__textarea {
  min-height: 80px;
  resize: vertical;
}

.writeback-form__hint {
  font-size: var(--fs-xs);
  color: var(--color-muted-text);
  margin-top: 4px;
}

/* ═══ 成功页 overlay ═══ */
.writeback-success {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.98);
  z-index: 8000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
  text-align: center;
}

.writeback-success.is-open {
  display: flex;
}

.writeback-success__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-success-soft);
  color: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-lg);
}

.writeback-success__icon .yh-icon {
  width: 32px;
  height: 32px;
}

.writeback-success__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--sp-sm);
}

.writeback-success__desc {
  font-size: var(--fs-sm);
  color: var(--color-muted-text);
  margin-bottom: var(--sp-lg);
  max-width: 280px;
}

.writeback-success__actions {
  display: flex;
  gap: var(--sp-sm);
  width: 100%;
  max-width: 320px;
}

/* ═══ 回写表单 DEMO 样式 ═══ */
.wb-hint { font-size: var(--fs-sm); color: var(--color-muted-text); margin-bottom: 8px; }
.fsr { color: #ff4d4f; font-size: var(--fs-xs); margin-left: 2px; }

.og { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.og.c3 { grid-template-columns: 1fr 1fr 1fr; }
.og.cols-2 { grid-template-columns: 1fr 1fr; }

.ocd {
  padding: 14px 10px;
  border: 2px solid var(--color-muted-border);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  user-select: none;
}

.ocd.se { border-color: var(--color-accent); background: var(--color-accent-soft); }
.ocd .lb { font-size: var(--fs-sm); font-weight: 500; }
.ocd .sl { font-size: var(--fs-xs); color: var(--color-muted-text); margin-top: 2px; }

.tg2 { display: flex; flex-wrap: wrap; gap: 8px; }
.tgi {
  padding: 8px 14px;
  border: 1.5px solid var(--color-muted-border);
  border-radius: 20px;
  font-size: var(--fs-sm);
  cursor: pointer;
  background: #fff;
}
.tgi.se { border-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; }

.skc {
  border: 1.5px solid var(--color-muted-border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.skc.ac { border-color: var(--color-accent); background: #fafcff; }
.skh { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.skcb {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid #d9d9d9;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: var(--fs-xs);
}
.skc.ac .skcb { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.skn { font-size: var(--fs-sm); font-weight: 600; }
.sks { font-size: var(--fs-xs); color: var(--color-muted-text); margin-top: 2px; }

.qr { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #f5f5f5; border-radius: 8px; }
.qr .l { font-size: var(--fs-sm); color: var(--color-muted-text); }
.qct { display: flex; align-items: center; gap: 12px; }
.qb {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid #d9d9d9;
  background: #fff; font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.qv { font-size: var(--fs-lg); font-weight: 700; color: var(--color-accent); min-width: 40px; text-align: center; }

.ams {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--color-accent-soft); border-radius: 10px; margin-top: 4px;
}
.ams .l { font-size: var(--fs-sm); color: var(--color-muted-text); }
.ams .a { font-size: 20px; font-weight: 700; color: var(--color-accent); }

.qph { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.qpi { padding: 6px 10px; background: #f5f5f5; border-radius: 6px; font-size: var(--fs-xs); color: var(--color-muted-text); cursor: pointer; }

.ddi {
  padding: 10px 14px; background: #f5f5f5; border-radius: 8px; font-size: var(--fs-sm); font-weight: 500;
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.dqk { display: flex; gap: 8px; }
.dqb {
  flex: 1; padding: 8px; border: 1.5px solid var(--color-muted-border); border-radius: 8px;
  text-align: center; font-size: var(--fs-sm); cursor: pointer; background: #fff;
}
.dqb.se { border-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; }

.rtg { display: flex; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--color-muted-border); }
.rto {
  flex: 1; padding: 12px 8px; text-align: center; font-size: var(--fs-sm); cursor: pointer; background: #fff;
  border-right: 1px solid var(--color-muted-border);
}
.rto:last-child { border-right: none; }
.rto.se { background: var(--color-accent); color: #fff; }

/* ═══ 进店 Teleprompter 模式 ═══ */
.teleprompter {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #111827;
  color: #f9fafb;
  display: none;
  flex-direction: column;
  padding: env(safe-area-inset-top, 16px) var(--sp-lg) env(safe-area-inset-bottom, 16px);
}

.teleprompter.is-open {
  display: flex;
}

.teleprompter__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-md) 0;
  flex-shrink: 0;
}

.teleprompter__store {
  font-size: var(--fs-sm);
  color: #9ca3af;
}

.teleprompter__close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.teleprompter__section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

.teleprompter__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: var(--sp-md);
}

.teleprompter__line {
  font-size: 20px;
  line-height: 1.5;
  font-weight: 500;
  margin-bottom: 18px;
  padding-left: var(--sp-md);
  border-left: 3px solid var(--color-accent);
}

.teleprompter__probe {
  margin-top: var(--sp-lg);
  padding-top: var(--sp-lg);
  border-top: 1px solid #374151;
}

.teleprompter__probe-q {
  font-size: 18px;
  line-height: 1.45;
  color: #93c5fd;
  font-weight: 500;
}

.teleprompter__probe-label {
  font-size: var(--fs-xs);
  color: #6b7280;
  margin-bottom: var(--sp-sm);
}

.card-nav {
  position: sticky;
  top: 53px;
  z-index: 90;
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  background: rgba(245, 245, 245, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e8e8e8;
  -webkit-overflow-scrolling: touch;
}

.card-nav__btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  min-height: 32px;
}

.card-nav__btn:active {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.fact-num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #d4380d;
  background: linear-gradient(180deg, #fff7e6 0%, #ffe7ba 100%);
  padding: 1px 5px;
  margin: 0 1px;
  border-radius: 4px;
  font-size: 1.06em;
  line-height: 1.35;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.copy-btn.is-copied {
  color: var(--color-success) !important;
}

.copy-btn.is-copied .yh-icon--copy {
  --yh-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Cpath d='M5 12l4 4L19 6'/%3E%3C/svg%3E");
}

/* 优先级圆点 */
.pb-dot, .fi-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.pb.hi .pb-dot { background: #ef4444; }
.pb.md .pb-dot { background: #f59e0b; }
.fi-dot { background: var(--color-accent); }

/* 品牌份额条 */
.share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.share-row:last-child { border-bottom: none; }
.share-row--dim { opacity: 0.45; }

.share-row__name {
  font-size: var(--fs-xs);
  color: #333;
  width: 72px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-row__bar {
  flex: 1;
  height: 10px;
  background: #f5f5f5;
  border-radius: 5px;
  overflow: hidden;
}

.share-row__fill {
  height: 100%;
  border-radius: 5px;
}

.share-row__pct {
  font-size: var(--fs-xs);
  font-weight: 700;
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.share-row__pct--hi { color: #cf1322; }

/* 历史拜访 */
.visit-item {
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}

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

.visit-item__meta {
  font-size: var(--fs-sm);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.visit-item__tag {
  font-size: var(--fs-xs);
  color: #cf1322;
  background: #fff1f0;
  padding: 2px 6px;
  border-radius: 4px;
}

.visit-item__note {
  font-size: var(--fs-sm);
  color: var(--color-muted-text);
  line-height: 1.5;
}

.visit-item__label { color: #999; }

.visit-item--empty .visit-item__meta {
  color: var(--color-muted-text);
}
