/* Shared public-page rhythm. Desktop designs and workspace layouts stay independent. */
.search-tabs-left .search-tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.search-tabs-left .search-tab svg { flex: none; }
@media (max-width: 760px) {
  html body main { min-width: 0; }
  html body main :is(input, select, textarea) { max-width: 100%; }
  html body main :is(h1, h2, h3) { text-wrap: balance; }
  html body main p { text-wrap: pretty; }
  html body :is(.page-wrap, .account-shell) { box-sizing: border-box; }

  /* Property details: one clear vertical sequence, including empty/error states. */
  html body.property-page .page-wrap { padding-inline: 16px; }
  html body.property-page .grid { gap: 20px; }
  html body.property-page .grid > article.card { padding: 24px 20px; }
  html body.property-page .grid > article.card > h2,
  html body.property-page .detail-section > h2 { margin: 0 0 14px; text-align: center; font-size: 21px; font-weight: 550; line-height: 1.35; }
  html body.property-page :is(.description, #listingAttribution, #assetList > p, #openHouses > p, #propertyHistory > p) { text-align: center; line-height: 1.65; margin: 0; }
  html body.property-page .detail-section { margin-top: 24px; padding-top: 24px; }
  html body.property-page .pp-section-heading { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-items: center; gap: 16px; margin-bottom: 18px; text-align: center; }
  html body.property-page .pp-section-heading h2 { font-size: 21px; font-weight: 550; line-height: 1.35; }
  html body.property-page .pp-score-button { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 46px; margin: 0; }
  html body.property-page .pp-assets { grid-template-columns: minmax(0, 1fr); }
  html body.property-page .status:empty { display: none; min-height: 0; margin: 0; padding: 0; }
  html body.property-page .status:not(:empty) { margin: 12px 0 0; text-align: center; }
  html body.property-page #openHouses .schedule-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 18px; }
  html body.property-page #openHouses .schedule-actions button { width: 100%; min-height: 44px; }
  html body.property-page #mapLink { display: block; text-align: center; margin-top: 16px; }
  html body.property-page #mapLink[hidden] { display: none; }
  html body.property-page .pp-contact-card { padding: 0; }
  html body.property-page .pp-contact-heading { padding: 24px 20px 0; text-align: center; }
  html body.property-page .pp-agent { flex-direction: column; align-items: center; text-align: center; gap: 12px; margin: 0 20px 18px; }
  html body.property-page #contactDescription { margin-inline: 20px; text-align: center; line-height: 1.6; }
  html body.property-page .property-contact-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 0 20px 20px; }
  html body.property-page .property-contact-actions > :is(a, button) { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 44px; margin: 0; text-align: center; }
  html body.property-page .pp-contact-compose { margin: 0 20px 24px; }
  html body.property-page #contactSubmit { width: 100%; }
  html body.property-page .pp-price-card .price { flex-direction: column; align-items: center; gap: 8px; }
  html body.property-page .pp-price-card .pp-badges { display: flex; flex-direction: column; align-items: center; gap: 10px; }
  html body.property-page .pp-price-card .pp-badges > * { justify-content: center; min-width: 160px; min-height: 32px; }

  /* Home and editorial pages share centered introductions and intentional actions. */
  html body:is(.rf-home, .rf-home-hybrid, .rf-experience, .rf-neighborhoods) :is(.section-head, .footer-top) { display: flex; flex-direction: column; align-items: center !important; gap: 16px; text-align: center; }
  html body:is(.rf-home, .rf-home-hybrid, .rf-experience, .rf-neighborhoods) :is(.section-copy, .section-head p) { margin-inline: auto; max-width: 44ch; }
  html body:is(.rf-home, .rf-home-hybrid, .rf-experience, .rf-neighborhoods) .hero-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; width: 100%; max-width: 420px; margin-inline: auto; }
  html body:is(.rf-home, .rf-home-hybrid, .rf-experience, .rf-neighborhoods) .hero-actions > a { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin: 0; box-sizing: border-box; }
  html body.rf-neighborhoods .stats { text-align: center; }
  html body.rf-neighborhoods .stat { text-align: center; }
  html body:is(.rf-home, .rf-home-hybrid) .search-tabs-left { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 4px; }
  html body:is(.rf-home, .rf-home-hybrid) .search-tab { min-width: 0; min-height: 44px; padding-inline: 3px; text-align: center; gap: 4px; }
  html body:is(.rf-home, .rf-home-hybrid) .advanced-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  html body:is(.rf-home, .rf-home-hybrid) .advanced-filters > * { min-width: 0; width: 100%; }
  html body:is(.rf-home, .rf-home-hybrid) .advanced-filters > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  html body:is(.rf-home, .rf-home-hybrid) .advanced-filters .filter-btn { width: 100%; min-height: 44px; justify-content: center; }
  html body:is(.rf-home, .rf-home-hybrid) .ethan-heading { justify-content: center; text-align: center; }
  html body:is(.rf-home, .rf-home-hybrid) .ethan-heading p { width: 100%; }

  /* Public directories keep labels readable while headings and actions align. */
  html body .account-shell.page-wrap { width: 100%; margin: 24px auto 40px; padding: 0 16px; }
  html body .account-shell.page-wrap > :is(h1, p) { text-align: center; }
  html body .account-shell.page-wrap > h1 { font-size: 30px; line-height: 1.2; margin: 0 0 12px; }
  html body .account-shell.page-wrap > p { line-height: 1.65; }
  html body .building-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 20px; margin-top: 24px; }
  html body .building-filters :is(label, input, button) { min-width: 0; width: 100%; }
  html body .directory-pages { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
  html body .directory-pages button { width: 100%; padding-inline: 10px; }
  html body .account-shell.page-wrap > button { display: block; width: 100%; margin: 16px 0; }
  html body .account-shell.page-wrap > button[hidden] { display: none; }
  html body main.page-wrap:has(#promotionStatus) { padding: 28px 20px; text-align: center; }
  html body #promotionContinue { width: 100%; min-height: 48px; }

  /* Market profiles: bounded content navigation instead of an overflowing sidebar. */
  html body main.container:has(> .content-body) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px 16px; width: 100%; box-sizing: border-box; }
  html body main.container:has(> .content-body) > :is(aside, .content-body) { width: 100%; min-width: 0; }
  html body main.container:has(> .content-body) .sidebar { position: static; width: 100%; min-width: 0; }
  html body main.container:has(> .content-body) .sidebar-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  html body main.container:has(> .content-body) .step-item { padding: 10px; margin: 0; min-width: 0; white-space: normal; overflow-wrap: anywhere; text-align: center; font-size: 12px; }
  html body main.container:has(> .content-body) :is(h2, .section-subtitle) { text-align: center; }
  html body main.container:has(> .content-body) { margin-block: 12px 32px; }
  html body main.container:has(> .content-body) .pros-cons-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  html body main.container:has(> .content-body) .pc-card { min-width: 0; }
  html body main.container:has(> .content-body) .price-box { padding: 24px 16px; text-align: center; }
  html body main.container:has(> .content-body) .price-box .val { font-size: clamp(24px, 7vw, 36px); line-height: 1.25; overflow-wrap: anywhere; text-wrap: balance; }
  html body main.container:has(> .content-body) .content-section h2 { font-size: 28px; font-weight: 600; line-height: 1.25; }

  html body.building-page .page-wrap { margin-top: 24px; padding-inline: 16px; }
  html body.building-page main.page-wrap > a { display: block; text-align: center; }
  html body.building-page #building > :is(h1, h2, p, #buildingSave) { text-align: center; }
  html body.building-page #building h1 { font-size: 30px; line-height: 1.25; margin: 24px 0 16px; }
  html body.building-page #building > h2 { font-size: 24px; line-height: 1.3; margin-top: 28px; }
  html body.building-page :is(#buildingMedia:empty, .status:empty) { display: none; }
  html body.building-page .grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  html body.building-page #buildingListings .card { text-align: center; padding: 24px 20px; }

  /* Search uses deliberate rows; hidden filters remain hidden. */
  html body .search-header .search-input-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  html body .search-header .search-input-row > * { width: 100%; min-width: 0; }
  html body .search-header .rf-filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; overflow: visible; margin: 14px 0 0; padding: 0; }
  html body .search-header .rf-filter-bar > .rf-segment { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html body .search-header .rf-filter-bar > .rf-pop { min-width: 0; }
  html body .search-header .rf-filter-bar > .rf-pop > .rf-pill { width: 100%; justify-content: space-between; min-height: 44px; }
  html body .rf-results-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; text-align: center; }
  html body .rf-results-bar .rf-save-group { display: grid; grid-template-columns: 1fr 44px; gap: 10px; margin: 0; }
  html body .rf-results-bar .rf-save-group > * { width: 100%; min-height: 44px; justify-content: center; }
  html body .rf-results-bar .rf-sort { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; text-align: left; }
  html body .rf-results-bar .rf-sort select { width: 100%; min-width: 0; height: 44px; }
  html body .listings-scroll { padding: 20px 16px; }

  /* Auth stays a form, with a calm centered introduction and full-width actions. */
  html body .auth-wrapper { padding: 24px 16px; }
  html body .auth-wrapper :is(h1, .auth-subtitle) { text-align: center; }
  html body .auth-wrapper .auth-shell { min-width: 0; max-width: 100%; }
  html body #authLanguage { display: none; }
  html body .auth-wrapper .intro { padding-block: 8px 24px; }
  html body .auth-wrapper #introHeadline { font-size: 30px; font-weight: 600; line-height: 1.2; text-shadow: none; }
  html body .auth-wrapper .auth-card { padding: 24px 20px; border-radius: 20px; }
  html body .auth-wrapper .step0-logo { font-size: 34px; font-weight: 600; }
}

