/* Progressive mobile enhancements. Business styles remain in app.css. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Bound the block chain before allowing wide data content to scroll inside it.
 * Avoid body overflow-x:hidden: that hides the bug and can cut off controls. */
#app, .workspace { width: 100%; min-width: 0; max-width: 100%; }
.main { max-width: 100%; }
.page { width: 100%; }
.page > *, .panel, .panel-body, .modal-body, .calculator-body,
.dashboard-grid, .partner-layout, .rules-layout, .pitch-scenarios { min-width: 0; max-width: 100%; }
.main, .page, .panel, .panel-body, .auth-box, .field, .field-row > *,
.stats-grid > *, .detail-layout > *, .rules-layout > *, .partner-layout > *,
.dashboard-grid > *, .pitch-scenarios > *, .modal-body > *, .detail-grid > * { min-width: 0; }
/* Explicit inline-size containment prevents intrinsic table width from entering
 * a flex/grid ancestor's minimum-content sizing. The table stays fully scrollable. */
.table-wrap, .table-scroll {
  position: relative; display: block; width: 100%; min-width: 0; max-width: 100%;
  overflow-x: auto; overflow-y: hidden; contain: inline-size;
}
.table-wrap > table, .table-scroll > table { width: 100%; max-width: none; }
.table-wrap, .table-scroll, .tree-scroll, .tab-bar, .monthly-tiers {
  min-width: 0; max-width: 100%; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
}
.tab-bar { width: 100%; contain: inline-size; }
.monthly-tiers { width: 100%; contain: inline-size; overflow-x: auto; }
.modal-head > div, .install-identity > div { min-width: 0; overflow-wrap: anywhere; }
.modal-body form, .modal-body .field, .modal-body .field-suffix { min-width: 0; max-width: 100%; }
.modal-body input, .modal-body select, .modal-body textarea { min-width: 0; max-width: 100%; }
.table-wrap:focus-visible { outline: 3px solid #87caba; outline-offset: -3px; }
.table-wrap[data-mobile-scroll]::before {
  content: "左右滑动查看完整表格"; display: none; padding: 8px 17px;
  font-size: 11px; color: #687e70; background: #f4f8f1;
}
.install-strip {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 39px; border-bottom: 1px solid var(--line); background: #f0f6ef;
}
.install-strip-copy { font-size: 11px; color: #6a806d; line-height: 1.6; }
.install-strip-copy strong { display: block; color: #44654c; font-weight: 550; }
.install-entry { flex-shrink: 0; min-height: 44px; color: var(--teal); background: #fff; }
.install-entry svg { width: 17px; height: 20px; }
.auth-box > .install-strip { padding: 15px 0 0; margin-top: 19px; border: 0; border-top: 1px solid var(--line); background: none; }
.install-dialog { width: min(620px, calc(100vw - 32px)); }
.install-dialog h2 { font-size: 20px; }
.install-dialog .modal-head { align-items: center; }
.install-dialog .icon-button { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
.install-identity { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.install-identity img { border-radius: 15px; width: 58px; height: 58px; }
.install-identity strong { font-size: 15px; font-weight: 600; }
.install-identity p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.install-state { background: #f5f8f2; border: 1px solid #e1e9d9; border-radius: 10px; padding: 14px 16px; }
.install-state[data-state="preview"], .install-state[data-state="insecure"] { background: #fcf6e9; border-color: #eee3c9; }
.install-state strong { display: block; font-size: 13px; color: #45633e; }
.install-state p { margin-top: 5px; font-size: 12px; color: #778369; overflow-wrap: anywhere; }
.install-state[data-state="preview"] strong, .install-state[data-state="insecure"] strong { color: #886b36; }
.install-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.install-method { border: 1px solid var(--line); border-radius: 10px; padding: 15px; }
.install-method[data-current="true"] { border-color: #97bfa8; background: #f5faf5; }
.install-method h3 { font-size: 13px; font-weight: 600; }
.install-method ol { padding-left: 18px; margin: 10px 0 0; font-size: 12px; color: #667b60; }
.install-method li + li { margin-top: 6px; }
.install-note { margin-top: 15px; font-size: 11px; color: #839078; line-height: 1.8; }
.install-feedback { font-size: 12px; color: var(--teal); margin-top: 12px; }
.install-feedback:empty { display: none; }
.install-dialog .modal-footer { flex-wrap: wrap; }
.install-dialog button[hidden] { display: none !important; }
.install-dialog .btn { min-height: 44px; }

@media (max-width: 1000px) {
  .install-strip { padding-inline: 23px; }
  .rules-layout, .partner-layout, .dashboard-grid, .pitch-scenarios { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .workspace, .auth-main { min-height: 100vh; min-height: 100dvh; }
  .main { flex: 1 1 0%; width: 100%; margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-grid, .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding-top: max(28px, env(safe-area-inset-top, 0px)); padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)); overflow-y: auto; max-height: 100vh; max-height: 100dvh; }
  .topbar { min-height: 65px; height: auto; padding-top: max(7px, env(safe-area-inset-top, 0px)); padding-bottom: 7px; gap: 10px; }
  .topbar-left, .top-actions, .profile > div { min-width: 0; }
  .profile-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile, .mobile-menu, .icon-button, .row-link { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .btn, .btn.small, .tab, .nav-link, .text-button, .auth-back { min-height: 44px; }
  .btn, .btn.small { font-size: 13px; }
  .text-button { display: inline-flex; align-items: center; }
  input, select, textarea, .search-box input, .filter-select, .copy-row input, .referral-pitch { font-size: 16px !important; }
  input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]), select { min-height: 44px; }
  textarea { min-height: 96px; }
  label { font-size: 12px; }
  .field-help, .form-error, .scope-note, .auth-registration-note { font-size: 12px; }
  .field-row, .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .page { padding-bottom: max(30px, env(safe-area-inset-bottom, 0px)); }
  .page-head { flex-wrap: wrap; }
  .page-head > div { min-width: 0; }
  .page-head p { max-width: none; font-size: 12px; }
  .page-actions { width: 100%; margin-top: 0; flex-wrap: wrap; }
  .page-actions .btn { font-size: 12px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; flex-basis: auto; }
  .search-box svg { top: 14px; }
  .toolbar-right { flex-wrap: wrap; min-width: 0; }
  .toolbar-right select { flex: 1 1 130px; min-width: 0; }
  .result-count { display: block; }
  .table-wrap[data-mobile-scroll]::before { display: block; }
  .data-table th, .data-table.compact th { font-size: 11px; }
  .data-table td, .data-table.compact td { font-size: 12px; }
  .table-footer, .footer, .panel-head { flex-wrap: wrap; }
  .stat-value { font-size: clamp(21px, 6vw, 29px); overflow-wrap: anywhere; }
  .stat-caption { flex-wrap: wrap; }
  .reward-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reward-stats .stat:first-child { grid-column: 1 / -1; }
  .reward-stats .stat-top { font-size: 12px; }
  .reward-stats .stat-caption { font-size: 10px; }
  .leads-summary { flex-wrap: wrap; }
  .summary-chip { flex: 1 1 130px; min-width: 0; }
  .summary-chip span { font-size: 11px; }
  .detail-actions .btn, .contract-section-head .btn, .receipt-side .btn { font-size: 12px; min-height: 44px; }
  .detail-top, .contract-section-head, .contract-summary-head { flex-wrap: wrap; }
  .contract-reference { flex-wrap: wrap; gap: 4px 10px; }
  .detail-value, .detail-label, .detail-block p, .detail-block h3, .mini-ledger-row { font-size: 12px; }
  .mini-ledger-row, .receipt-row { flex-wrap: wrap; }
  .copy-row input { min-width: 0; }
  .rule-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .radio-cards, .mode-picker { grid-template-columns: minmax(0, 1fr); }
  .radio-card, .mode-option { min-height: 54px; }
  .radio-card input, .mode-option input { min-width: 18px; width: 18px; height: 18px; }
  .radio-card small, .mode-option small { font-size: 11px; }
  .auth-main { padding-inline: 24px; padding-bottom: max(35px, env(safe-area-inset-bottom, 0px)); }
  .auth-subtitle, .auth-fineprint, .auth-inviter p { font-size: 12px; }
  dialog, dialog.wide { width: calc(100% - 24px); max-width: calc(100% - 24px); min-width: 0; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); margin: auto; overscroll-behavior: contain; }
  .modal-head { padding: 16px; }
  .modal-head h2 { font-size: 18px; }
  .modal-body { padding: 18px 16px; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .btn { flex: 1 1 120px; white-space: normal; }
  .toasts { right: 12px; left: 12px; bottom: max(12px, env(safe-area-inset-bottom, 0px)); max-width: none; }
  .toast button { min-width: 44px; min-height: 44px; margin-top: -8px; margin-bottom: -8px; margin-right: -10px; }
  .install-strip { padding: 10px 20px; }
  .install-methods { grid-template-columns: minmax(0, 1fr); }
  .monthly-tiers { grid-template-columns: minmax(112px, 1.5fr) repeat(4, minmax(50px, 1fr)); overflow-x: auto; }
  .monthly-tiers .tier-header { font-size: 10px; }
  .monthly-tiers .tier-name { font-size: 11px; }
}
@media (max-width: 380px) {
  .page { padding-inline: 12px; }
  .topbar { padding-inline: 12px; }
  .topbar-left { gap: 4px; }
  .profile-name { max-width: 72px; }
  .top-actions { gap: 4px; }
  .profile { gap: 6px; }
  .install-strip { padding-inline: 12px; }
  .install-strip-copy { font-size: 10px; }
  .install-entry { padding-inline: 10px; font-size: 12px; gap: 6px; }
  .detail-grid, .contract-amount-grid { grid-template-columns: minmax(0, 1fr); }
  .rule-fields { grid-template-columns: minmax(0, 1fr); }
  .demo-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Compact service introduction and phone authentication remain reachable. */
.partner-intro, .partner-intro > *, .home-rewards, .home-reward-grid > *, .home-referral-steps > *, .sms-code-row { min-width: 0; max-width: 100%; }
@media (max-width: 1000px) {
  .partner-intro { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .contact-placeholder { padding: 13px 16px; }
}
@media (max-width: 760px) {
  .partner-intro { padding: 19px; }
  .partner-intro h2 { font-size: 21px; }
  .partner-intro-copy > p { font-size: 12px; }
  .home-referral-steps { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .home-referral-steps strong { font-size: 13px; }
  .home-referral-steps span { font-size: 11px; }
  .home-rewards { padding: 19px; }
  .home-reward-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .home-reward-grid strong { font-size: 26px; }
  .home-reward-conditions, .home-rule-status { font-size: 11px; }
  .home-rewards-heading .mini-link, .partner-intro-copy > .mini-link { min-height: 44px; display: inline-flex; align-items: center; }
  .auth-box { margin-block: 0; }
  .auth-mobile-brand { padding-bottom: 25px; }
  .sms-code-row .btn { min-width: 104px; padding-inline: 10px; }
  .auth-service-notice, .sms-status { font-size: 12px; }
  .auth-service-notice .text-button { min-height: 44px; }
  .service-hero { padding: 23px; min-height: 0; }
  .service-hero h2 { font-size: 24px; }
}
@media (max-width: 380px) {
  .auth-main { padding-inline: 16px; }
  .partner-intro, .home-rewards { padding: 16px; }
  .home-reward-grid article { padding: 14px; }
  .home-reward-grid strong { font-size: 23px; }
  .contact-placeholder { padding: 12px; gap: 10px; }
  .contact-placeholder-icon { min-width: 40px; height: 40px; }
}
