/* Общие ограничения: вложенные сетки и медиа не расширяют страницу. */
html{max-width:100%;overflow-x:hidden;overflow-x:clip}
body{max-width:100%}
main,main>*,.container,.topbar-inner,.top-actions,.detail-layout,.catalog-layout,.admin-layout,.agency-columns,.chat-layout{min-width:0}
img,video,canvas{max-width:100%}
input,select,textarea{max-width:100%;min-width:0}
.table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.header-create-short{display:none}
.contact-price-line{display:flex;align-items:center;gap:8px;min-width:0}
.listing-title,.listing-address,.description-text,.dashboard-info,.agency-card,.public-profile-head,.report-card{overflow-wrap:anywhere}

@media(max-width:760px){
  .container{width:calc(100% - 20px);max-width:1240px}
  .topbar-inner{gap:8px}
  .brand{flex:none;min-width:0}
  .top-actions{justify-content:flex-end;gap:8px;margin-left:auto}
  .top-actions .btn{padding-inline:11px}

  .footer{padding:24px 0}
  .footer-row{align-items:flex-start;flex-direction:column;gap:15px}
  .footer-legal{display:flex;flex-wrap:wrap;gap:8px 16px}

  .section-head{align-items:flex-start;flex-direction:column;gap:12px}
  .section-head>div,.page-head>div{min-width:0}
  .section-head h2,.page-head h1{overflow-wrap:anywhere}
  .page-head h1{font-size:26px}
  .empty-state{padding:30px 16px}

  .hero-form>*{min-width:0}
  .operation-tabs{display:grid;grid-template-columns:1fr 1fr}
  .operation-tabs button{width:100%;padding:12px 8px}
  .category-tile{min-width:0;padding:13px}

  .catalog-toolbar{position:static}
  .toolbar-form>*{min-width:0}
  .catalog-results{min-width:0;padding-inline:10px}
  .catalog-heading>form,.catalog-heading select{width:100%}
  .extra-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:end}
  .extra-filters label{min-width:0}
  .extra-filters .btn{grid-column:1/3;width:100%}
  .filter-reset{grid-column:1/3;text-align:center}

  .detail-page{padding-top:12px}
  .detail-layout>*{min-width:0}
  .detail-title-row{margin:18px 0 14px}
  .detail-title-row h1{font-size:25px;overflow-wrap:anywhere}
  .detail-address{min-width:0;overflow-wrap:anywhere}
  .facts-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible}
  .facts-row>div{min-width:0;padding:12px}
  .facts-row>div:last-child:nth-child(odd){grid-column:1/3}
  .detail-card,.contact-card{min-width:0;padding:16px}
  .detail-card #listingMap{width:100%;height:300px!important}
  .spec-grid>div{align-items:flex-start;gap:12px}
  .spec-grid>div>*{min-width:0;overflow-wrap:anywhere}
  .spec-grid>div>b{max-width:60%;text-align:right}
  .contact-price-line{position:relative}
  .contact-price-line .price-history-tooltip{position:static}
  .contact-price-line .price-history-popup{left:0;right:0;top:calc(100% + 9px);width:auto;max-width:none}
  .contact-price-line .price-history-popup::before{right:auto;left:calc(100% - 36px)}
  .price-history-popup-row{grid-template-columns:minmax(0,1fr) auto}
  .price-history-popup-row>span{grid-column:2}
  .seller>div:last-child{min-width:0;overflow-wrap:anywhere}

  .form-page,.dashboard-page,.agency-page{padding-top:18px}
  .form-card{min-width:0;padding:16px}
  .form-card label,.form-card input,.form-card select,.form-card textarea{min-width:0}
  .form-submit .btn{width:100%}
  .photo-upload-status{align-items:flex-start;flex-direction:column;gap:4px}
  .photo-selected-preview{grid-template-columns:repeat(2,minmax(0,1fr))}
  .photo-manage{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
  .photo-manage>div,.photo-manage img{width:100%}
  .agency-listing-banner{align-items:flex-start;padding:13px}
  .agency-listing-banner>div{min-width:0;overflow-wrap:anywhere}

  .dashboard-head-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .dashboard-head-actions .btn{width:100%;min-width:0;padding-inline:10px;text-align:center}
  .dashboard-tabs{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .dashboard-tab{flex:none}
  .dashboard-item{grid-template-columns:82px minmax(0,1fr);padding:9px}
  .dashboard-item img{width:82px;height:76px}
  .dashboard-info>b,.dashboard-info>span{overflow-wrap:anywhere}
  .dashboard-actions{min-width:0;justify-content:flex-start}
  .dashboard-actions>*{min-width:0}
  .listing-statistics{max-width:100%}

  .agency-hero>*{min-width:0;max-width:100%}
  .agency-hero .btn{width:100%}
  .agency-card-head{align-items:flex-start;flex-direction:column}
  .agency-card-head .btn{width:100%}
  .agency-info-grid b,.agency-info-grid a,.agency-description{overflow-wrap:anywhere;word-break:break-word}
  .agency-member-row{grid-template-columns:38px minmax(0,1fr) auto}
  .agency-member-row>div:nth-child(2),.agency-member-row b,.agency-member-row span{min-width:0;overflow-wrap:anywhere}
  .agency-listing-banner{min-width:0}

  .chat-layout,.conversation-panel,.chat-panel{max-width:100%;min-width:0}
  .conversation-item{grid-template-columns:50px minmax(0,1fr);padding:11px}
  .conversation-item>img{width:50px;height:50px}
  .chat-header>div:last-child{min-width:0}
  .chat-header a,.chat-listing-deleted{max-width:calc(100vw - 125px)}
  .chat-bubble{min-width:0;overflow-wrap:anywhere}
  .chat-composer{max-width:100%}
  .chat-composer textarea{width:0;min-width:0}
  .chat-composer .btn{flex:none}
  .chat-attachments,.chat-attachments[data-count="1"],.chat-attachments[data-count="2"]{max-width:100%}

  .admin-layout{padding-top:14px}
  .admin-sidebar{max-width:100%;white-space:nowrap;-webkit-overflow-scrolling:touch}
  .admin-content,.admin-card,.moderation-item,.moderation-row>div{min-width:0}
  .admin-card-head{align-items:flex-start;flex-direction:column;gap:10px}
  .admin-card-head .btn{max-width:100%}
  .admin-head-actions,.admin-head-actions form{max-width:100%}
  .admin-head-actions form{display:flex;flex-wrap:wrap;gap:8px}
  .admin-head-actions input,.admin-head-actions select{flex:1 1 150px;width:auto}
  .moderation-row img{max-width:60px}
  .reject-form{max-width:100%;flex-wrap:wrap}
  .reject-form input{min-width:0;flex:1 1 150px}
  .field-row>*{width:100%;max-width:100%;min-width:0}
  .stats-grid>div{min-width:0}
  .agency-admin-item,.agency-admin-item>*{min-width:0}
  .agency-admin-item p,.agency-admin-details span{overflow-wrap:anywhere}
  .agency-admin-actions{max-width:100%;flex-wrap:wrap}
  .agency-admin-actions .reject-form{width:100%}
  .report-card-top{align-items:flex-start;flex-direction:column}
  .report-listing{min-width:0}
  .report-listing>div{min-width:0}
  .report-listing b{white-space:normal}
  .report-review-actions{max-width:100%}
  .revision-listing-summary>*{min-width:0}
  .revision-listing-summary h2,.revision-listing-summary p{overflow-wrap:anywhere}

  .public-profile-head>*{min-width:0}
  .public-profile-contacts,.public-profile-contacts a{max-width:100%;overflow-wrap:anywhere}
  .profile-settings-section{min-width:0}
  .notification-setting{min-width:0}
  .notification-setting-copy{overflow-wrap:anywhere}
  .saved-search-row>*{min-width:0;max-width:100%}
  .saved-search-row a,.saved-search-row button{overflow-wrap:anywhere}

  .pagination,.pagination .relative.inline-flex{max-width:100%}
  .pagination .relative.inline-flex{flex-wrap:wrap}
}

@media(max-width:380px){
  .top-actions{gap:6px}
  .top-actions .header-login-link{display:inline-flex!important;font-size:13px}
  .top-actions .header-register-link{display:none}
  .header-create-full{display:none}
  .header-create-short{display:inline}
  .header-create-link{width:38px;padding:0!important;font-size:22px}
  .brand{font-size:18px}
  .brand-mark{width:32px;height:32px}
  .category-strip{grid-template-columns:1fr}
  .facts-row{grid-template-columns:1fr}
  .facts-row>div:last-child:nth-child(odd){grid-column:auto}
  .agency-stats{grid-template-columns:1fr}
  .dashboard-head-actions{grid-template-columns:1fr}
  .chat-composer{gap:6px;padding:8px 6px}
  .chat-composer .btn{padding-inline:9px;font-size:12px}
  .chat-attach-button{width:40px}
}