@media (max-width: 640px) {
  html body #rf-universal-header .uh-inner { gap: 6px; padding-inline: 12px; grid-template-columns: minmax(68px, 1fr) 36px 36px auto 36px; }
  html body #rf-universal-header .rf-brand-logo { height: 28px !important; max-width: 100%; object-fit: contain; }
  html body #rf-universal-header :is(.uh-search, .uh-search button, .uh-language, [data-navigation-toggle]) { width: 36px; }
  html body #rf-universal-header .uh-search.is-searching { width: auto; }
  html body #rf-universal-header [data-get-started] { padding-inline: 7px; font-size: 11px; }
  html body .ethan-floating { right: 12px; }
  html body .ethan-launcher { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  html body .ethan-launcher svg { width: 22px; height: 22px; flex: none; }
  /* Reserve a real navigation slot for Ethan instead of floating over the page. */
  html body:has(.ethan-floating) #rf-universal-header .uh-inner { grid-template-columns: minmax(56px, 1fr) 30px 30px auto 36px 32px; gap: 4px; padding-inline: 10px; }
  html body:has(.ethan-floating) #rf-universal-header :is(.uh-search, .uh-search button, .uh-language) { width: 30px; }
  html body:has(.ethan-floating) #rf-universal-header .uh-search.is-searching { width: auto; }
  html body:has(.ethan-floating) #rf-universal-header [data-navigation-toggle] { grid-column: 6; width: 32px; }
  html body:has(.ethan-floating) #rf-universal-header [data-get-started] { font-size: 10px; padding-inline: 6px; }
  html body:has(.ethan-floating) #rf-universal-header [data-get-started]::before { display: none; }
  html body .ethan-floating .ethan-launcher { position: fixed; right: 46px; bottom: calc(14px + env(safe-area-inset-bottom)); width: 36px; height: 44px; min-height: 44px; border-radius: 10px; box-shadow: none; background: #ffffff0d; color: #fff; }
}
