/* Gaps found by the activity-page DOM audit. Existing viewport, safe-area,
   keyboard, state visibility, fonts and reward behavior remain in their own layers. */
:root .device .support-chat-menu,
:root.beike-legacy-webview .device .support-chat-menu {
  box-sizing: border-box; overflow-y: auto;
}

/* Home shortcut labels can grow without shrinking their icons. The ticker
   detail has three actual children: dot, heading and close button. */
:root .device .sell-feature,
:root.beike-legacy-webview .device .sell-feature {
  height: auto; min-height: 136px;
}
:root .device .sell-copy,
:root.beike-legacy-webview .device .sell-copy {
  min-width: 0; max-width: calc(100% - 136px);
  word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .sell-copy p,
:root.beike-legacy-webview .device .sell-copy p {
  max-width: 100%;
}
:root .device .shortcut,
:root.beike-legacy-webview .device .shortcut {
  height: auto; min-height: 88px;
}
:root .device .shortcut > .shortcut-icon,
:root.beike-legacy-webview .device .shortcut > .shortcut-icon {
  flex-shrink: 0;
}
:root .device .shortcut > strong,
:root.beike-legacy-webview .device .shortcut > strong {
  min-width: 0; max-width: 100%; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .ticker-modal-head,
:root.beike-legacy-webview .device .ticker-modal-head {
  display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; column-gap: 12px;
}
:root .device .ticker-modal-head > strong,
:root.beike-legacy-webview .device .ticker-modal-head > strong {
  min-width: 0; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .rates-list .rate-quote strong,
:root.beike-legacy-webview .device .rates-list .rate-quote strong {
  white-space: normal; word-wrap: break-word; overflow-wrap: anywhere;
}

/* The balance and date summaries are shared by once, daily, weekly and shop
   states. Their grid gutters work in Chrome 81 without a flex-margin fallback. */
:root .device .tasks-balance,
:root.beike-legacy-webview .device .tasks-balance {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 8px;
}
:root .device .tasks-balance > div,
:root.beike-legacy-webview .device .tasks-balance > div,
:root .device .tasks-balance > div > strong,
:root.beike-legacy-webview .device .tasks-balance > div > strong,
:root .device .tasks-balance-shop,
:root.beike-legacy-webview .device .tasks-balance-shop {
  min-width: 0; max-width: 100%; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .tasks-balance-shop,
:root.beike-legacy-webview .device .tasks-balance-shop {
  height: auto; min-height: 44px; padding-top: 8px; padding-bottom: 8px; max-width: 7em; line-height: 1.4;
}
:root .device .tasks-week,
:root.beike-legacy-webview .device .tasks-week,
:root .device .tasks-progress-head,
:root.beike-legacy-webview .device .tasks-progress-head,
:root .device .tasks-calendar-head,
:root.beike-legacy-webview .device .tasks-calendar-head,
:root .device .trade-bonus-list-heading,
:root.beike-legacy-webview .device .trade-bonus-list-heading,
:root .device .trade-bonus-example,
:root.beike-legacy-webview .device .trade-bonus-example {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; row-gap: 8px;
}
:root .device .tasks-week > *,
:root.beike-legacy-webview .device .tasks-week > *,
:root .device .tasks-progress-head > *,
:root.beike-legacy-webview .device .tasks-progress-head > *,
:root .device .tasks-calendar-head > *,
:root.beike-legacy-webview .device .tasks-calendar-head > *,
:root .device .trade-bonus-list-heading > *,
:root.beike-legacy-webview .device .trade-bonus-list-heading > *,
:root .device .trade-bonus-example > *,
:root.beike-legacy-webview .device .trade-bonus-example > * {
  min-width: 0; max-width: 100%; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.4;
}
:root .device .tasks-week > :last-child,
:root.beike-legacy-webview .device .tasks-week > :last-child,
:root .device .tasks-progress-head > :last-child,
:root.beike-legacy-webview .device .tasks-progress-head > :last-child,
:root .device .tasks-calendar-head > :last-child,
:root.beike-legacy-webview .device .tasks-calendar-head > :last-child,
:root .device .trade-bonus-example > :last-child,
:root.beike-legacy-webview .device .trade-bonus-example > :last-child {
  text-align: right;
}
:root .device .tasks-source-note,
:root.beike-legacy-webview .device .tasks-source-note,
:root .device .new-user-inline-rule,
:root.beike-legacy-webview .device .new-user-inline-rule {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; align-items: start;
}

/* Shop locked/available cards share markup. Only inner layout changes;
   eligibility, disabled state and the empty My coupons copy remain untouched. */
:root .device .tasks-preview.is-shop .tasks-coupon-face,
:root.beike-legacy-webview .device .tasks-preview.is-shop .tasks-coupon-face {
  display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 6px; align-content: center; justify-items: center;
}
:root .device .tasks-preview.is-shop .tasks-coupon-info,
:root.beike-legacy-webview .device .tasks-preview.is-shop .tasks-coupon-info {
  display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 6px; padding-top: 10px; padding-bottom: 10px;
}
:root .device .tasks-preview.is-shop .tasks-coupon-action,
:root.beike-legacy-webview .device .tasks-preview.is-shop .tasks-coupon-action {
  min-height: 44px; padding: 8px 6px; line-height: 1.4;
}
:root .device .tasks-owned-coupon,
:root.beike-legacy-webview .device .tasks-owned-coupon {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 8px;
}
:root .device .tasks-owned-coupon > div,
:root.beike-legacy-webview .device .tasks-owned-coupon > div,
:root .device .tasks-owned-coupon strong,
:root.beike-legacy-webview .device .tasks-owned-coupon strong,
:root .device .tasks-owned-coupon small,
:root.beike-legacy-webview .device .tasks-owned-coupon small {
  min-width: 0; max-width: 100%; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .tasks-owned-coupon > button,
:root.beike-legacy-webview .device .tasks-owned-coupon > button {
  min-width: 44px; max-width: 7em; min-height: 44px; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.4;
}
:root .device .tasks-dialog-reward,
:root.beike-legacy-webview .device .tasks-dialog-reward {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; row-gap: 8px;
}
:root .device .tasks-dialog-reward > span,
:root.beike-legacy-webview .device .tasks-dialog-reward > span,
:root .device .tasks-dialog-reward > strong,
:root.beike-legacy-webview .device .tasks-dialog-reward > strong {
  min-width: 0; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .tasks-dialog-reward > strong,
:root.beike-legacy-webview .device .tasks-dialog-reward > strong {
  text-align: right;
}

/* The active trade-bonus list uses trade-bonus-tier, not the earlier sample
   milestone class. Stack the two figures inside each existing two-column tile. */
:root .device .trade-bonus-tier,
:root.beike-legacy-webview .device .trade-bonus-tier {
  display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 8px;
}
:root .device .trade-bonus-threshold,
:root.beike-legacy-webview .device .trade-bonus-threshold,
:root .device .trade-bonus-threshold > b,
:root.beike-legacy-webview .device .trade-bonus-threshold > b,
:root .device .trade-bonus-tier > strong,
:root.beike-legacy-webview .device .trade-bonus-tier > strong {
  min-width: 0; max-width: 100%; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .new-user-demo-row,
:root.beike-legacy-webview .device .new-user-demo-row {
  height: auto; min-height: 48px;
}
:root .device .new-user-demo-row > input,
:root.beike-legacy-webview .device .new-user-demo-row > input {
  min-width: 0; min-height: 46px;
}
:root .device .new-user-demo-row > button,
:root.beike-legacy-webview .device .new-user-demo-row > button {
  flex-shrink: 0; min-height: 46px; max-width: 45%; white-space: normal; line-height: 1.4; padding-top: 10px; padding-bottom: 10px;
}

/* Wheel geometry and prize positions are deliberately unchanged. Only the
   explanatory summaries and rule rows receive real, supported gutters. */
:root .device .wheel-status,
:root.beike-legacy-webview .device .wheel-status,
:root .device .wheel-rule,
:root.beike-legacy-webview .device .wheel-rule,
:root .device .buddy-step,
:root.beike-legacy-webview .device .buddy-step {
  display: grid; grid-template-columns: 35px minmax(0, 1fr); column-gap: 12px; row-gap: 8px; align-items: start;
}
:root .device .wheel-rule,
:root.beike-legacy-webview .device .wheel-rule,
:root .device .buddy-step,
:root.beike-legacy-webview .device .buddy-step {
  grid-template-columns: 35px minmax(0, 1fr) auto;
}
:root .device .wheel-status > div,
:root.beike-legacy-webview .device .wheel-status > div,
:root .device .wheel-rule > div,
:root.beike-legacy-webview .device .wheel-rule > div,
:root .device .buddy-step > div,
:root.beike-legacy-webview .device .buddy-step > div,
:root .device .wheel-rule > b,
:root.beike-legacy-webview .device .wheel-rule > b,
:root .device .buddy-step > b,
:root.beike-legacy-webview .device .buddy-step > b {
  min-width: 0; max-width: 100%; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .wheel-test-balance,
:root.beike-legacy-webview .device .wheel-test-balance {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; row-gap: 8px;
}
:root .device .wheel-test-balance > strong,
:root.beike-legacy-webview .device .wheel-test-balance > strong {
  min-width: 0; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; text-align: right;
}

/* Buddy invitations: normal-flow record count cannot cover its title.
   A shrinking QR stays square because the image keeps its intrinsic ratio. */
:root .device .buddy-code-card,
:root.beike-legacy-webview .device .buddy-code-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 8px;
}
:root .device .buddy-code-card > div,
:root.beike-legacy-webview .device .buddy-code-card > div,
:root .device .buddy-code-card strong,
:root.beike-legacy-webview .device .buddy-code-card strong,
:root .device .buddy-stats > div,
:root.beike-legacy-webview .device .buddy-stats > div,
:root .device .buddy-stats strong,
:root.beike-legacy-webview .device .buddy-stats strong,
:root .device .buddy-share-text,
:root.beike-legacy-webview .device .buddy-share-text,
:root .device .buddy-share-text b,
:root.beike-legacy-webview .device .buddy-share-text b {
  min-width: 0; max-width: 100%; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .buddy-qr-open,
:root.beike-legacy-webview .device .buddy-qr-open {
  display: grid; grid-template-columns: 57px minmax(0, 1fr) 26px; column-gap: 12px;
}
:root .device .buddy-record-count,
:root.beike-legacy-webview .device .buddy-record-count {
  position: static; display: block; margin-top: 8px;
}
:root .device .buddy-qr-full,
:root.beike-legacy-webview .device .buddy-qr-full {
  height: auto;
}
:root .device .buddy-qr-full > img,
:root.beike-legacy-webview .device .buddy-qr-full > img {
  width: 100%; height: auto; display: block;
}
:root .device .buddy-qr-code-label,
:root.beike-legacy-webview .device .buddy-qr-code-label {
  display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 6px;
}
:root .device .buddy-qr-panel-eyebrow,
:root.beike-legacy-webview .device .buddy-qr-panel-eyebrow {
  margin-left: 0; margin-right: 0; padding-left: 44px; padding-right: 44px; word-wrap: break-word; overflow-wrap: anywhere;
}

/* Monthly totals are data, so both the customer name and amount get a
   shrinkable track. No rank, amount, eligibility or empty-state text is removed. */
:root .device .monthly-leader,
:root.beike-legacy-webview .device .monthly-leader {
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px;
}
:root .device .monthly-person,
:root.beike-legacy-webview .device .monthly-person,
:root .device .monthly-amount,
:root.beike-legacy-webview .device .monthly-amount,
:root .device .monthly-self-detail,
:root.beike-legacy-webview .device .monthly-self-detail,
:root .device .monthly-self-detail > b,
:root.beike-legacy-webview .device .monthly-self-detail > b {
  min-width: 0; max-width: 100%; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .monthly-amount,
:root.beike-legacy-webview .device .monthly-amount {
  text-align: right; line-height: 1.4;
}
:root .device .monthly-self,
:root.beike-legacy-webview .device .monthly-self {
  display: grid; grid-template-columns: 49px minmax(0, 1fr); column-gap: 12px;
}

/* Remaining activity dialogs were not included in responsive-polish.
   Their existing overlay positioning and sheet safe-area padding are preserved. */
:root .device .new-user-rules-card,
:root.beike-legacy-webview .device .new-user-rules-card,
:root .device .wheel-rules-card,
:root.beike-legacy-webview .device .wheel-rules-card,
:root .device .wheel-result-card,
:root.beike-legacy-webview .device .wheel-result-card,
:root .device .monthly-rules-card,
:root.beike-legacy-webview .device .monthly-rules-card,
:root .device .buddy-qr-panel,
:root.beike-legacy-webview .device .buddy-qr-panel {
  box-sizing: border-box; min-width: 0; max-width: 100%; max-height: 100%; overflow-y: auto; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .ticker-modal-card,
:root.beike-legacy-webview .device .ticker-modal-card {
  min-width: 0; max-height: 100%; overflow-y: auto;
}
:root .device .tasks-rules-head,
:root.beike-legacy-webview .device .tasks-rules-head,
:root .device .tasks-dialog-head,
:root.beike-legacy-webview .device .tasks-dialog-head,
:root .device .new-user-rules-head,
:root.beike-legacy-webview .device .new-user-rules-head,
:root .device .wheel-rules-head,
:root.beike-legacy-webview .device .wheel-rules-head,
:root .device .monthly-rules-head,
:root.beike-legacy-webview .device .monthly-rules-head,
:root .device .buddy-sheet-head,
:root.beike-legacy-webview .device .buddy-sheet-head,
:root .device .support-attachment-head,
:root.beike-legacy-webview .device .support-attachment-head,
:root .device .notification-detail-head,
:root.beike-legacy-webview .device .notification-detail-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 8px; align-items: center;
}
:root .device .tasks-rules-head > h3,
:root.beike-legacy-webview .device .tasks-rules-head > h3,
:root .device .tasks-dialog-eyebrow,
:root.beike-legacy-webview .device .tasks-dialog-eyebrow,
:root .device .new-user-rules-head > span,
:root.beike-legacy-webview .device .new-user-rules-head > span,
:root .device .wheel-rules-head > span,
:root.beike-legacy-webview .device .wheel-rules-head > span,
:root .device .monthly-rules-head > span,
:root.beike-legacy-webview .device .monthly-rules-head > span,
:root .device .buddy-sheet-head > h3,
:root.beike-legacy-webview .device .buddy-sheet-head > h3,
:root .device .support-attachment-head > strong,
:root.beike-legacy-webview .device .support-attachment-head > strong,
:root .device .notification-detail-type,
:root.beike-legacy-webview .device .notification-detail-type {
  min-width: 0; padding-right: 0; word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .new-user-rules-done,
:root.beike-legacy-webview .device .new-user-rules-done,
:root .device .wheel-rules-done,
:root.beike-legacy-webview .device .wheel-rules-done,
:root .device .wheel-result-close,
:root.beike-legacy-webview .device .wheel-result-close,
:root .device .monthly-rules-done,
:root.beike-legacy-webview .device .monthly-rules-done,
:root .device .tasks-dialog-done,
:root.beike-legacy-webview .device .tasks-dialog-done,
:root .device .buddy-sheet-done,
:root.beike-legacy-webview .device .buddy-sheet-done,
:root .device .buddy-share-copy,
:root.beike-legacy-webview .device .buddy-share-copy,
:root .device .buddy-qr-download,
:root.beike-legacy-webview .device .buddy-qr-download,
:root .device .new-user-action > button,
:root.beike-legacy-webview .device .new-user-action > button,
:root .device .monthly-action > button,
:root.beike-legacy-webview .device .monthly-action > button,
:root .device .buddy-share,
:root.beike-legacy-webview .device .buddy-share {
  height: auto; min-height: 48px; padding-top: 12px; padding-bottom: 12px; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.4;
}

/* Support: keep composer/keyboard bounds intact. Attachment choices and
   delete actions grow with text; inline images show the whole photo. */
:root .device .support-attachment,
:root.beike-legacy-webview .device .support-attachment,
:root .device .support-chat-menu,
:root.beike-legacy-webview .device .support-chat-menu {
  box-sizing: border-box; max-width: 100%; max-height: 100%; overflow-y: auto;
}
:root .device .support-attachment-option,
:root.beike-legacy-webview .device .support-attachment-option {
  height: auto; min-height: 48px; padding-top: 12px; padding-bottom: 12px; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.4;
}
:root .device .support-delete-actions,
:root.beike-legacy-webview .device .support-delete-actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px;
}
:root .device .support-delete-actions > button,
:root.beike-legacy-webview .device .support-delete-actions > button {
  min-width: 0; height: auto; min-height: 44px; padding: 10px 8px; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.4;
}
:root .device .support-message-image,
:root.beike-legacy-webview .device .support-message-image {
  max-width: 100%; height: auto; object-fit: contain;
}
:root .device .notifications-filters > button,
:root.beike-legacy-webview .device .notifications-filters > button {
  height: auto; min-height: 44px; padding-top: 10px; padding-bottom: 10px; white-space: normal; line-height: 1.4;
}
:root .device .notifications-filters > button > span,
:root.beike-legacy-webview .device .notifications-filters > button > span {
  flex-shrink: 0;
}
:root .device .tasks-rules-done,
:root.beike-legacy-webview .device .tasks-rules-done {
  min-height: 44px; padding: 8px 12px; white-space: normal; line-height: 1.4;
}
:root .device .new-user-tab-button > b,
:root.beike-legacy-webview .device .new-user-tab-button > b,
:root .device .notifications-filters > button > span,
:root.beike-legacy-webview .device .notifications-filters > button > span {
  height: auto; min-height: 20px; padding: 2px 4px; line-height: 1.3;
}

/* Only still-uncovered flex gaps receive margins, and only on browsers that
   measured no flex-gap support. Existing natural margins are left alone. */
:root.beike-no-flex-gap .device .new-user-tab-button > b { margin-left: 6px; }
:root.beike-no-flex-gap .device .tasks-calendar-day > small + b { margin-top: 3px; }
:root.beike-no-flex-gap .device .buddy-stats > div > strong + span { margin-top: 4px; }
:root.beike-no-flex-gap .device .monthly-hero-note > span + strong { margin-top: 4px; }
:root.beike-no-flex-gap .device .trade-bonus-threshold > small + b { margin-top: 4px; }
:root.beike-no-flex-gap .device .buddy-copy > svg { margin-right: 5px; }
:root.beike-no-flex-gap .device .wheel-test-balance > span > i { margin-right: 6px; }

@media (max-width: 360px) {
:root .device .sell-copy,
:root.beike-legacy-webview .device .sell-copy {
  max-width: 100%;
}
:root .device .buddy-hero-art,
:root.beike-legacy-webview .device .buddy-hero-art {
  position: relative; right: auto; bottom: auto; margin: 14px 0 0 auto; transform: none;
}
}

/* Welcome copy uses one supported grid track so its label never touches the
   description on narrow or older WebViews. Keep offer visibility and art intact. */
:root .device .welcome-ad-rules p,
:root.beike-legacy-webview .device .welcome-ad-rules p {
  display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 4px; align-items: start;
}
:root .device .welcome-ad-rules strong,
:root.beike-legacy-webview .device .welcome-ad-rules strong,
:root .device .welcome-ad-rules p > span,
:root.beike-legacy-webview .device .welcome-ad-rules p > span {
  min-width: 0; max-width: 100%; white-space: normal;
  word-wrap: break-word; overflow-wrap: anywhere;
}
:root .device .welcome-ad-card,
:root.beike-legacy-webview .device .welcome-ad-card {
  max-height: 100%; overflow-y: auto;
}
/* Actual brand markup is the text node BK followed by b, without an icon span. */
:root.beike-no-flex-gap .device .welcome-ad-brand > b { margin-left: 9px; }
