/* QA50 responsive delta. Phone rules (<=650px), DOM and all handlers are unchanged. */
@media (min-width:651px) {
  /* Long localized content must shrink/wrap inside its own column. */
  .grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .grid>.card,.grid>.card>a,.card-body { min-width:0; }
  .grid>.card .media { height:auto; aspect-ratio:4/3; }
  .grid>.card .media img { position:absolute; inset:0; }
  .card-meta,.card-bottom { flex-wrap:wrap; gap:6px; }
  .card h3,.card-meta,.card .price { overflow-wrap:anywhere; }
  .grid>.card .favorite { width:44px; height:44px; }
  .footer-row { flex-wrap:wrap; }
  .footer-row>div { min-width:0; }
  .form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .form-grid>*,.modal-head h2 { min-width:0; overflow-wrap:anywhere; }
  .form-actions,.sheet-actions { flex-wrap:wrap; }
  .form-actions>.btn,.sheet-actions>.btn { max-width:100%; white-space:normal; }
  .modal-head { gap:16px; align-items:flex-start; }
  .modal-head .close { flex-shrink:0; }
  dialog { max-height:calc(100dvh - 48px); overflow-y:auto; }
  dialog:has(.consumer-sheet) { max-height:calc(100dvh - 48px); }

  /* Keep discovery input readable on wide screens; results retain the page width. */
  .compact-market .search-suggest-wrap { max-width:840px; }
  .home-page .category-discovery .category { height:100px; min-height:100px; padding:9px 6px; gap:5px; }
  .home-page .category-discovery .category b,
  .home-page .category-discovery .category:is([data-cat="parts"],[data-cat="sports"],[data-cat="fashion"],[data-cat="building"]) b,
  :lang(de) .home-page .category-discovery .category:is([data-cat="collectibles"],[data-cat="music"],[data-cat="services"],[data-cat="agriculture"],[data-cat="parts"]) b { font-size:12px; line-height:1.25; }

  /* Community forms were left inside a 900px container while the form stopped at 620px. */
  .community-page:has(.account-form),.community-page:has(>.account-menu),
  .community-page.ha-admin { max-width:740px; }
  .community-page:has(.auth-signin) { max-width:560px; }
  .community-page>.account-form,.community-page>.account-menu { width:100%; max-width:100%; }
  .community-page .community-tabs .btn { min-height:44px; }
  .community-page:has(.chat-layout) { max-width:824px; }
  .chat-context { flex-wrap:wrap; }
  .chat-context-text { flex-basis:200px; }
  .chat-layout .message-bubble { max-width:min(85%,64ch); }
  .community-page #conversations .conversation-row { padding:16px 20px; }

  /* Admin action bars previously had seven unwrappable buttons. */
  .community-page:has(#control-rows),.moderator-workspace { max-width:1120px; }
  .community-page:has(#control-rows)>.form-actions { gap:8px; }
  #control-rows .panel,#admin-users-rows .panel { min-width:0; overflow-wrap:anywhere; }
  #admin-users-search { display:grid; grid-template-columns:minmax(0,1fr) 170px auto; gap:8px 12px; align-items:end; }
  #admin-users-search label[for=admin-users-query] { grid-column:1; grid-row:1; }
  #admin-users-search label[for=admin-users-role] { grid-column:2; grid-row:1; }
  #admin-users-query { grid-column:1; grid-row:2; }
  #admin-users-role { grid-column:2; grid-row:2; }
  #admin-users-search>.btn { grid-column:3; grid-row:2; }
  .ha-admin-form>label { flex-wrap:wrap; }
}

/* Deliberate two-row tablet header instead of accidental wrapping mid-controls. */
@media (min-width:651px) and (max-width:1199px) {
  .nav { min-height:0; gap:4px 12px; flex-wrap:wrap; padding-top:10px; padding-bottom:6px; }
  .nav .brand { margin-right:auto; }
  .nav>.btn { display:inline-flex; min-height:44px; padding:10px 12px; white-space:normal; }
  .nav .lang { margin-left:0; }
  .nav .navlinks { display:flex; order:10; flex:1 0 100%; gap:8px 24px; flex-wrap:wrap; margin:0; }
  .nav .navlinks a { min-height:44px; display:flex; align-items:center; padding:6px 0; font-size:14px; white-space:normal; }
  .filter-actions,.detail-nav { top:110px; }
  /* Assistant remains below the taller header; existing keyboard override wins. */
  .ha-panel:not(.ha-keyboard) { top:auto; bottom:24px; left:auto; right:16px; width:420px; max-width:calc(100vw - 32px); max-height:calc(100dvh - 144px); }
}

@media (min-width:651px) and (max-width:950px) {
  .inventory-card.inventory-compact,
  :lang(de) .inventory-card.inventory-compact { grid-template-columns:112px minmax(0,1fr) 104px; padding:12px; gap:12px; }
  .inventory-compact .inventory-side-actions .btn { min-height:44px; padding:8px; }
}

/* iPad portrait: a full-width summary, not two cramped ~330px columns. */
@media (min-width:769px) and (max-width:1023px) {
  .detail-page { max-width:860px; }
  .detail-page .detail { grid-template-columns:minmax(0,1fr); gap:18px; }
  .detail-page .gallery-frame .media { height:clamp(320px,48vw,440px); }
}
@media (min-width:769px) {
  .detail-page .seller-summary-row { gap:8px 16px; }
  .detail-page .detail-actions { flex-wrap:wrap; }
  .detail-page .detail-actions>.btn { white-space:normal; max-width:100%; }
  .detail-page .detail-information { padding:20px 24px; }
  .location-map-panel #location-map { height:clamp(240px,38dvh,340px); }
  .pi-detail dl { display:grid; grid-template-columns:minmax(140px,1fr) minmax(0,2fr); gap:8px 20px; }
  .pi-detail dl>dt:first-child { grid-column:1/-1; }
  .pi-detail dt,.pi-detail dd { margin:0; padding:8px 0; overflow-wrap:anywhere; }
}
@media (min-width:951px) {
  .grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .inventory table { table-layout:fixed; min-width:0; white-space:normal; }
  .inventory th:first-child { width:42%; }
  .inventory th:nth-child(2) { width:18%; }
  .inventory th:nth-child(3) { width:16%; }
  .inventory td { overflow-wrap:anywhere; }
  .inventory .table-actions { flex-wrap:wrap; }
}
@media (min-width:1200px) {
  .nav { gap:14px; }
  .navlinks { gap:14px; }
  .navlinks a { min-height:44px; display:flex; align-items:center; }
  .grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  /* Public profile is intentionally narrower than discovery. */
  .community-page .grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
